Prof. Dr. Jan Bredereke

Booting a Linux System Without a Working Bootloader

This describes how to boot a Linux system, when the bootloader (e.g., Grub2) does not yet work. I need this when I restore a backup of my system, since I create the backup with rsync. rsync saves all my files, but it cannot save the bootloader, which resides on disk outside the file system. When I have booted my normal Linux system as described below, I then run the programs of my Linux distribution to restore the bootloader to my disk.

The basic idea is to use the bootloader of a rescue system, but to boot into my system on disk instead of booting into the rescue system. This requires a rescue system using Grub which allows an exit into the Grub shell. One such rescue system is Knoppix 7.4.2. The openSUSE 13.1 installation DVD uses the bootloader Grub2, but does not provide such an exit.

Do the following steps:

  • Boot your system, but select the medium of the Knoppix system. For my system, I have to press F12 in the BIOS phase in order to be able to select the medium.
  • At the boot prompt of the Knoppix system, enter "grub".
  • This starts the Grub4DOS boot manager, a version of Grub1.
  • First, it boots straight through its menu and tries to start an openSUSE 12.2 system, which obviously must fail.
  • Press the return key to acknowledge having read this. This brings you to the Grub menu.
  • Press the "c" key to get a Grub1 command line.
    • Note that Grub1 counts the hard disks and their partitions a bit differently: "(hd0,5)" corresponds to "/dev/sda6"
    • German users: Note that we have an American keyboard layout here.
    • Note that the command line provides tab completion. This holds for file names, in particular.
    • openSUSE users: /boot/vmlinuz and /boot/initrd are symlinks to the current versions of the kernel and the initial ramdisk. Grub can use them. With other distributions, you might have to find out the right versions, which you could do by using tab completion.
  • Enter the following commands, if your system is on partition /dev/sda6:
    root (hd0,5)
    kernel /boot/vmlinuz ro
    initrd /boot/initrd
    boot
    
  • Your normal Linux system boots.

If the initrd of your normal system has become unusable, too, you could boot into a rescue system of your Linux distribution and then construct a chroot environment. But this is way more difficult to get right.