Emergency Boot - Including for Dual-Boot
For General Users
Boot Only Rescue CD
The following CD can often succeed in booting a system which is failing to start from hard disk drive
- rEFInd
- Supergrub2
Either can boot most operating systems, including Linux, MacOSX and Windows
Try rEFInd for systems manufactured from early 2011 onwards. If it does not start on your computer then try Supergrub 2 Older computers are likely to require Supergrub 2
- Either CD is downloadable, at no cost, as a dotISO file.
- Use the following procedure to burn that file to a bootable CD
- Then insert the CD in the faulty computer and reboot
- enter Setup and move CDROM above HDD in the boot order, if necessary
- save changes and exit Setup
- after the CD boots menu items can be selected only via arrow keys - mouse does not work at this stage of boot
- rEFInd should find all bootable operating systems and present an icon that is readily associated with each eg penguin, apple, flying windows
- highlight the required one and press enter
- Supergrub requires an additional step
- select the first menu line and press Enter
- it should then identify all bootable operating systems, by name
- highlight the required one and press enter
- rEFInd should find all bootable operating systems and present an icon that is readily associated with each eg penguin, apple, flying windows
Systems that don't boot via the above procedures can often still be recovered, but it gets technical. As described below
Getting Technical
GRUB (aka GRUB 2 )
GRUB 2 is now the most frequently used bootloader in Linux, but has many remaining issues. Some work-arounds:
"on-the-fly" Mode
GRUB 2 relies on a pre-defined config file /boot/grub(2)/grub.cfg. If this is not located, for any reason, GRUB 2 may boot to a grub> prompt. To boot from here use the following commands, substituting relevant drive and partition numbers:
grub> set root='hd0,gpt10' grub> linux /boot/vmlinuz root=/dev/sda10 grub> initrd /boot/initrd grub> boot
- Notes
- drive numbers start from 0
- must specify whether partitioned mbr or gpt
- set root refers to location of partition containing /boot for the operating system to be booted
- which will often also be the root file system for Linux
- or merely the system partition for Win
- partition numbers start from 1 (unlike in GRUB legacy)
- this procedure is easiest if kernel & initrd have easily remembered names
- either soft-link generic names or
- press TAB to see possible names
- ctrl-x or F10 may be pressed in lieu the "boot" command
The above procedure may be modified to cater for the situation where the menu is presented but the desired OS is not included or fails to boot. either
- press e to edit a menu item or
- press Esc to get to command line, then proceed as above.
Menu mode
See GRUB 2 downloadable manual or use "info grub2" to obtain details. Consistent themes amongst various documentation for GRUB 2 are that:
- it is unreliable beyond the basics
- OS-probe module is particularly so
- not putting bootstrap in MBR (protective MBR in case of GPT) will be problematic
Indeed, "info grub2" recommends avoid all automated installs & configs by distro. Instead, manually grub2-install then write a simple, static /boot/grub2/grub.cfg. See below for outline of this procedure.
As of Jan 2014 and following application of two patches to GRUB in openSUSE 13.1, its GRUB has been brought to ver 2.00-39.4.1. The automated process works well enough for most Linux plus Windows
It fails to find ArchLinux - which uses unusual names for kernels & initrd. Simple work-around for that is to add a 90_persistent section at the end of /boot/grub2/grub.cfg
### BEGIN /etc/grub.d/90_persistent ### menuentry 'ArchLinux (<your descriptor>) { set root='hd<n>,gpt<n>' linux /boot/vmlinux-linux root=/dev/sd<x><n> initrd /boot/initramfs-linux.img } ### END /etc/grub.d/90_persistent ###
Then manually run
#grub2-mkconfig
Essentially, the 90_persistent section gets copied verbatim during any subsequent manual or automated run of grub2-mkconfig. Note that this feature might be unique to openSUSE
- The curly braces are essential and enclose GRUB2 commands.
- This was for a HDD partitioned GPT. replace partition number with mbr<n> if applicable.
- Multiple menuentries could be put in 90_persistent to cope with multiple Linuxes.
Strictly for Geeks
Manual Install
Distro run many scripts to provide GUI interface to bootloader configuration. If these are failing either initially or following kernel updates, then the most reliable process is a manually installed and configured GRUB 2. Details will differ between distro.
For openSUSE:
- this procedure initially removes all bootloaders, including that for Windows Proceed only if means of recovery are to hand
- copy the existing boot menu file /boot/grub2/grub.cfg to a different location eg in /root
- Yast2->System->Bootloader
- set bootloader type to "do not install any bootloader"
- accept all the warnings
- press OK to complete
- set bootloader type to "do not install any bootloader"
- from root's command prompt:
- # grub2-install /dev/sd(x)
- Notes
- installation to a second HDD eg /dev/sdb, would avoid overwriting bootloader on /dev/sda
- default location of boot code will become /boot/grub2 on the currently booted system
- generally suitable but see info grub2 to change location.
- Write a static /boot/grub2/grub.cfg consisting solely of multiple menuentries. Each menuentry has the syntax between the ### BEGIN /etc/grub.d/90_persistent ### ### END /etc/grub.d/90_persistent ### section markers in Menu Mode above
Such basic menu works well enough. GRUB2 autoloads most of the modules it needs.
If you get a manual menuentry wrong then on-the-fly editing is available as in Menu Mode
- press 'e' to edit an entry.
--Rod --