You are not logged in.

#1 2023-11-02 10:54:42

acheronfail
Member
Registered: 2022-01-03
Posts: 4

[SOLVED] no /dev/disk devices in initramfs when launching via qemu

I'm trying to create a script which generates an archlinux guest in a bootable qemu image.
My current script is fairly small and can be found here.

However, when I boot the image with this:

qemu-system-x86_64 \
    -kernel vm/vmlinuz -initrd vm/initramfs -append "init=/bin/bash"
    -drive file="tmp/vm.qcow2" \
    -cpu host \
    -enable-kvm \
    -m 2048 \
    -smp 2

I get dropped into the `rootfs` shell as expected, but there are no devices under `/dev/disk`. There's no `/dev/sda` or anything at all.
Even `blkid` returns no output!

This is what `fdisk -l vm/disk.qcow2` shows:

Disk ./vm.qcow2: 1.43 GiB, 1530789888 bytes, 2989824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf18dcc22

Device       Boot Start     End Sectors  Size Id Type
./vm.qcow2p1 *     2048 2988031 2985984  1.4G 83 Linux

So the partitions are there.
I'm really not sure why it's not showing up here.

I did download one of the images from https://gitlab.archlinux.org/archlinux/arch-boxes, and then extracted the `vmlinux-linux` and `initramfs-linux.img` files from that image.
If I boot with these, then I do see disks in the `rootfs`!! `blkid` returns output, it all just works there.

So, any ideas why my `vmlinuz-linux` and `initramfs-linux.img` files don't work here?
Anything I can look into?

Last edited by acheronfail (2023-11-02 11:37:24)

Offline

#2 2023-11-02 10:57:55

frostschutz
Member
Registered: 2013-11-15
Posts: 1,647

Re: [SOLVED] no /dev/disk devices in initramfs when launching via qemu

try the fallback image? then rebuild initramfs from within qemu so the necessary kernel modules will be included. or add them to your mkinitcpio.conf

Offline

#3 2023-11-02 11:20:39

acheronfail
Member
Registered: 2022-01-03
Posts: 4

Re: [SOLVED] no /dev/disk devices in initramfs when launching via qemu

Can't believe I didn't think of that before!

The fallback image worked - and the VM can now boot just fine - thanks for that.
Now that you say it, I had another look at the arch-boxes repository and they in fact build the image from within qemu itself - I suppose that's to fix this problem.

Rather than having to do that, do you know if there's a way for me to find the specific modules I need so I can include them in mkinitcpio.conf?
Is there a way to list the ones that are in a built image or something? (thinking of comparing the image built from wihtin qemu to the one built on the host).

**EDIT**: here's a good guide to find needed modules: https://wiki.archlinux.org/title/mkinit … ed_modules

Last edited by acheronfail (2023-11-02 11:39:09)

Offline

Board footer

Powered by FluxBB