Monday, November 14, 2011

Recovering after forgetting to create initramfs after updating the kernel

I just updated the kernel on my Fedora 14 system to the latest Linux-libre (3.1.1-libre) from http://www.fsfla.org/svnwiki/selibre/linux-libre/. After building the kernel into rpm files, I installed the rpms and forgot to run mkinitrd to generate an initramfs file. This would be fine if I had another kernel to boot from, but I didn't (I removed all old kernels and left only my previously custom-built kernel, and then I used the U (update) flag when I installed 3.1.1-libre.

When I rebooted I got the "Error 15: File not found" grub message.

Here's how I recovered from my mistake (terminal commands are in parentheses):

  1. Booted from LiveCD. I used the Fedora 16 LiveCD, but any LiveCD distribution should work.
  2. Mounted my Fedora 14 system's boot partition using nautilus.
  3. Mounted my Fedora 14 system's root partition using nautilus.
  4. In the terminal, I ran df -Th and determined that the boot partition was mounted as /media/[big long string], and the root partition was mounted as /media/Fedora-14
  5. Opened a terminal.
  6. Changed to super user (su)
  7. Went to root directory (cd /
  8. Moved/renamed the boot directory to something else (mv boot booty). I'm actually not sure if steps 8 and 9 are necessary, but I did it, so I'm noting it here.
  9. Created a symbolic link from /boot to the partition that I mounted in step 5 (ln -s /media/[big long string] /boot)
  10. Created a symbolic link from /lib/modules/3.1.1-libre to /media/Fedora-14/lib/modules/3.1.1-libre (ln -s /media/Fedora-14/lib/modules/3.1.1-libre /lib/modules/3.1.1-libre)
  11. Entered the /boot directory (cd /boot).
  12. Ran mkinitrd to make the initramfs file for kernel version 3.1.1-libre (mkinitrd initramfs-3.1.1-libre.img 3.1.1-libre). There were complaints about an inability to copy a bunch of module files to /var/tmp, but this is okay.
  13. Edit the grub.conf file so that it has an entry for the new kernel. Here's what the entry looks like.

    title Fedora (3.1.1-libre)
            root (hd0,0)
            kernel /vmlinuz-3.1.1-libre ro root=UUID=blah-blah-blah ... rhgb quiet
            initrd /initramfs-3.1.1-libre.img
    

No comments:

Post a Comment