Jump to content

How do I update initrd to include additional drivers?


Go to solution Solved by Andrey Kirzhemanov,

Recommended Posts

Posted

I have Kaspersky working via PXE for most physical hosts but KVM virtual guests show the following error:

 

Text of the error:

No ethernet interfaces found on your system, PXE boot won't work.

Cannot get a DHCP address. Check the cables on the ethernet interfaces.

 

I can temporarily set the KVM virtual guest to use an emulated Intel e1000 network card, perform PXE, get to the desktop and then hot unplug the Intel e1000 and replace it with a paravirtualised VirtIO ethernet interface.

 

I can also boot off the ISO and networking simply works. The output of ‘lsmod | grep ^virtio’ shows the following:
  virtio_net
  virtio_scsi
  virtio_console
  virtio_balloon
  virtio_pci
  virtio_ring
  virtio
 

I'm pretty sure this is simply due to virtio_net and virtio_pci not both having been included in the compressed kernel image.

 

How do I check and rebuild the initrd image to include additional drivers?


 

Regards
David Herselman

  • Solution
Andrey Kirzhemanov
Posted

Hi, @bbs2web !

How do I check and rebuild the initrd image to include additional drivers?

 

You can rebuild or create new additional initrd file (kernel will merge all initrd files into one filesystem). Step are similar (use only Linux, on Windows result archive will be broken):

   1. Copy current initrd.xz into /tmp (only for rebuilding) and run following command in terminal as root:

cd /tmp
mkdir initrd
cd ./initrd

For rebuilding extract existing initrd:

xz -d -c -k ../initrd.xz | cpio -i

   2. Copy drivers into /tmp/initrd/lib/modules/%kernel%/kernel folder

   3. Create new initrd:

find . | cpio -H newc -o | xz --check=crc32 --x86 --lzma2 > ../initrd1.xz

Now you can use /tmp/initrd1.xz for loading KRD. If it’s additional initrd then you’ll need to add it into kernel boot parameters:

For pxelinux/syslinux:

INITRD %some path%/krd/boot/grub/initrd.xz,%some path%/krd/boot/grub/initrd1.xz

For grub:

initrd %some path%/krd/boot/grub/initrd.xz %some path%/krd/boot/grub/initrd1.xz

For iPXE:

initrd %some path%/krd/boot/grub/initrd.xz
initrd %some path%/krd/boot/grub/initrd1.xz

P.S. I can make all virtio drivers builtin in next KRD patch.

Posted

Hi Andrey,

 

This was perfect, managed to rebuild the initrd.xz file to include additional drivers by booting a VM using the ISO and then replacing the initrd.xz file on our TFTP server with the /tmp/initrd.xz file.

mkdir /tmp/initrd && cd /tmp/initrd;
xz -d -c -k /livemnt/boot/boot/grub/initrd.xz | cpio -i;
for f in aufs aufs-x86_64; do
cd /tmp/initrd/lib/modules/4.9.57-$f/kernel/drivers;
mkdir block;
cp -a /lib/modules/4.9.57-$f/kernel/drivers/virtio .;
cp -a /lib/modules/4.9.57-$f/kernel/drivers/block/virtio_blk.ko block;
cp -a /lib/modules/4.9.57-$f/kernel/drivers/block/cciss.ko block;
cp -a /lib/modules/4.9.57-$f/kernel/drivers/scsi .;
done
cd /tmp/initrd;
find . | cpio -H newc -o | xz --check=crc32 --x86 --lzma2 > /tmp/initrd.xz;

 

Would be great if the Rescue disk could be amended to include virtio_blk.ko (VirtIO block device) and virtio_pci.ko (needed by the newer virtio_scsi.ko (VirtIO SCSI block device) driver which itself is already included).

ie: Please include as a minimum:
  virtio_pci.ko & virtio_scsi.ko
  virtio_blk.ko

 

PS: For anyone looking for TFTP instructions, they are here: https://support.kaspersky.com/15271

 


Regards
David Herselman

Posted

Just to clarify our problem with PXE booting Kaspersky in a KVM environment. Whilst ‘virtio_net.ko’ is already included it, as with virtio_scsi.ko, requires the ‘virtio_pci.ko’ kernel module.

Andrey Kirzhemanov
Posted

Just to clarify our problem with PXE booting Kaspersky in a KVM environment. Whilst ‘virtio_net.ko’ is already included it, as with virtio_scsi.ko, requires the ‘virtio_pci.ko’ kernel module.

Thank you for report! I’ll add this drivers in next KRD patch.

P.S. We didn’t testing this scenario - PXE booting in a KVM environment. Only VmWare and real hardware.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now


×
×
  • Create New...