AlpineLinux: Adjusting Xen VM to run on KVM

Pre-Migration Changes

Adjust the following items to ensure a successful update.

Kernel Modules

You need to load additional kernel modules at boot:

virtio,virtio_blk

Add them to /etc/update-extlinux.conf

# modules
# modules which should be loaded before pivot_root
modules=sd-mod,usb-storage,ext4,virtio,virtio_blk

Regenerate your initrd

# update-extlinux -v
Updating extlinux configuration.
Found kernel: /boot/vmlinuz-grsec
Found initramfs: /boot/initramfs-grsec
1 entries found.
Installing libutil.c32 libcom32.c32 mboot.c32 menu.c32 vesamenu.c32 to /boot.
/boot is device /dev/vda1

(The boot device can still show your old one, that's not a problem)

Disable the Xen console in inittab

# enable login on alternative console
#hvc0::respawn:/sbin/getty  38400 hvc0

Check that acpid is enabled

# rc-update
                acpid |      default
   	         bootmisc | boot
              chronyd |      default

Check your /etc/fstab

At the least change your disk paths from xvdN to vdN (Xen Blockfront to VirtIO Block).

If you're a big smarter, change them to mount using LABEL or UUID. That way you need almost no changes to migrate between different hypervisors.

 

When it's just too late

If you need to do this on a VM that was already migrated and doesn't boot, see how to get your root mounted in single user mode:

https://bugs.alpinelinux.org/issues/5332

You'll also need to add the virtio modules to your command line (like the others there, you'll see it)