Restoring bootloaders

Finnix, the LiveCD for system administrators
Revision as of 23:00, 19 January 2013 by Ryan Finnie (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

If you need to restore a bootloader for a system (for example, after copying a backup to a new hard drive), Finnix includes the following bootloaders:

  • LILO
  • syslinux

Notably absent from this list is GNU GRUB, the most popular bootloader. This is done for two reasons:

  • Currently, modern systems use either GRUB 1 (legacy) or GRUB 2. The userland tools for these two versions are not compatible with each other, so Finnix would have to choose which one to ship.
  • GRUB's configuration layout between distributions is complex enough that you should really be installing the bootloader from within your system's own environment, not Finnix's.

It is recommended you set up and chroot into your destination system's filesystem, and use its native bootloader tools to install the bootloader. For example:

finnix# mkdir /mnt/dest
finnix# mount /dev/sda3 /mnt/dest # root filesystem example
finnix# mount /dev/sda1 /mnt/dest/boot # boot partition example
finnix# mount -t proc none /mnt/dest/proc
finnix# mount -t sysfs none /mnt/dest/sys
finnix# mount --bind /dev /mnt/dest/dev
finnix# chroot /mnt/dest
(chroot)# cat /proc/mounts >/etc/mtab
(chroot)# editor /etc/mtab
# Delete all top lines, up to the first device you mounted.

At this point, you can use your distribution's management system to install the bootloader. For example, on Debian-based systems, it is:

(chroot)# update-grub

If you still want to use GRUB 1 or 2 directly in Finnix, you can download it. Run "apt-get update" to populate the apt database, then apt-get install either grub-legacy (GRUB 1) or grub-pc (GRUB 2).