28-mar-2016: Welcome to our new server! Faster and less prone to crashing.

Welcome to the Slackware Documentation Project

Setting up a Recovery Boot Option

Overview and Purpose

Currently most Linux based distributions install a recovery/safe option and a memory test option in the default bootloader. While Slackware does not install such options by default, they can be easily added to any system.

The recovery prompt that will be installed in this tutorial will be an on-disk option to enter the Slackware usbboot image. This image currently includes a basic command line mode that is used to fix boot issues, the capability to run the setup application for new Slackware installations and access to the memtest86 application.

File Preparation

  1. Before you begin to make changes to your system you will need to obtain the file usb-and-pxe-installers/usbboot.img, this location is on the root of all installation media or distribution mirrors. It is recommended to place the file into the /tmp directory so it is easily located.
  2. Enter the root prompt by issuing the command su or signing into the system as the root user.
  3. Mount the usbboot.img file using the loopback option into an unused directory such as /mnt/tmp with the command
    mount -o loop /tmp/usbboot.img /mnt/tmp
  4. Create a separate directory in your /boot directory to contain the necessary files such as /boot/recovery with the command
    mkdir /boot/recovery
  5. Copy the files from the usbboot.img mounted directory into the newly created recovery directory with the cp command such as
    cp -rv /mnt/tmp/* /boot/recovery/
  6. Unmount the mounted usbboot.img file by issuing the command
    umount /mnt/tmp

lilo Configuration

In various cases the installed lilo application may not support the image sizes that are used for the installation medium, such as when attempting to reference the Slackware 14.0 usbboot image from lilo in Slackware 13.37.

In those cases you can either upgrade lilo (which may not be possible) or enter the standard prompt from within an installation CD, DVD or USB stick.

Before we begin modifying the lilo configuration you must first understand why the various options are being used.

  • image points to the kernel image which will be booted.
    • For 32-bit Slackware the options are hugesmp.s and huge.s.
    • For 64-bit Slackware the only option is huge.s.
  • label lists the label that will be presented for the option in the bootloader menu.
  • initrd lists the initial RAM disk that is used to load the temporary file system.
  • password, no explanation needed, enter the password that you wish to use to lock down entry into the boot option.
  • read-only is used to tell the system to mount the file system as read-only.

Using your favorite text editor modify the /etc/lilo.conf file to include the entry as shown below:

image = /boot/recovery/huge.s
  label = slackware-recovery
  initrd = /boot/recovery/initrd.img
  password = newpassword
  read-only

Once the new entry has been applied and saved in lilo.conf you will issue the command lilo, upon completion you will see an output similar to the following which will show that the new option has been successfully applied to the bootloader:

root@darkstar:~# lilo
Added linux  *
Added recovery

Since passwords are being applied within the /etc/lilo.conf file, it is recommended to modify the permissions of the file so that only root can read the contents. You can apply the recommended permissions by issuing the following command:

chmod 600 /etc/lilo.conf

Adding a memtest Option

The memtest option can currently be executed through the recovery command line prompt by issuing the command memtest, but to decrease the memory footprint of the loaded system we will setup a bootloader option to boot directly into the memtest application.

We will assume that you have already followed the instructions above to create a recovery option, if the instructions were not followed you can follow the basic steps above but only copy the file called memtest from the usbboot.img file into the recovery directory.

If you followed the recovery option instructions above, the memtest binary will already be present in the /boot/recovery directory.

The file memtest will be referenced as the image for a new lilo entry as shown below.

image = /boot/recovery/memtest
  label = memtest
  password = newpassword
  read-only

Once the new lilo entry has been saved and the lilo command has been run you will see see an output like the following confirming that the new option is available.

root@darkstar:~# lilo
Added linux  *
Added recovery
Added memtest

Sources


In Other Languages
Translations of this page?:
QR Code
QR Code howtos:slackware_admin:recovery_boot_option (generated for current page)