Fedora 18에서 사용자 모드 Linux용 rootfs를 만드는 방법은 무엇입니까?

Fedora 18에서 사용자 모드 Linux용 rootfs를 만드는 방법은 무엇입니까?

UML 커널과 함께 사용하고 인터넷을 사용할 수 있는 rootfs를 만들고 싶습니다. 나는 febootstrap패키지와 함께 사용하고 있었습니다: bash, coreutils, net-tools, iputils. 사용 후 UML을 사용하여 부팅하려고 하면 다음 오류가 발생합니다 febootstrap-supermin-helper.rootfs

[    4.340000] systemd[1]: systemd-logind.service holdoff time over, scheduling restart.
[    4.340000] systemd[1]: dbus.service start request repeated too quickly, refusing to start.
[    4.340000] systemd-logind[638]: Failed to get system D-Bus connection: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
[    4.340000] systemd-logind[638]: Failed to fully start up daemon: Connection refused

어떤 패키지가 필요한지 rootfs, 그 외에 다른 방법이 있는지 궁금합니다 febootstrap.

답변1

어쩌면 PRoot를 시도해 볼 수도 있습니다(http://proot.me) UML의 대안으로 사용됩니다. 둘 다 ptrace(2)를 기반으로 하지만 PRoot는 게스트 시스템에서 인터넷 액세스를 얻기 위해 어떤 설정도 필요하지 않습니다.

host$ proot -R ./fedora-18-x86_64/ bash
guest$ wget http://google.fr
...

여기서 "./fedora-18-x86_64/"는 다음에서 다운로드한 rootfs의 콘텐츠입니다.http://download.openvz.org/template/precreated/

답변2

루트 빌드

.defconfig 에 qemu_x86_64_defconfig추가해야 한다는 점을 제외하면 defconfig는 거의 작동했습니다 . Buildroot 가 .::sysinit:/sbin/mdev -sinittabCONFIG_DEVTMPFS_MOUNT/dev

루트프:

git clone git://git.buildroot.net/buildroot
cd buildroot
git checkout 2017.02
make qemu_x86_64_defconfig

# Custom inittab.
echo 'BR2_ROOTFS_OVERLAY="rootfs_overlay"' >>.config
make olddefconfig
mkdir -p rootfs_overlay/etc
printf '
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts
::sysinit:/bin/mkdir -p /dev/shm
::sysinit:/bin/mount -a
::sysinit:/sbin/mdev -s
::sysinit:/bin/hostname -F /etc/hostname
::sysinit:/etc/init.d/rcS
console::respawn:/sbin/getty -n -L console 0 vt100
::ctrlaltdel:/sbin/reboot
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r
' > rootfs_overlay/etc/inittab

# Build image.
make BR2_JLEVEL=$(($(nproc)-2))
cp output/images/rootfs.ext2 /path/to/linux

그런 다음 커널 소스에서:

cd /path/to/linux
git checkout v4.9
make mrproper
make defconfig ARCH=um
make ARCH=um
./linux eth0=tuntap,,,192.168.0.254

이제 VM 내부에 있으며 다음을 수행하여 나갈 수 있습니다.

poweroff

파일 시스템은 지속적입니다. 다음을 사용해 보십시오.

date >f

그리고 재부팅하세요.

TODO 네트워크를 작동시키세요. 현재 eth0=는 Buildroot의 init가 네트워크 장치를 기다리는 것을 막기 위한 더미일 뿐입니다.

다음과 같이 커널을 단계적으로 디버깅할 수도 있습니다.https://stackoverflow.com/questions/4943857/linux-kernel-live-debugging-how-its-done-and-what-tools-are-used/44669413#44669413

TODO 커널 모듈은 x86이 아닌 UML에 대해 컴파일해야 하기 때문에 커널 모듈을 처리하는 방법을 모르겠습니다. 첫 번째 문제는 UML에 영향을 미치는 것이 insmod없기 때문에 실패한다는 것 입니다 . 그리고 강제로 해를 끼치면 다음과 같은 이상한 일이 발생합니다.SMPvermagicprintk 아무것도 인쇄하지 않는 등 이상한 일이 발생합니다. 관련된:https://stackoverflow.com/questions/2488625/user-mode-linux-installing-a-module-error

원하는 경우 QEMU를 사용하여 해당 이미지를 검사할 수도 있습니다.

qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append root=/dev/vda -net nic,model=virtio -net user

Ubuntu 14.04, 커널 3.13.0 호스트에서 테스트되었습니다.

관련 정보