• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Re-generate initramfs and vmlinuz for Rescue Kernel with Current Kernel in CentOS/RHEL 7

By admin

We want to re-generate initramfs and vmlinuz for the Rescue Kernel in our CentOS/RHEL 7 system. How can this be done using the current kernel from which the system is booted up?

During the boot process, when the kernel image and initramfs image get loaded, initramfs starts the first process on the system, which is systemd with the process ID 1. This systemd process further takes over control in the final stages of system booting and performs the following operations:

  • Reads the configuration files from the /etc/systemd/ directory
  • Reads the files linked by /etc/systemd/system/default.target
  • Executes the /etc/rc.local file

Follow the steps below to re-generate the initramfs and vmlinuz for the Rescue Kernel from the current kernel.

1. Review the existing files for the rescue kernel:

# cd /boot
# ll | grep rescue
-rw-------. 1 root root 72166662 Apr 6 21:37 initramfs-0-rescue-a0eaa652c599455aa125077a4167f435.img    <<----Apr 6
-rwxr-xr-x. 1 root root 5925632 Apr 6 21:37 vmlinuz-0-rescue-a0eaa652c599455aa125077a4167f435           <<----Apr 6

2. Move the existing files to a different directory (for example ‘/tmp’):

# mv initramfs-0-rescue-a0eaa652c599455aa125077a4167f435.img  /tmp/initramfs-0-rescue-a0eaa652c599455aa125077a4167f435.img.bk
# mv vmlinuz-0-rescue-a0eaa652c599455aa125077a4167f435  /tmp/vmlinuz-0-rescue-a0eaa652c599455aa125077a4167f435.bk

Verify that there are no files present for the rescue kernel in the /boot directory:

# ll | grep rescue
#

3. Regenerate the new initramfs & vmlinuz for the rescue kernel with current kernel.

# /etc/kernel/postinst.d/51-dracut-rescue-postinst.sh  $(uname -r) /boot/vmlinuz-$(uname -r)

Verify

After the above command finishes, the two new files for the rescue kernel should be shown as below:

# ll | grep rescue
-rw-------. 1 root root 72164785 May 4 00:18 initramfs-0-rescue-a0eaa652c599455aa125077a4167f435.img    <<----May 4
-rwxr-xr-x. 1 root root 5925632 May 4 00:18 vmlinuz-0-rescue-a0eaa652c599455aa125077a4167f435           <<----May 4

Filed Under: CentOS/RHEL 7, Linux

Some more articles you might also be interested in …

  1. How to modify the iSCSI initiator ID in Linux
  2. How to Add a 3rd Disk to Create a 3-way Mirror RAID1 MD Device (CentOS/RHEL 7)
  3. Linux OS Service ‘avahi-daemon’
  4. How to Disable NUMA in CentOS / RHEL 6,7
  5. CentOS / RHEL 5 : How to disable device mapper multipath (dm-multipath)
  6. Anonymous User Fails to Upload File to VSFTP Server
  7. Understanding mpathconf Utility to configure DM-Multipath
  8. Unix file basics : Inode, Soft Vs Hard link, Device files, Named pipes
  9. CentOS / RHEL : How to Change the login shell of the user
  10. Linux OS Service ‘nscd’

You May Also Like

Primary Sidebar

Recent Posts

  • How to set the default character set in MySQL and how to propagate it in a master-master replication scenario
  • “Connection reset by peer” – error while ssh into a CentOS/RHEL system with a specific user only
  • MySQL: how to figure out which session holds which table level or global read locks
  • Recommended Configuration of the MySQL Performance Schema
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary