febootstrap을 사용하여 qemu용 지붕 이미지를 만드는 방법

febootstrap을 사용하여 qemu용 지붕 이미지를 만드는 방법

febootstrap을 사용하여 qemu-kvm의 지붕 이미지를 만들려고 합니다.

먼저 다음 명령을 사용하여 지붕을 생성했습니다.

febootstrap -i coreutils -i vim centos79 centos_7.9 https://mirrors.163.com/centos/7/os/x86_64/

그 후 다음과 같은 디렉토리를 얻었습니다.

> tree centos_7.9/ -L 1
centos_7.9/
├── bin -> usr/bin
├── boot
├── dev
├── etc
├── home
├── lib -> usr/lib
├── lib64 -> usr/lib64
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin -> usr/sbin
├── srv
├── sys
├── tmp
├── usr
└── var

그런 다음 qemu 이미지를 만들고 centos_7.9의 모든 파일을 이미지에 복사했습니다.

qemu-img create centos79.img 1g
mkfs.ext4 centos79.img
mkdir mnt_dir
sudo mount -o loop centos79.img mnt_dir
cp centos_7.9/* mnt_dir
umount mnt_dir

그러나 내가 달릴 때

qemu-system-x86_64 -kernel /boot/vmlinuz-`uname -r` \
    -hda=centos79.img \
    -append "root=/dev/sda console=ttyS0" \
    -enable-kvm -nographic

또는

qemu-system-x86_64 -kernel /boot/vmlinuz-`uname -r` \
    -drive file=centos79.img \
    -append "root=/dev/hda console=ttyS0" \
    -enable-kvm -nographic

보고했다

[    1.766919] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.767906] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.14.0-3.1.0.kwai+ #10
[    1.767906] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.5.1 01/01/2011
[    1.767906] Call Trace:
[    1.767906]  dump_stack_lvl+0x34/0x48
[    1.767906]  panic+0xfb/0x2cd
[    1.767906]  mount_block_root+0x28c/0x29f
[    1.767906]  prepare_namespace+0x13b/0x16a
[    1.767906]  kernel_init_freeable+0x17f/0x1a4
[    1.767906]  ? rest_init+0xc0/0xc0
[    1.767906]  kernel_init+0x16/0x130
[    1.767906]  ret_from_fork+0x22/0x30
[    1.767906] Kernel Offset: disabled
[    1.767906] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---

이 문제를 해결하려면 어떻게 해야 합니까?

관련 정보