amluto / virtme

An easy way to virtualize the running system
GNU General Public License v2.0
330 stars 66 forks source link

Forgotten CONFIG_ values #34

Open majek opened 5 years ago

majek commented 5 years ago

I'm quite sure virtme requires at least

CONFIG_BLK_DEV_INITRD Needed for the initrd to work at all. Otherwise only non-initrd stuff works. (shell)

CONFIG_INOTIFY_USER Needed for proper udev /dev/virtio-port mounting. Without this you'll see error: virtme-init: cannot find script I/O port; make sure virtio-serial is available

CONFIG_ACPI Needed for shutdown to actually close the vm. otherwise it hangs on message reboot: System halted

On top of the already documented ones. This should probably be added to virtme/configkernel.

I did:

rm .config
make tinyconfig
make kvmconfig
./scripts/config \
        -e EARLY_PRINTK \
        -e 64BIT \
        -e BPF -d EMBEDDED -d EXPERT \
        -e INOTIFY_USER \
        -e ACPI

./scripts/config \
        -e VIRTIO -e VIRTIO_PCI -e VIRTIO_MMIO \
        -e NET -e NET_CORE -e NETDEVICES -e NETWORK_FILESYSTEMS \
        -e INET -e NET_9P -e NET_9P_VIRTIO -e 9P_FS \
        -e VIRTIO_NET -e VIRTIO_CONSOLE \
        -e DEVTMPFS -e SCSI_VIRTIO -e BINFMT_SCRIPT -e TMPFS \
        -e UNIX -e TTY -e VT -e UNIX98_PTYS -e WATCHDOG -e WATCHDOG_CORE \
        -e I6300ESB_WDT \
        -e BLOCK -e SCSI_LOWLEVEL -e SCSI -e SCSI_VIRTIO \
        -e BLK_DEV_SD -e BLK_DEV_INITRD \
        -e VIRTIO_BALLOON \
        -d CMDLINE_OVERRIDE \
        -d UEVENT_HELPER \
        -d EMBEDDED -d EXPERT \
        -d MODULE_SIG_FORCE

make olddefconfig
make bzImage
amluto commented 4 years ago

Hmm. This really ought to work without ACPI and BLK_DEV_INITRD. I'll add INOTIFY for now.

majek commented 3 years ago

ACPI is indeed not needed (apart from the described halt problem), BLK_DEV_INITRD is needed though. Without it:

~/src/virtme$ sudo ./virtme-run --rw --pwd --kimg ../linux/arch/x86/boot/bzImage  --memory 1G --force-initramfs 

List of all partitions:
No filesystem could mount root, tried: 

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Not tainted 5.10.3+ #164
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
Call Trace:
 panic+0xe5/0x267
 ? printk+0x47/0x49
 mount_block_root+0x2e0/0x2e0
 ? rest_init+0x7e/0x7e
 prepare_namespace+0x12c/0x15b
 ? rest_init+0x7e/0x7e
 kernel_init+0x9/0xef
 ret_from_fork+0x1f/0x30
Kernel Offset: disabled
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
marcosps commented 1 year ago

@arighi what do you think about it? Can we add BLK_DEV_INITRD on your fork?

arighi commented 1 year ago

@marcosps applied https://github.com/arighi/virtme/commit/0bc524e68221bf727b788a677d4c7637a8bf817f

I added it to the optional configs (optionals are only available in my fork - these are configs that you can override passing a custom config snippet via virtme-configkernel --custom FILE).

I think it should be optional because we may want to disable it when we are 100% sure to use a initramfs-less boot. By default it'll be enabled so we won't break virtme-run --force-initramfs.

marcosps commented 1 year ago

@arighi thanks! @majek since @arighi is maintaining a fork of virtme and applying other pending fixes, maybe you should take a look or even start using it. I believe that we'll at least check new issues being opened for the project :)