Technical

rhel initrd getting corrupted during import: fix it by regenerating with virtio

rhel initrd getting corrupted during import: fix it by regenerating with virtio

rhel initrd getting corrupted during import is almost always missing virtio drivers. The fix is to boot a rescue kernel, regenerate the initrd with dracut, and include the virtio modules. Takes five minutes.

Detailed black and white close-up of an audio mixer highlighting various control knobs and switches.

Why it happens

When you import a RHEL VM into Proxmox, the disk controller changes from whatever the original hypervisor used to virtio-scsi or virtio-blk. If the initrd doesn’t have the virtio drivers baked in, the kernel can’t find the root filesystem and the boot fails. The error looks like a corrupted initrd, but it’s usually just missing modules.

The fix

Boot the VM from a RHEL rescue image. Mount the root filesystem, chroot into it, and regenerate the initrd with dracut. The key is to include the virtio drivers explicitly.

mount /dev/sda1 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
dracut --force --add-drivers "virtio_blk virtio_scsi virtio_pci" /boot/initramfs-$(uname -r).img $(uname -r)

If you’re not sure which drivers you need, include the whole virtio family. It doesn’t hurt.

After that, exit the chroot, unmount, and reboot the VM. It should come up normally.

Luxurious wine cellar featuring neatly arranged bottles on wooden shelves, exuding elegance and sophistication.

If it still doesn’t boot

Check the boot log for missing modules. Sometimes the issue is that the initrd was built for a different kernel version. Make sure you run dracut with the kernel that’s actually installed, not the rescue kernel.

Also, if you’re using UEFI, make sure the boot entry points to the right initrd. The Proxmox import might have messed up the boot order.

If you’re dealing with other Proxmox import headaches, check out Fix Proxmox Remote Migration with Shared Storage Not Working.

My take

This is a pain in the butt, but it’s a one-time fix. Once you regenerate the initrd with virtio, it stays fixed. No need to reinstall the whole VM.

Leave a comment

Comments are reviewed before they appear. Your email is never published.