[arch-general] iniitcpio root device check

Dave Reisner d at falconindy.com
Sun Jul 31 11:26:30 EDT 2011


> I have an arch linux install running in qemu using a 9p virtual root
> filesystem (root filesystem is just a sub directory on the host).
> 
> This is the line I use to launch it:
> 
> qemu-system-x86_64 -enable-kvm -virtfs
> local,path=$(pwd)/wn-root,security_model=mapped,mount_tag=wn-root -smp
> 2 -m 1024 -kernel ./wn-root/boot/vmlinuz26 -append 'rootfstype=9p
> rootflags="trans=virtio,version=9p2000.L" root=wn-root ro
> rootdelay=10' --initrd ./wn-root/boot/kernel26-fallback.img -net vde
> -net nic,vlan=0,macaddr=52:54:00:00:EE:03
> 
> Immediately after "::Running Hook [resume]" though I get:
> 
> Root device 'wn-root' does'nt exist. Attempting to create it.
> ERROR: Unable to determine major/minor number of root device 'wn-root'.
> 
> At that point I'm dropped into the recovery shell, I exit that, it
> complains, but continues to boot fine as it the existence in /dev/ of
> a 9p filesystem source is not needed.
> 
> I did not find anything in mkinitcpio.conf to disable this check,
> which in this case is not needed, as the root filesystem is mounted
> without any problem.
> 
> Using 9p for a kvm root filesystem is useful for cases where something
> like Linux containers (LXC) is not sufficient to accomplish some task.
> 
> For the most part this is working fine, still have some 9p filesystem
> oddities to work through. For instance, syslog-ng won't start and
> using makepkg on some packages results in "cat: -: No such file or
> directory" (that error does not occur when that arch install is
> chrooted into and build run from inside the chroot). The 9p issues are
> not relevant to the initcpio workaround I'm looking for though.
> 
> Dwight

You'll likely want to create your own mount handler as this is a bit of
an edge case. Doesn't need to be anything complex..

9p_mount_handler() {
  mount -t 9p -o ro,${rootflags} "$root" "$1"
}
mount_handler=9p_mount_handler

This gets added to /lib/initcpio/hooks (call it 9p?) and then wrapped up
in a build script which is added to /lib/initcpio/install. After that,
add '9p' to your HOOKS in the config. Note that while the install
scripts are interpreted by /bin/bash, hooks that run on the initcpio are
interpreted by /bin/busybox ash.

dave


More information about the arch-general mailing list