This post describes a problem with receiving Linux kernel updates after installing Fedora 16 in a dual boot environment. The Fedora installation process allows the user to rewrite Grub in the master boot record (MBR) or to leave the MBR untouched. I chose to leave it untouched, leading to a later kernel update problem which was fairly easily solved with some Grub 2 commands.
After installing Fedora 16 into partition /dev/sda5 (while leaving an installation of Fedora 14 intact in /dev/sda8), I noticed that regular OS updates with yum would not upgrade the kernel, printing an error about not updating a boot menu file because the expected directory structure did not exist. New kernels were actually installed but not added to the boot choices and never booted into.
MBR Points to One Partition which Points to Another
This was because Grub stage 1 in the boot sector still pointed to grub stage 2 under Fedora 14 on dev/sda8. When installing Fedora 16 I chose not to let it update the boot sector, and instead manually edited menu.lst under /dev/sda8, adding an entry pointing to the new Fedora 16 installation on /dev/sda5. The boot sequence for Fedora 16 was therefore somewhat convoluted:
MBR -> /dev/sda8:/boot/grub/menu.lst -> /dev/sda5:/boot
In the past, in the days of Grub 1, I have run with this slightly lazy arrangement without a problem. But Fedora 16 uses Grub 2. Grub 2, or rather, the mixture of Grub 1 and Grub 2 now on the system, doesn’t seem to like it.
Proper Grub 2 Configuration
To fix the problem and allow automatic future kernel updates, I decided to modify Grub stage 1 in the master boot record to point directly to the desired OS on /dev/sda5, skipping the reference to, and dependency on, /dev/sda8.
Booted into Fedora 16 on /dev/sda5 and proceeded as follows:
# yum install os-prober
# grub2-mkconfig -o /boot/grub2/grub.cfg
This probed all partitions and populated the Grub 2 menu configuration file /boot/grub2/grub.cfg on /dev/sda5, which previously had been empty, with appropriate entries.
The following command updated the Grub version in the MBR and configured it to point directly to Fedora 16 on /dev/sda5:
# grub2-install --boot-directory=/boot /dev/sda
…which took a few seconds to complete. A reboot then brought up a Grub 2 menu including all installed operating systems and partitions (probed for above) and Fedora 16 booted properly, using the latest kernel this time.
More information can be found on this Fedora 16 Grub Configuration page, from which all of the above commands were taken.
The Way We Were
In the days of Grub 1, it might have been done like this (for reference only):
1. Boot to the grub prompt or use a Grub floppy/CD.
2. Type “root (hd0,4)” (== /dev/sda5)
3. Type “setup (hd0)”.
4. Quit grub by typing “quit”.
5. Reboot.