I am trying to puzzle out a linux boot configuration problem involving legacy grub (0.97), LVM2, and dracut and trying to eliminate a few red herrings.

My trial and error process goes like so:

  1. Modify grub.conf
  2. Install grub.conf into MBR via grub shell
  3. Reboot
  4. Kernel panic

In the interests of removing #4, am I missing a step in which I need to update the initramfs image?

What does the initramfs image contain that might pertain to which filesystems are mounted during boot?

I am trying to figure out how to script wholesale upgrades of running systems with minimal downtime by placing a new OS on a spare LVM partition, and then modifying grub.conf/menu.lst to boot from the spare partition.

The OS is based on CentOS 6, and we use the Anaconda installer - for some reason, Anaconda creates a /boot/grub/grub.conf file and symlinks it to /boot/grub/menu.lst.

  • 1
    Is upgrading to GRUB2 an option? – Andrew Oct 23 '13 at 23:58

You mention grub.conf, and Grub 0.97. Grub 0.97 doesn't use grub.conf. It uses menu.lst. It somewhat sounds like you have both binaries installed on your system and you have muddled things up a bit.

You do not have to rebuild your initramfs/initrd files when changing your grub.conf or menu.list. There is almost no relationship between the two, at least not on any distro I have seen.

The grub files have to exist outside the initramfs since they are used before the ramdisk is ever loaded. Grub calls the kernel and points it at the location of the ramdisk image. If you were adding another option to your grub menu to boot another OS for example you would not have to do anything to your initramfs.

If you do change something about how your system is booted, then you might need to make changes to both your grub configuration, and other configurations as well, which might require you to update your initramfs. So, you might need to update both, but you don't need to update initramfs because you update grub, or the other way around.

  • I clarified the original comment - no, it is just grub 0.97. For some reason the CentOS 6 Anaconda installer which we use to install our OS does some weird symlinking of /boot/grub/grub.conf to /boot/grub/menu.lst. It has been a while since I've dealt with grub stuff so I forgot that that may be confusing. – javanix Oct 24 '13 at 14:14

There has to be a boot partition, which holds

  • grub.conf,
  • the kernel to be loaded,
  • the initramfs image,
  • some grub components (normally installed into /boot/grub).

This boot partition has to be readable by grub, so it cannot be within LVM. It is a good practice to create a separate, small primary partition at the front of the boot disk (I usually use 100MB for this, normally mounted as /boot).

What is present in initramfs, and how it gets configured, depends on your implementation. Usually, your Linux distro contains its specific initramfs implementation (so it all depends on what distro you use).

The initramfs has to be able to mount the root filesystem, and for that, it'll need the kernel modules neccessary to reach that disk, partition & filesystem, unless they are already compiled into the kernel itself. It also needs some way to specify your choice of root filesystem, and the mount options to be used. Some implementations have to update the initramfs image when changing some settings, choosing a different root filesystem, or using different mount options. However, it is possible to write an initramfs implementation which does not need any update, except when changing/upgrading/recompiling the kernel & the modules, by reading the neccessary parameters from the kernel command line. So to know how exactly your initramfs implementation works, you either have to read the script inside, or read the documentation specific to your distro.

  • Thanks, this is some very good information about the process. – javanix Oct 24 '13 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.