preload virtio kernel at boot

A 5 star hangout for overworked and underpaid system admins.
Post Reply
admin8000
Posts: 1
Joined: 2019/10/31 08:35:55

preload virtio kernel at boot

Post by admin8000 » 2019/10/31 09:44:52

hello forum,
i am new to this forum, at first.

i got to ask here, cause my problem is CentOS 5 related, but touches maybe also centos 6,7,8...
i created a virtual machine in KVM / Qemu and rsynced an old CentOS 5 Physical Server to it.
With a lot fiddeling around i "re-installed" grub and after some strong headache i foud out to what i have to modify /boot/grub/device.map
and /etc/mtab. At the end the MBR was written and Grub re-installed.

i also did an "virtio.modules" text file in /etc/sysconfig/modules/ and set chmod +x to this file
the content:

#!/bin/sh
modprobe virtio
modprobe virtio_net

On first tries, machine booted but ends with kernel panic cant find /proc /dev /sys , missing fstab.sys and so on.

I then re-created the initramfs with mkinitrd ... ... --preload=virtio --with=virtio --with=virtio_net --without-dmraid <initramfs> <kernel>

i used --without-dmraid cause the origin physical server was on raid-1.
i rebooted the virtual machine then and kernel panic again.

I then set the disk in the virtual machine instead of "virtio" to "sata" and VOILA !! the machine boots.

My question now is, how can i load the virtio kernel modules at boottime, to start the virtual machine with "vitio" settings?
Is it possible to start the virtual machine with disk in "virtio" ?
On the origin physical server it works when i do "# modprobe virtio & # modprobe virtio_net".... so it should work i guessed.
But i think building the initramfs with --preload=virtio does not what i guessed it shall do..... am i right?

So how do i build a new initramfs with the virtio kernel modules in it , that they can be accessed at boot time?
Anyone here had / have the knowledge about that?

thanks for any ideas / sollutions

kind regards
marko aka admin8000

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: preload virtio kernel at boot

Post by TrevorH » 2019/10/31 15:43:18

You need ALL of the virtio modules that are needed, some of them depend on others that you have not told it about. Try modinfo on each and it lists the dependencies there, add those, repeat.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply