[Virtio-fs] Convenience vmlinuz link auto-update patch for direct-kernel booting

Harry G. Coin hgcoin at gmail.com
Sat Nov 14 19:49:25 UTC 2020


It's bothersome to require VM hosts using direct kernel virtio-fs
booting to have to puzzle out what the latest kernel / initramfs rev is
in the guest.

If in the guest you create /etc/kernel/postinst.d/update_boot_links

with this:

#!/bin/bash
#Used by vm host to boot latest kernel without having to update kernel
spec in the host.
KERNEL_VERSION="$1"
#KERNEL_IMAGE="$2"

cd /boot
ln -sf vmlinuz-$KERNEL_VERSION /boot/vmlinuz
ln -sf initramfs-$KERNEL_VERSION.img /boot/initrd.img

then

chmod 0755 /etc/kernel/postinst.d/update_boot_links

Then in on the host under 'boot options' put as the kernel path

/path/to/guest/vmlinuz  

and

/path/to/guest/initrd.img

in the initrd path and

root=virtiofs:myfs  rd.shell

in the kernel args (and have updated dracut as indicated in the message
titled

HOWTO: direct kernel 'root=virtiofs:myfs' boot on 'vanilla'
Fedora/RHEL/Centos releases.

)

Your vm will boot the most recently installed kernel without your having
to update the xml spec in the host.

Hope this helps!

Harry Coin










More information about the Virtio-fs mailing list