GRML - Linux Live-CD for sysadmins

Download latest GRML ISO image
https://grml.org/download/

#URL=https://download.grml.org/grml64-small_2022.11.iso
URL=https://download.grml.org/grml64-small_2024.02.iso
wget ${URL} -qO ${URL##*/}

Install grml2usb package
https://grml.org/grml2usb/

wget -qO - https://deb.grml.org/repo-key.asc | sudo apt-key add -
echo "deb http://deb.grml.org/ grml-testing main" | sudo tee /etc/apt/sources.list.d/grml.list
sudo apt-get update
sudo apt-get install -y grml2usb
 
sudo apt install -y syslinux
sudo ln -s  /usr/lib/syslinux/mbr /usr/lib/syslinux/bios

Create bootable GRML USB pen

DEV=/dev/sdX
 
sudo umount ${DEV}*
sudo parted ${DEV} -s mklabel msdos
sudo parted ${DEV} -s mkpart primary 1 100%
sudo parted ${DEV} -s set 1 boot on
sudo mkfs.vfat ${DEV}1
 
sudo grml2usb grml64-small_*.iso --syslinux-mbr ${DEV}1

Configure / customization
http://git.grml.org/?p=grml-live.git;a=blob_plain;f=templates/GRML/grml-cheatcodes.txt

GRML_MOUNT=$(mount | grep ${DEV}1 | cut -d " " -f3)
 
mkdir ${GRML_MOUNT}/bootparams
 
# enable ssh server (user: grml, pass: grml)
echo ssh=grml >> ${GRML_MOUNT}/bootparams/custom_params
 
# configure langauge
echo lang=de >> ${GRML_MOUNT}/bootparams/custom_params
 
# enable scripts
echo scripts >> ${GRML_MOUNT}/bootparams/custom_params
 
# Boot Grml from ramdisk
echo grml2ram >> ${GRML_MOUNT}/bootparams/custom_params

Autostart script on boot / automation
https://grml.org/config/grml-autoconfig.1.html

# enable auto script execution
mkdir ${GRML_MOUNT}/bootparams
echo scripts > ${GRML_MOUNT}/bootparams/custom_params
 
mkdir ${GRML_MOUNT}/scripts
echo '#!/bin/bash
date > /tmp/debug' > ${GRML_MOUNT}/scripts/grml.sh
chmod a+x ${GRML_MOUNT}/scripts/grml.sh
 
#sed -i 's/vga=791/vga=791 scripts/g' /media/${USER}/*/boot/syslinux/grml64_small_default.cfg

Boot parameter
https://grml.org/online-docs/grml-config.html

# configure boot timeout
sed -i 's/timeout .*/timeout 30/g' /media/${USER}/*/boot/syslinux/syslinux.cfg
 
# Enable SSH server (user: grml / pass: grml)
# /boot/isolinux/default.cfg
sed -i 's/vga=791/vga=791 ssh=grml/g' /media/${USER}/*/boot/syslinux/grml64_small_default.cfg

Remaster GRML iso (broken, not bootable)

sudo apt-get install fuseiso
 
mkdir /tmp/grml_iso
fuseiso -p Downloads/iso/grml64-small_2021.07.iso /tmp/grml_iso/
rsync -ra /tmp/grml_iso/ /tmp/grml_iso_rw/
fusermount -u /tmp/grml_iso 
chmod -R +w /tmp/grml_iso_rw/
mkdir /tmp/grml_iso_rw/bootparams
echo ssh=grml >> /tmp/grml_iso_rw/bootparams/custom
mkisofs -o Downloads/iso/grml64-small_2021.07_ssh.iso /tmp/grml_iso_rw/

Links
http://www.grml.org/
https://grml.org/config/grml-autoconfig.1.html
http://www.linux-user.de/ausgabe/2006/06/008-grml/index.html
https://grml.org/tips/
https://github.com/grml/grml-autoconfig/blob/master/autoconfig.functions#L1497