You are here

recovering /boot

it came about that i lost my /boot directory on my workpc (rm -rf /boot) and while it is definetly not an experience one would like to reproduce, i did learn a couple of things on how to recover /boot

first of all, thanks to thomasj, Southern_Gentlem et al of #fedora on for their help. and now we begin.

ensure that your boot partition is mounted on /boot. if the installation used the default setting then the command would be

  mount /dev/sda1 /boot

actually getting to the point that you are capable of doing the above command is outside the scope of this little note. however, i will give a hint: rescue mode

next, you want to download the attached grub.conf and save it to /boot/grub/grub.conf. also part of this step is to create a link from grub.conf to menu.lst in that directory with the following command

  ln -s /boot/grub/grub.conf /boot/grub/menu.lst

next, you want to download and install the following packages

  1. kernel
  2. grub
  3. fedora-logos

personally, i discovered a site i like: coz it has a search function on the page
the command would be similar to

rpm -ivh --force kernel*rpm grub*rpm fedora-logos*rpm

well thats basically it except for the explanation of what's happening. i believe everything is straight forward. you want to mount your boot partition coz thats your boot partition otherwise everything else wouldn't make sense and you would be working on the mount point on your root partition instead.

then you want to use the attached grub.conf coz well, grub is finicky, an extra space in the wrong spot can screw things up to the extent that you don't boot. plus, its a helpful example for you if you have to recreate your grub.conf from scratch.

the link is coz grub actually uses menu.lst and not grub.conf. i believe the link is just to make it logical for us humans to follow. on a side note, there should also be a previous dead link from /etc/grub.conf to /boot/grub/grub.conf that will become active once you begin fixing the /boot directory.

and finally, the rpms. you need the kernel coz you need something to boot with. the kernel (vmlinuz) and initrd file will go into the /boot directory automatically. the grub rpm will recreate /boot/grub directory but without the grub.conf file and fedora-logos will add your splash.xpm.gz file to /boot/grub directory.

note that if you dont follow the above order when you do an install of the kernel it will fail with the message:
    "grubby fatal error: unable to find a suitable template"
the error basically means that your grub.conf file is messed up in some way. either it doesnt exist or you have a major mistake in there that is preventing grubby from copying a good stanza and modifying it to reflect the newly installed kernel's version et al.

and finally, for completeness, grubby is a helper program called in an rpm post install script that creates the stanzas in grub.conf. if you read this to the end, i seriously hope that you were able to recover and boot your system.