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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. pactl: command not found
  2. kpartx Command Examples in Linux
  3. How to exclude a file/directory from auditd rules
  4. CentOS / RHEL 7 : How to boot into Rescue Mode or Emergency Mode
  5. mt: command not found
  6. Change default kernel (boot with old kernel) – CentOS/RHEL/OEL 7
  7. sysctl Command Examples in Linux
  8. How to Restart Network Services in CentOS/RHEL 8
  9. a2dismod Command Examples in Linux
  10. CentOS / RHEL : How to setup session idle timeout (inactivity timeout) for ssh auto logout

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright