Sun Microsystems, Inc.  Oracle System Handbook - ISO 7.0 May 2018 Internal/Partner Edition
   Home | Current Systems | Former STK Products | EOL Systems | Components | General Info | Search | Feedback

Asset ID: 1-71-1573625.1
Update Date:2018-03-01
Keywords:

Solution Type  Technical Instruction Sure

Solution  1573625.1 :   How to Rebuild the Initial Ramdisk Image in Oracle Linux 5 or Oracle Linux 6?  


Related Items
  • Exalogic Elastic Cloud X4-2 Hardware
  •  
  • Linux OS
  •  
Related Categories
  • PLA-Support>Infrastructure>Operating Systems and Virtualization>Operating Systems>Oracle Linux
  •  




In this Document
Goal
Solution
 Rebuilding the initrd (Oracle Linux 5)
 Rebuilding the initramfs (Oracle Linux 6)
 Working with Backups (All Oracle Linux Versions)
References


Applies to:

Linux OS - Version Oracle Linux 5.0 to Oracle Linux 6.4 with Unbreakable Enterprise Kernel [2.6.39] [Release OL5 to OL6U4]
Exalogic Elastic Cloud X4-2 Hardware
Linux x86
Linux x86-64

Goal

This document covers the following questions:

  •  How to rebuild the initial ramdisk image in Oracle Linux?
  •  How to remake the initrd or initramfs?
  •  How to recreate the initrd or initramfs?
  •  Modified /etc/lvm/lvm.conf and my root file system resides on a logical volume. How to ensure the changes are applied upon rebooting?
  •  Modified /etc/multipath.conf and my root file system resides on a multipath device. How to ensure the changes are applied upon rebooting?
  •  Modified some module options in /etc/modprobe.conf or /etc/modprobe.d/. How to ensure the changes are applied upon rebooting?

Solution

When adding new hardware to a system, or after changing configuration files that may be used earlier in the boot process, or when changing the options on a kernel module, it may be necessary to rebuild the initial ramdisk (also known as initrd or initramfs) to include the proper kernel modules, files, and configuration directives.

If you are adding a new module in the initrd, first follow the instructions in "How to ensure certain modules are included in the initrd or initramfs in Oracle Linux?", or if it is a configuration change then make that change now.

Once the necessary modifications have been made, it is time to rebuild the initrd/initramfs. This process differs based on the version of Oracle Linux.

In these examples you will see the usage of $(uname -r), which is a way to pass the current kernel version into a command without actually typing it out.

If you are working with a version of the kernel other than what is currently running, then replace $(uname -r) with the actual kernel version, such as 2.6.32-200.13.1.el5uek.

Rebuilding the initrd (Oracle Linux 5)

It is recommended to make a backup copy of the initrd in case the new version has an unexpected problem:

# cp /boot/initrd-$(uname -r).img /boot/initrd-$(uname -r).img.bak

Now build the initrd:

# mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r)

If you are in a kernel version different to the initrd you are building (including if you are in Rescue Mode) you must specify the full kernel version, without architecture:

# mkinitrd -f -v /boot/initrd-2.6.39-400.21.1.el5uek.img 2.6.39-400.21.1.el5uek

The -v verbose flag causes mkinitrd to display the names of all the modules it is including in the initial ramdisk.
The -f option will force an overwrite of any existing initial ramdisk image at the path you have specified

Rebuilding the initramfs (Oracle Linux 6)

It is recommended you make a backup copy of the initrd in case the new version has an unexpected problem:

# cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

Now rebuild the initramfs for the current kernel version:

# dracut -f

If you are in a kernel version different to the initrd you are building (also if you are in Rescue Mode) you must specify the full kernel version, including architecture:

# dracut -f /boot/initramfs-2.6.39-400.17.1.el6uek.x86_64.img 2.6.39-400.17.1.el6uek.x86_64

The -f option will force an overwrite of any existing initial ramdisk image at the path you have specified

Working with Backups (All Oracle Linux Versions)

As mentioned previously, it is recommended that you take a backup of the previous initrd in case something goes wrong with the new one. If desired, it is possible to create a separate entry in /boot/grub/grub.conf for the backup initial ramdisk image, to conveniently choose the old version at boot time without needing to restore the backup. This example configuration allows selection of either the new or old initial ramdisk image from the grub menu:

title Oracle Linux 5 (2.6.32-200.13.1.el5uek)
root (hd0,0)
kernel /vmlinuz-2.6.32-200.13.1.el5uek ro root=LABEL=/
initrd /initrd-2.6.32-200.13.1.el5uek.img
title Oracle Linux 5 w/ old initrd (2.6.32-200.13.1.el5uek)
root (hd0,0)
kernel /vmlinuz-2.6.32-200.13.1.el5uek ro root=LABEL=/
initrd /initrd-2.6.32-200.13.1.el5uek.img.bak

Alternatively, you can enter edit-mode in grub if you need to choose the old initrd and did not make a separate entry in grub.conf before rebooting. To do so:

  • If grub is secured with a password, press p and enter the password
  • Use the arrow keys to highlight the entry for the kernel you wish to boot
  • Press e for edit
  • Highlight the initrd line and press e again
  • Change the path for the initrd to the backup copy you made (such as /initrd-2.6.32-200.13.1.el5uek.img.bak)
  • Press Enter to temporarily save the changes you have made
  • Press b for boot

Note:

This procedure does not actually make any persistent change. At the next boot, the system will continue using the original grub.conf configuration unless it is updated.

 

References

https://fedoraproject.org/wiki/How_to_debug_Dracut_problems
http://people.redhat.com/harald/dracut.html
<NOTE:743540.1> - How to Build a New Initial Ramdisk Image

Attachments
This solution has no attachment
  Copyright © 2018 Oracle, Inc.  All rights reserved.
 Feedback