Linux Rescue System Generator

Requisite

The only requisite are a working Linux version of the computer for which you want to create the rescue floppy, ZIP, CD-ROM or TFTP system. And a good Internet connection....

Abbreviations

Abbreviation Description
LRSG Linux Rescue System Generator

Description

Key feature

The purpose of Linux Rescue System Generator is to generate directly from the scratch a rescue system for the Linux instalation on which Linux Rescue System Generator is installed. The services which are covered are only usual shell commands (vi, ls, grep, find,...), file systems (FAT, NFS, EXT3, Reiserfs,...) and network (telnet server and client, ftp, NFS, samba,...). Several media are supported, like CD-ROM, floppy, TFTP, removable drives...
Multimedia, graphical login or other noncritical applications are not supported.

A default kernel configuration is generated automatically and which permits to detect the IDE, SCSI and Network devices automatically. Also the keyboard map and the current IP configuration are used for the generation of the rescue system.

Usual shell commands

Terminals

The following terminal connections are possible: No login is needed.

Commands

Here is an overview of the commands available:
[, arping, ash, basename, bunzip2, busybox, bzcat, cal, cat, chgrp, chmod, chown, chroot, chvt, cmp, cp, cpio, cut, date, dd, deallocvt, df, dirname, dmesg, dos2unix, du, dumpkmap, echo, egrep, env, expr, false, fbset, fdflush, fdformat, fdisk, fgrep, find, fold, free, freeramdisk, fsck.minix, ftpget, ftpput, getty, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod, ipcalc, kill, killall, length, linuxrc, ln, loadacm, loadfont, loadkmap, logname, losetup, ls, lsmod, makedevs, md5sum, mesg, mkdir, mkfifo, mkfs.minix, mknod, mkswap, modprobe, more, mount, mt, mv, nc, nslookup, od, openvt, patch, pidof, ping, pivot_root, poweroff, ps, pwd, rdate, realpath, reboot, renice, reset, rm, rmdir, rmmod, route, rpm, rpm2cpio, sed, setkeycodes, sh, sha1sum, sleep, sort, strings, stty, swapoff, swapon, sync, tail, tar, tee, telnet, telnetd, test, tftp, time, touch, tr, traceroute, true, tty, umount, uname, uniq, unix2dos, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi, watch, watchdog, wc, wget, which, who, whoami, xargs, yes, zcat

It is possible to add or remove some commands by editing the Busybox configuration.

File systems

LRSG needs minix, ext2 and ISO9660. Optionally, NTFS, Reiserfs, NFS, Samba are in LRSG but not required.
It is possible to add other file systems by selecting it as modules in the kernel.

Network operations

The network is setup automatically using the following rules:
  1. If a DHCP server is present, the IP address used is the address provided by the DHCP server
  2. If no DHCP server is present, the IP address used is the address of the computer on which the generation script was running.
A telnet server is setup automatically on startup.

Removable media supported

LRSG support several media types and boot mechanism. For each of them the same features are available. But the main differences are on the boot mechanism and the media properties (size, access right...).
Here is an overview of the media supported:
Type Boot File system Remark
Floppy The kernel is booted directly The file system is in a RAM disk. Any modifications after shutting down are lost.
TFTP PXELINUX: the configuration files and the boot images must be transfered to the TFTP server The file system is in a RAM disk. Any modifications after shutting down are lost. The TFTP configuration assume that you have a network with a DHCP and TFTP server working.
The TAR file generated needs to be unpacked on the TFTP root path and the boot image to transmit is pxelinux.0
CD-ROM ISOLINUX
  • /,/tmp /var /etc are on a RAM disk. Any modifications after shutting down are lost on this paths.
  • /bin /sbin and /usr are located on the CD-ROM. This directories are read only
ZIP GRUB The file system is writable.

Root file system customisation

Appending files/programs to the root file system

LRSG append all files needed to generate the rescue system to a TAR file. Appending a file or an application to this TAR file will add it into the rescue system.
Example:
tar Avf rootfs_floppy.tar /etc/lilo.conf
will add the file /etc/lilo.conf to the root directory of the rescue floppy.
The following table give the name of the TAR file for each type of rescue system:
Type Root file system (tar format)
Floppy rootfs_floppy.tar
TFTP rootfs_tftp.tar
CD-ROM rootfs_cdrom.tar
ZIP/JAZ/MO rootfs_zip.tar
Note: When appending application it is necessary to append also all used libraries. (see the ldd command)
Note: For the TFTP configuration, it is possible to increate the size of the RAM disk to append more files.
Note: For the floppy configuration, it is generally not possible to add more than 100k.

Initialisation script

After the initialisation, the script
/etc/init.d/rc.local
is executed if present.
Example:
mkdir -p etc/init.d/
echo "#!/bin/sh" > etc/init.d/rc.local
echo "echo hello" >> etc/init.d/rc.local
chmod +x etc/init.d/rc.local
tar Avf rootfs_floppy.tar etc/init.d/rc.local
will display "hello" when the boot floppy comes up.

Install

Simply decompress the archive:
tar xvfj linuxrescuegen-x.xxx.tar.bz2
cd linuxrescuegen-x.xxx
make

THE MAKEFILE MUST BE EXECUTED AS ROOT.

Usage


THE MAKEFILE MUST BE EXECUTED AS ROOT.

Main menu

Type make, a menu will appear:
***************************************
*    Linux Rescue System Generation    *
*          Sebastien Fricker           *
****************************************

Main menu
[1] Download the source code from Internet
[2] Generate a floppy
[3] Generate a TFTP boot configuration
[4] Generate a ZIP floppy
[5] Generate a CD-ROM
[6] Generate a 2 floppy system
[s] Select software packages
[c] Configure software packages
[-] Clean
[h] Help
[Hx] Help on menu entry x
[v] Non-Verbose mode
[x] Exit
Use the following commands:

Configuration

****************************************
*    Linux Rescue System Generation    *
*          Sebastien Fricker           *
****************************************

Package configuration
[1] Generation parameters
[2] Linux kernel
[3] uClibc
[4] Busybox
[h] Help
[Hx] Help on menu entry x
[q] Quit

Generation parameters

General parameters

The general configuration parameters contains path to devices, name of files, file system types,... All of them are stored in the configs file. The configs can be modified directly and if some parameters are empty, the generation script will ask for it before starting.
Parameter Description
CONFIG_KEYBOARD Select the keyboard. 'auto' to take the actual configuration.
HELP_BROWSER Name of the HTML browser (lynx, opera,...)
KERNEL_VERSION_MAJ Kernel major version number
KERNEL_VERSION_MIN Kernel minor version number
KERNEL_REVISION Kernel revision number
BUSYBOX Busybox version
UCLIBC uClibc Version
GRUB GRUB version
SYSLINUX ISOLINUX/PXELINUX version

Floppy parameters

Parameter Description
FLOPPY_DEV Name of the floppy device (ex:/dev/fd0).If not specified, only the image will be generated
FLOPPY_IMAGE Name of the floppy image. Using dd it is possible to write a floppy
FLOPPY_ROOTFSSIZE Size of the RAM disk which contains the root file system (ex:4096)
FLOPPY_ROOTFSTYPE Type of the file system RAM disk which contains the root file system.Use minix or ext2.

TFTP parameters

Parameter Description
TFTP_ARCHIVE name of the archive which contains the TFTP boot files (ex:tftpboot.tar.bz2)
TFTP_ROOTFSSIZE Size of the RAM disk which contains the root file system (ex:4096)
TFTP_ROOTFSTYPE Type of the file system RAM disk which contains the root file system. Use minix or ext2.

CDROM parameters

Parameter Description
CDROM_TMPFSSIZE Size of the RAM disk which contains the /tmp,/,/var and /etc partition. (ex:1024)
Note: the RAM disk us used for the initrd and the /tmp directory
CDROM_TMPFSTYPE Type of the RAM disk. Use minix or ext2.
CDROM_ISOFILE File name of the CD-ROM image (ISO format). ex: cdrom.iso
CDROM_CDRECORDER CD-Recorder device. If not set the CD will not burned. The device name has the following format:bus_index,device_id,lun
CDROM_CDRECORDER_SPEED Speed of recording (not necessary to specify)

ZIP/MO/JAZ parameters

Parameter Description
ZIP_DEV Enter the name of the ZIP/JAZ/MO... device (ex:/dev/sdb)
ZIP_ROOTFSTYPE Type of the file system which contains the root file system. Use minix or ext2.

Ethernet

Parameter Description
ETHERNET_ETH0 IP Address of the eth0 network card. If empty the local IP address will be used.
ETHERNET_ETH1 IP Address of the eth1 network card. If empty the local IP address will be used.

Kernel configuration

This menu entry start an automatic detection of the hardware available and when complete the kernel configuration editor(make menuconfig). All network devices and SCSI/IDE driver should be selected in the kernel configuration.
If a module is selected, it will automatically be loaded as soon as the root file system if mounted. To reduce the size of a floppy image, it is possible to deselect some modules. And also to support new drives, it is possible to select them as modules.

uClibC configuration

This menu start the configuration editor of the uClibC.

Busybox configuration

This menu start the configuration editor of the busybox tools.

Package selection

Parameter Description
PACKAGE_AMANDA Amanda recovering utility 'amrecover' (yes/no)
PACKAGE_AMANDA_SOURCES Amanda recovering utility : version of the source file
PACKAGE_TAR GNU Tar utility 'tar' (yes/no). This package is needed for amanda in the case of restoration of backup using GNU Tar
PACKAGE_TAR_SOURCES Gnu tar support: version of the source file
PACKAGE_DUMP Dump utility 'restore' (yes/no). This package is needed for amanda in the case of restoration of backup using Dump
PACKAGE_DUMP_SOURCES Dump/restore support: version of the source file
PACKAGE_E2FSPROGS_SOURCES E2fsprogs: version of the source file. This library is used by dump.

FAQ

DCHP server for TFTP boot configuration

Decompress the TAR archive to the TFTP root directory.
Example:

cd /tftpboot
tar jvfx tftp-tar-file.tar.bz2 

Mofify the file /etc/dhcpd.conf to distribute the IP address and set the file pxelinux.0 as boot image.
For example append this lines to /etc/dhcpd.conf:

host rescue1 {
	filename "pxelinux.0";
	hardware ethernet 00:00:00:00:00:00; # put here the MAC address
	fixed-address 10.1.1.100;            # put here the IP address
	}

Test the rescue system

Generally it is a good idea to test if the rescue system is working. And I would say that if you are not sure that every think you need if working you can forget the rescue system!!!!
Proceed as follow:

Known Problems

Debian

Busybox

The GCC v3.3.4 (Debian) doesn't compile busybox

SuSE 8.2

Busybox

Busybox is not compiling with the GCC version installed. The following error occurs:

/root/linuxrescuegen/busybox-1.00-pre2/../i386-linux-uclibc/bin/i386-uclibc-gcc -I./include -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wstrict-prototypes -Wshadow -Os -march=i386 -mpreferred-stack-boundary=2 -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer -D_GNU_SOURCE -DNDEBUG     -c -o libbb/dump.o libbb/dump.c
libbb/dump.c: In function `rewrite':
libbb/dump.c:307: error: unrecognizable insn:
(insn:HI 1049 918 1050 33 0x402a7e70 (set (reg:CC 17 flags)
        (compare:CC (const:SI (plus:SI (symbol_ref:SI ("lcc"))
                    (const_int 1 [0x1])))
            (reg/f:SI 110))) -1 (nil)
    (expr_list:REG_DEAD (reg/f:SI 110)
        (nil)))
libbb/dump.c:307: internal compiler error: in extract_insn, at recog.c:2175
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
make: *** [libbb/dump.o] Error 1
This is a GCC problem on SuSE8.2. Disabling the optimisation solve the problem (so remove -Os from the command line for libbb/dump.c)

GRUB

GRUB is not compiling with the GCC version installed: the ZIP/MO/JAZ rescue can not be generated on SuSE8.2

Download

To download the latest version click here

Maintenance

Report a BUG

Browse the list of BUGS submitted (click here), and if this problem is not reported add a new item (click here>
.
You will be informed of the status of the correction.

Feature request

Browse the list of requested features submitted (click here), and if this feature is not requested add a new item (click here).
You will be informed of the status of the implementation.

How to contribute

The best way to contribute to this project is to report bugs and problems. Give any comment, this will help to increase the usability.

Have some fun with it.
Sebastien Fricker


This project is sponsored by CoverageMeter - Software Test Performance Measurement