SUSE Support

Here When You Need Us

How to implement a rescue system on a SUSE Linux Enterprise Server 12

This document (7018607) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 12

Situation

The aim is to implement a disk or ISO based rescue system that can be booted from the grub2 boot screen in case the system experiences problems.

Resolution

Scenario 1: Boot the rescue media from local disk structure.

Assumption: It is desired to have the files from rescue media in /boot. /dev/sda1 is mounted there.


1. Mount the SLE ISO to /mnt

2. cd /mnt

3. Copy the following content to a directory (e.g /boot). The following script may help with the given task:

#!/bin/bash
set -x

DEST=/boot
mkdir -p /$DEST/media/boot/x86_64/loader
for i in \
content \
content.asc \
boot/x86_64/loader/initrd \
boot/x86_64/loader/linux \
boot/x86_64/rescue \
boot/x86_64/common \
boot/x86_64/config \
boot/x86_64/cracklib-dict-full.rpm
do
    cp -av /mnt/$i /$DEST/media/$i
done
set +x
4. Create a new grub2 boot entry in /etc/grub.d/40_custom:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Rescue with FS Path: /boot" --class sles --class gnu-linux --class gnu --class os {
  load_video
  set gfxpayload=keep
  insmod gzio
  insmod part_msdos
  insmod btrfs
  insmod ext2
  insmod lvm
  set root=(hd1)
  #set root=(lvm/system-lvboot)
  set loader=(hd1)
  linux $loader/media/boot/x86_64/loader/linux rescue=1 install=hd:/media?device=sdb* keytable=de namescheme= splash=silent vga=0x318 panic=10 linemode=1 linuxrc.debug=4,trace
  initrd $loader/media/boot/x86_64/loader/initrd

}
5. Activate the new boot loader configuration:
grub2-mkconfig -o /boot/grub2/grub.cfg
6. Reboot and test

Scenario 2: Boot the rescue media from an ISO from disk

1. Mount your SLE ISO to /mnt
2. Copy the following content to a local directory of your need (e.g /tmp)

#!/bin/bash
set -x

DEST=/tmp
mkdir -p /$DEST/media/boot/x86_64/loader
for i in \
content \
content.asc \
boot/x86_64/loader/initrd \
boot/x86_64/loader/linux \
boot/x86_64/rescue \
boot/x86_64/common \
boot/x86_64/config \
boot/x86_64/cracklib-dict-full.rpm
do
    cp -av /mnt/$i /$DEST/media/$i
done
set +x

3. Create an ISO file from the created directory
cd /tmp
mkisofs -o /boot/media.iso -l media
4. Add a new grub2 boot entry in /etc/grub.d/40_custom
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

menuentry "Rescue with ISO" --class sles --class gnu-linux --class gnu --class os {
  load_video
  set gfxpayload=keep
  insmod gzio
  insmod part_msdos
  insmod btrfs
  insmod ext2
  insmod lvm

  set isofile=(hd0,1)/media.iso
  loopback loop $isofile
  set root=(hd0,1,msdos2)

  linux (loop)/boot/x86_64/loader/linux rescue=1 install=hd:/media.iso keytable=de namescheme= splash=silent vga=0x318 panic=10 linemode=1 linuxrc.debug=4,trace
  initrd (loop)/boot/x86_64/loader/initrd

}

Cause


Additional Information


Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7018607
  • Creation Date: 10-Feb-2017
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.