arighi / virtme-ng

Quickly build and run kernels inside a virtualized snapshot of your live system
GNU General Public License v2.0
417 stars 45 forks source link

Aborts with `dpkg is not available, unable to uncompress kernel deb` when testing a custom build Linux kernel #79

Closed paulmenzel closed 7 months ago

paulmenzel commented 7 months ago

Trying virtme-ng on the custom distribution MarIuX64, I get

$vng --verbose -r vmlinux
dpkg is not available, unable to uncompress kernel deb

This is from:

https://github.com/arighi/virtme-ng/blob/58e1033b7370587a93e559a6f40d7c171cb5d407/virtme_ng/mainline.py#L45-L46

I do not understand, why I need dpkg, when I want to test a custom build Linux kernel.

arighi commented 7 months ago

vmlinux is not a valid bootable kernel, it's an ELF, you need to use arch/x86/boot/bzImage.. and I see why it's try to use dpkg, it assumes that you're specifying a an upstream version v<NUMBER>, while in your case you have vmlinux.

I'll fix that to make sure the parsing of an upstream version is more robust.

In the meantime, don't try to boot a vmlinux, because it's not possible. :)

arighi commented 7 months ago

Alright, c164a3a should help to prevent errors like this. But the proper fix for your issue is to not use vmlinux. :) If you have just recompiled your kernel you can simply run vng or vng -r ., it'll automatically find the proper kernel file to use.

paulmenzel commented 7 months ago
$ vng --verbose -r arch/x86_64/boot/bzImage
warning: failed to retrieve kernel version from: arch/x86_64/boot/bzImage (modules may not work)
No EFI environment detected.
early console in extract_kernel
input_data: 0x0000000002a002b9
input_len: 0x0000000000aacbd9
output: 0x0000000001000000
output_len: 0x00000000024677c4
kernel_total_size: 0x0000000002230000
needed_size: 0x0000000002600000
trampoline_32bit: 0x0000000000000000
Physical KASLR using RDRAND RDTSC...
Virtual KASLR using RDRAND RDTSC...

Decompressing Linux... Parsing ELF... Performing relocations... done.
Booting the kernel (entry_offset: 0x0000000000000000).
[    0.000000] Linux version 6.8.0-rc5-virtme (pmenzel@holidayincambodia.molgen.mpg.de) (gcc (GCC) 12.3.0, GNU ld (GNU Binutils) 2.41) #1 SMP PREEMPT_DYNAMIC Thu Feb 22 13:09:35 CET 2024
[    0.000000] Command line: virtme_hostname=virtme-ng virtme_rw_overlay0=/etc virtme_rw_overlay1=/lib virtme_rw_overlay2=/home virtme_rw_overlay3=/opt virtme_rw_overlay4=/srv virtme_rw_overlay5=/usr virtme_rw_overlay6=/var console=hvc0 earlyprintk=serial,ttyS0,115200 virtme_console=ttyS0 psmouse.proto=exps "virtme_stty_con=rows 55 cols 211 iutf8" TERM=screen virtme_chdir=dev/shm/linux virtme_user=pmenzel rootfstype=9p rootflags=version=9p2000.L,trans=virtio,access=any raid=noautodetect ro init=/home/pmenzel/.local/lib/python3.11/site-packages/virtme/guest/virtme-init
[…]
[    1.610022] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[    1.610195] Run /home/pmenzel/.local/lib/python3.11/site-packages/virtme/guest/virtme-init as init process
[    1.742017] mount (436) used greatest stack depth: 13480 bytes left
[    2.007968] mount (456) used greatest stack depth: 13120 bytes left
/home/pmenzel/.local/lib/python3.11/site-packages/virtme/guest/virtme-init: line 136: cd: dev/shm/linux: No such file or directory
[    2.355607] virtme-init: basic initialization done
[    2.371273] virtme-init: running systemd-tmpfiles
[    2.373711] virtme-init: starting udevd
Starting version 242
[    2.467784] virtme-init: triggering udev coldplug
Failed to open directory 'mxloadmonitor': Permission denied
Failed to create directory or subvolume "/var/mxloadmonitor/htdocs": Permission denied
Failed to create directory or subvolume "/var/mxloadmonitor/log": Permission denied
Failed to open directory 'private': Permission denied
[    2.772310] virtme-init: waiting for udev to settle
[    2.937773] systemd-vconsole-setup[603]: KD_FONT_OP_GET failed while trying to get the font metadata: Invalid argument
[    2.938079] systemd-vconsole-setup[603]: Fonts will not be copied to remaining consoles
[    2.946980] virtme-init: udev is done
[    3.072005] virtme-init: Setting hostname to virtme-ng...
[    3.120466] ip (618) used greatest stack depth: 12400 bytes left
          _      _
   __   _(_)_ __| |_ _ __ ___   ___       _ __   __ _
   \ \ / / |  __| __|  _   _ \ / _ \_____|  _ \ / _  |
    \ V /| | |  | |_| | | | | |  __/_____| | | | (_| |
     \_/ |_|_|   \__|_| |_| |_|\___|     |_| |_|\__  |
                                                |___/
   kernel version: 6.8.0-rc5-virtme x86_64

pmenzel@virtme-ng:/$

vng --verbose -r . also worked.

Thank you and sorry for the noise.

arighi commented 7 months ago

No problem, thanks for reporting this.