Updated on 2026-01-31 GMT+08:00

Modifying the Hardware Device Drivers That Boot the OS

Scenario

This section describes how to modify the hardware device drivers that are loaded during OS startup.

Prerequisites

You have logged in to the VM.

Procedure

  1. Add or modify the configuration file.
    For Ubuntu 16.04/Ubuntu 18.04, add drivers to the /etc/dracut.conf and /etc/initramfs-tools/modules files. Before editing the files, install required software.
    1. Run the following command to install dracut:

      apt-get install dracut

      After the installation is complete, add add_drivers+="ahci megaraid_sas mpt3sas mpt2sas virtio_blk virtio_scsi virtio_net" to the end of the /etc/dracut.conf file by performing operations similar to those for Red Hat and Oracle Linux 7.3.

      If an error is reported, add a space before and after the driver list in the quotation marks and try again.

    2. Run the following command to install initramfs-tools:

      apt-get install initramfs-tools

      After the installation is complete, add the ahci, megaraid_sas, mpt3sas, mpt2sas, and virtio_blk virtio_scsi virtio_net drivers to the end of the /etc/initramfs-tools/modules file by performing operations similar to those for Ubuntu 14.04.

    You can enter multiple RAID drivers and separate them with spaces. The RAID driver names can be obtained from the purchased hardware devices. Multiple types of drivers can be added at the same time, such as mpt3sas, mpt2sas, and megaraid_sas. If any hardware driver cannot be installed here, you can install it after the BMS is created.

  2. Update the OS kernel.

    For Ubuntu, run the following command to regenerate initrd:

    update-initramfs -u

    Run the following commands to check whether the ahci, megaraid_sas, and mpt3sas drivers have been loaded:

    lsinitramfs /boot/initrd.img-`uname -r` |grep ahci

    lsinitramfs /boot/initrd.img-`uname -r` |grep megaraid_sas

    lsinitramfs /boot/initrd.img-`uname -r` |grep mpt3sas

  3. For Ubuntu, modify the grub, fstab, and interfaces files.
    1. Modify parameters in the /etc/default/grub configuration file.

      Set GRUB_DISABLE_LINUX_UUID to true.

      ...
      # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to linux
      GRUB_DISABLE_LINUX_UUID=true
      
      # Uncomment to disable generation of recovery mode menu entries
      ...

      Then, run the sudo update-grub2 command.

    2. Delete all interface information except lo interface from the /etc/network/interfaces file.
      # This file describes the network interfaces available on your system
      # and how to activate them. For more information, see interfaces (5).
      
      source /etc/network/interfaces.d/*
      
      # The loopback network interface
      auto lo
      iface to inet loopback
      
      ~
      ~