In my last post I described the steps I took to migrate a qcow2 based image from KVM to VMWare but I ran into an issue with Fedora. My issue was that the initramfs didn't contain the necessary drivers for the emulated hardware and as such the VM refused to boot except into emergency mode.

It took me a while to figure this one out because I can't read. Boot from an ISO and enter a chroot environment with the following commands from a terminal as root.

mkdir /mnt/sysimage
mount /dev/mapper/fedora-root /mnt/sysimage
mount /dev/sda1 /mnt/sysimage/boot

mount -o bind /dev /mnt/sysimage/dev
mount -o bind /proc /mnt/sysimage/proc
mount -o bind /sys /mnt/sysimage/sys
mount -o bind /run /mnt/sysimage/run

chroot /mnt/sysimage

Now you're inside a chroot and can execute commands as if you're booted into the system (well, close enough for our purposes here).

List the contents of /boot and then take note of your initramfs kernel version and run the following

mkinitrd -v -f /boot/initramfs-5.2.11-100.fc29.x86_64.img 5.2.11-100.fc29.x86_64

This should now build an initramfs with the kernel drivers required for the VM to boot successfully on the VMWare stack. Bear in mind because the live ISO we're booted from is probably running a different kernel to your installation you almost certainly will need to explicitly define the kernel to build for else mkinitrd will assume you mean the running kernel version. This is probably not what you want.

Some links on the internet will have you rebuilding grub2 too but I didn't find that to be required after the initramfs was fixed, but you can use these steps to fix grub problems as well which is quite handy!

Useful links: