Dracut

From Dikapedia
Jump to: navigation, search

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


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`