Boot Grml from Harddisk

Preface

The Grml rescue system supports booting the Grml ISO from a hard disk. This provides a decent way to have a Grml ISO in /boot/grml/ on your hard disk and as long as the hard disk and its GRUB boot loader is working you can boot the Grml rescue system without having a rescue CD, USB pen or PXE environment available.

To make this task as easy as possible we've created grml-rescueboot which integrates ISO-booting into GRUB. The grml-rescueboot package includes a script for update-grub which looks for Grml ISO images in /boot/grml and automatically adds an entry for each image.

Requirements

  • Grml ISO
  • GRUB2 bootloader

Installation of grml-rescueboot

grml-rescueboot is available via 'apt-get install' in Debian/wheezy and Debian/sid and Ubuntu precise/universe and Ubuntu quantal/universe:

apt-get install grml-rescueboot

If you're running Debian/squeeze you can just use the grml-rescueboot package from Debian wheezy/sid.

If you're using a different system/distribution the following commands should set up grml-rescueboot for you:

wget -O /etc/default/grml-rescueboot https://raw.github.com/grml/grml-rescueboot/master/etc/default/grml-rescueboot
wget -O /etc/grub.d/42_grml https://raw.github.com/grml/grml-rescueboot/master/42_grml
chmod 755 /etc/grub.d/42_grml

Note: we'd love to see grml-rescueboot being available outside of Debian and Ubuntu as well, if you're interested in providing RPMs, ebuilds, arch packages,… please let us know!

Setup of grml-rescueboot

Once you've install the grml-rescueboot package the setup is as simple as:

cd /boot/grml
wget http://download.grml.org/grml64-full_2012.05.iso
wget http://download.grml.org/grml64-full_2012.05.iso.sha1
sha1sum -c grml64-full_2012.05.iso.sha1
update-grub

Customisation of Bootoptions

To be able to access the harddisk of the system you're booting from you need to load the ISO into RAM (using the toram bootoptions). You also might want to autostart the SSH server to be able to access the system remotely using ssh=somepassword. Enabling such bootoptions is as simple as running:

echo 'CUSTOM_BOOTOPTIONS="ssh=secretpasswd toram"' >> /etc/default/grml-rescueboot
update-grub

Problems?

Are using your own hand-crafted GRUB configuration with a Grml ISO which used to work until and including Grml release 2011.05 but fails with 2011.12 and later ISOs? If so then very probably the live-media-path=... bootoption is missing in the linux GRUB command line of your Grml ISO boot entry.

Please consider using grml-rescueboot instead. It does all the magic for you and uses the loopback mechanism with “loopback loop …” and “configfile /boot/grub/loopback.cfg”, allowing to use the bootoptions as required by the according Grml ISO and therefore not breaking backwards compatibility.

If you really can't use grml-rescueboot for whatever reason (please talk to us then!) have a look at the following configuration examples.

Configuration references

Those grub.cfg configuration entries are meant for reference purposes only - please use grml-rescueboot instead of manually creating such boot entries. Also be aware that the “insmod”, “set root=…” and “search …” options are system specific:

Sample GRUB2 configuration with loopback feature

menuentry "Grml Rescue System (grml64-full_2012.05.iso)" {
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set <snipped>
        iso_path="/boot/grml/grml64-full_2012.05.iso"
        export iso_path
        kernelopts=" ssh=password toram  "
        export kernelopts
        loopback loop "/boot/grml/grml64-full_2012.05.iso"
        set root=(loop)
        configfile /boot/grub/loopback.cfg
}

Sample GRUB2 configuration without loopback feature

menuentry "grml64-small 2012.05 (amd64)" {
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set <snipped>
        echo 'Loading Grml kernel (amd64) ...'
        linux /boot/grml/vmlinuz boot=live noeject noprompt findiso=/boot/grml/grml64-small_2012.05.iso toram bootid=grml64small201205 ssh=secret live-media-path=/live/grml64-small/
        echo 'Loading Grml initrd (amd64) ...'
        initrd /boot/grml/initrd.img
}

Sample GRUB2 configuration without loopback.cfg file

menuentry "grml64-full 2012.05 (amd64)" {
        insmod part_msdos
        insmod ext2
        set root='(hd0,msdos1)'
        search --no-floppy --fs-uuid --set <snipped>
        iso_path="/boot/grml/grml64-full_2012.05.iso"
        export iso_path
        kernelopts=" ssh=password toram "
        export kernelopts
        loopback loop "/boot/grml/grml64-full_2012.05.iso"
        set root=(loop)
        source /boot/grub/grml64-full_default.cfg
}

Sample GRUB1 configuration

title           grml64-small 2012.05 (amd64)
root            (hd0,1)
kernel          /boot/grml/vmlinuz boot=live noeject noprompt findiso=/boot/grml/grml64-small_2012.05.iso toram bootid=grml64small201205 ssh=secret live-media-path=/live/grml64-small/
initrd          /boot/grml/initrd.img

Important Bootoptions for Rescueboot and related Debugging

  • bootid=something: use specified argument as identifier for the ISO (by default corresponds to $GRML_FLAVOUR$VERSION without any special characters and whitespaces, like grml64small201205)
  • break=something: start debugshell during initramfs stage break=something (where valid arguments for something are: top, modules, premount, mount, mountroot, bottom, init)
  • debug=1: be more verbose about boot sequence execution
  • findiso=…: look for the specified ISO file on all disks where it usually looks for the .squashfs file
  • ignore_bootid: disable boot ID verification
  • live-media-path=…: set path to the live filesystem on the medium (needs to be /live/$GRML_FLAVOUR/ by default, where $GRML_FLAVOUR is something like grml64-full, grml32-full, grml64-small,…)
  • noeject: do not eject ISO/CD after halt/reboot
  • noprompt: do not prompt to remove the ISO/CD when halting/rebooting the system
  • toram: copy the whole ISO to RAM and run from there
  • toram=filename.squashfs: copy only the specified file to RAM and run from there (example: toram=grml64-small.squashfs)

For further bootoptions and related documentation please visit http://grml.org/cheatcodes/

 
rescueboot.txt · Last modified: 2017/06/26 13:56 by zugschlus
 
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Grml homepage Driven by DokuWiki