SDB:Rescue system on disk
Tested on openSUSE
It is often useful to have the rescue system installed on hard disk, for example to perform filesystem operations on the root filesystem for which that needs to be unmounted. Loading the rescue system from hard disk is several times faster than using optical media. After the system is loaded, the hard disk is unused, just like the optical disk can be removed from the drive.
Obviously, this isn't any good for when the hard disk or the boot loader needs to be repaired...
Files needed fom installation media
This is for a 64bit system. Change accordingly for a 32bit system.
boot/x86_64/common boot/x86_64/config boot/x86_64/loader/initrd boot/x86_64/loader/linux boot/x86_64/rescue content content.asc
Create a directory /boot/media. Copy the following files from bootable optical media into that directory, keeping the directory structure . E.g.
Edit the file /boot/grub/menu.lst (as root), and append at the end
title Rescue kernel /boot/media/boot/x86_64/loader/linux rescue=hd:/boot/media keytable=en-us namescheme= splash=silent vga=0x318 panic=10 linemode=1 linuxrc.debug=4 initrd /boot/media/boot/x86_64/loader/initrd
Note that's only 3 lines in total, the "kernel" line must remain 1 line! And there is no keyword for an append line, that's only for lilo and PXE boot configuration files.
Adjust the keyboard layout, architecture, and anything else that's different in your case.
Reboot, and select the entry "Rescue" from the grub boot menu.
Extend the rescue system
In some situations it is useful to have more commands available in the rescue system. Fortunately it is relatively easy to add to it, if you don't mind an extra prompt.
- Create a squash filesystem with the files you want to add. Create a new directory somwhere, e.g. "myaddons", and fill it with files you want to add. The content of this myaddons directory is added under the top level directory of the running rescue system, keeping the directory structure. Therefore lay it out accordingly, e.g. by creating myaddons/usr/bin/.
- Install squashfs:
zypper -vv in squashfs
- Create the squashfs
mksquashfs myaddons addon -all-root -no-xattrs
This creates the file "addon".
- Copy the file "addon" into the same directory as "common" and "rescue" are in.
- Edit boot/x86_64/config
In the second line "rescue: ", add "addon" at the end of the line, so the line reads rescue: common rescue addon
Before the files are loaded, the system says that it can't find the SHA1 checksum for "addon", and asks whether to continue. Say yes.
The reason for this is that linuxrc verifies the checksums of all the files it loads, and after editing 'boot/x86_64/config" that one no longer matches its SHA1 sum. It is possible to disable the verification by adding insecure=1 to the kernel line. Ideally one would create new sums (if you know how to, put it in here).
It is also possible to load the rescue system from the LAN, using the PXE network boot mechanism.
- Can be used on any computer on the LAN that can boot from the network (are there any that can't?), no installation necessary.
- Servers are required for DHCP, TFTP, and FTP or HTTP.
- Must have a network connection - out in the field it doesn't work.
- The DHCP server must serve bootp information with the next-server field set to the tftp server's IP address. Set the boot file name to "pxelinux.0".
- TFTP server:
zypper -vv in tftp
Uninstall atftp, which is more complicated to set up. Run yast to set up the tftp service, the default tftp root of /srv/tftpboot is good. Yast fails to open the firewall port for tftp through xinetd, so add "0/0,udp,tftp" to FW_SERVICES_ACCEPT_EXT in /etc/sysconfig/SuSEfirewall2
- TFTP content
zypper -vv in syslinux
Copy the files gfxboot.c32, menu.c32, pxelinux.0, vesamenu.c32 to /srv/tftpboot. Create a config file /srv/tftpboot/pxelinux.cfg/default - the documentation in /usr/share/doc/packages/syslinux is good.
- FTP server
vsftpd is a good choice, or use apache for HTTP, or anything else that can be used as an installation source. Copy the files mentioned above under "Files needed fom installation media" to the ftp server, e.g. to /srv/ftp/ , keeping the directory structure.
- See SDB:Linuxrc for a description of all the parameters.
- See console 3 for debug output (default, linuxrc.log=/dev/tty3). There seems to be no way to get the log output to file.
- rescue=... is the same as rescue=1 install=...
- namescheme= switches back to devices by-device; default is by-id.
- Without keytable=, loader stops and asks.
- Without file content, repo is not found.
- Without file content.asc loader stops and asks.
- Without "?device=..." all partitions are tried to find the file content. To specify device, use rescue=hd:/boot/media?device=/dev/sda3
- To wait at several points in the boot process: linuxrc.debug=4,wait
- The SHA1 checksum verification can be turned off with insecure=1.
- Symlinks to files like common, rescue are not followed. Consider using hard links.