Slackware as a Linux rescue environment

From Notes to self
Revision as of 20:58, 16 July 2022 by Verbovet (talk | contribs)
Jump to navigation Jump to search
  • Download from one of the Slackware mirrors the kernel and initrd image, which Slackware uses for the installation:
https://mirrors.slackware.com/slackware/slackware64-15.0/kernels/huge.s/bzImage
https://mirrors.slackware.com/slackware/slackware64-15.0/isolinux/initrd.img

It is possible to use bzImage from a different Slackware version (e.g., -current), in this case the directory /lib/modules/X.X.X/ inside initrd.img must be upgraded to the same version (see next item for how to unpack initrd.img). This can be useful to support newer hardware.

  • If you have an access to the console and prefer to use it instead of a terminal via ssh, skip all steps related to changing initrd.img and don't use kbd= and nic= parameters in grub.cfg
  • Unpack initrd image (as root):
# mkdir dir
# cd dir
# xzcat ../initrd.img | cpio -di
# chroot .
  • Set a root password and do other changes if needed.
  • Exit chroot
  • Pack the modified initrd image: find . | cpio -o -H newc | xz -9fv -C crc32 > ../initrd.img
  • Install a Linux distribution that uses grub as boot loader on the remote server
  • Put bzImage and initrd.img to /boot/rescue/ directory on the remote server
  • Overwrite the content of the file /boot/grub/grub.cfg with the following, mutatis mutandis:
set default=0
set timeout=5

search --set=root --no-floppy --label ROOT

menuentry "Rescue (Installation Media)" {
  linux  /boot/rescue/bzImage load_ramdisk=1 prompt_ramdisk=0 rw \
    printk.time=0 SLACK_KERNEL=huge.s \
    kbd=us nic=auto:eth0:static:198.51.100.85:26:198.51.100.65
  initrd /boot/rescue/initrd.img
}

where the network configuration is [ip-address]:[netmask]:[gateway]. For more options see

http://docs.slackware.com/howtos:slackware_admin:booting_install_from_hdd and
http://alien.slackbook.org/blog/remote-installation-of-slackware-using-ssh/
  • Reboot
  • $ ssh root@198.51.100.85
  • source /etc/profile
  • Install Slackware in the usual way
  • The menuentry from the above grub.cfg can be preserved as a rescue boot option (possibly with unchanged initrd.img and without kbd= and nic= parameters).