Dracut

From DikapediaV2
Revision as of 14:49, 21 August 2024 by Ardika Sulistija (talk | contribs) (Created page with "In Red Hat Enterprise Linux (RHEL), dracut typically runs automatically when you install a new kernel. During the kernel installation process, dracut is invoked to create a new initial RAM filesystem (initramfs) image. This initramfs image is necessary for the system to boot with the new kernel, as it contains the drivers and modules required to mount the root filesystem and start the boot process. The new initramfs image is usually placed in the /boot directory alongsi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In Red Hat Enterprise Linux (RHEL), dracut typically runs automatically when you install a new kernel. During the kernel installation process, dracut is invoked to create a new initial RAM filesystem (initramfs) image. This initramfs image is necessary for the system to boot with the new kernel, as it contains the drivers and modules required to mount the root filesystem and start the boot process.

The new initramfs image is usually placed in the /boot directory alongside the new kernel. This process ensures that your system has the necessary components to boot properly with the newly installed kernel.

Based on the man pages of 'dracut': "if <kernel version> is omitted, then the version of the actual running kernel is used. If <image> is omitted or empty, then the default location /boot/initramfs-<kernel version>.img is used."

i.e.

$ dracut -f -v

or

$ dracut -f -v /boot/initrd-[kernel-version]-default.img [kernel-version]-default
$ dracut -f -v /boot/initrd-4.12.14-95.51-default.img 4.12.14-95.51-default


https://access.redhat.com/solutions/1958


When is it necessary to rebuild the initramfs?


https://access.redhat.com/solutions/453703


How to rebuild initramfs using rescue instance and chroot


This is how you can rebuild initramfs and add drivers why using a rescue instance, utilizing chroot. This adds the drivers needed to run on EC2, and vmware scsi drivers to boot in vmware/vcenter.

  • Rescue instance: AL2
  • Fixing initramfs for: RHEL7
mount --bind /dev/ ./dev
mount --bind /sys/ ./sys
mount --bind /proc/ ./proc

chroot . /usr/bin/dracut -v --force --add-drivers "xen-blkfront xen-netfront ext4 ena nvme nvme_core vmw_pvscsi virtio_scsi" ./boot/initramfs-3.10.0-957.el7.x86_64.img 3.10.0-957.el7.x86_64 1>&2

chroot . /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg

lsinitrd ./boot/initramfs-3.10.0-957.el7.x86_64.img | egrep -i 'vmw_pvscsi|virtio_scsi'

umount ./dev
umount ./sys
umount ./proc


How to add drivers for SUSE11SP4, SUSE12 SUSE12SP1


mkinitrd -f -v -m "xen-balloon xen-vbd xen-platform-pci xen-vnif xen-scsi" -k vmlinuz-`uname -r` -i /var/lib/aws-replication-agent/aws-launch-initrd-`uname -r`