Skip to content

Instantly share code, notes, and snippets.

Last active December 2, 2023 06:41
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Customize Grml LiveCD (remaster)

Customize Grml LiveCD (remaster)

This little bash script helps you to build your own customized grml.iso


  • Include your .ssh/*.pub files into authorized_keys
  • Inject Grml Cheats
  • Auto download all necessary files (the ISO and grml2usb)


  • grml96-full_2014.11.iso
  • Cheats
    • ssh=grml Start SSH Server and set the root password to grml
    • lang=de keyboard=de German
    • nobeep Suppress beep sound on boot
    • noblank Disable screen energy saving
    • noquick Disable GRML config tool
    • startup=/usr/bin/ip-screen Show IP-Addresses after boot

Usage example

./ [grml.iso file] "[GRML Cheats]"
./ grml64-small_2014.11.iso "ssh=secretPassword noblank welcome"

PS: Dont forget the to warp the GRML-Cheats with quotes.

#!/usr/bin/env bash
# The iso file to use as source (gets downloaded if doesnt exists)
[ "$ISO" = "" ] && ISO="grml96-full_2014.11.iso"
# List of GRML cheat codes to inject
# see;a=blob_plain;f=templates/GRML/grml-cheatcodes.txt;hb=HEAD
[ "$GRMLCODES" = "" ] && GRMLCODES="ssh=grml lang=de keyboard=de nobeep noblank noquick startup=/usr/bin/ip-screen"
OUTFILE=`echo $ISO | sed -e 's/.iso$/-customized.iso/'`
function errorAndExit {
echo ERROR: $1
exit 1
if [ ! -d "grml2usb" ] ; then
echo Downloading grml2usb
mkdir grml2usb
cd grml2usb
curl -s | tar --strip 1 -xz \
|| errorAndExit "Could not download grml2usb from"
cd ..
# Patch grml2usb to use python2
[ ! which python &>/dev/null ] && errorAndExit "python executable not found! I need version 2"
PYTHONVER2=`python -c 'import sys; print("%i" % (sys.hexversion<0x03000000))'`
if [ "$PYTHONVER2" != "1" ]; then
[ ! which python2 &>/dev/null] && errorAndExit "python version is > 2 and i didnt find python2 executable"
sed -i '1 s/.*/#!\/usr\/bin\/env python2/g' grml2usb/grml2usb
if [ ! -f "$ISO" ] ; then
echo Downloading $ISO
wget -q --show-progress$ISO \
|| errorAndExit "Could not download $ISO"
[ -d $TMPDIR ] || mkdir -p $TMPDIR
[ -d $OVERLAYDIR ] || mkdir -p $OVERLAYDIR
echo Including public SSH keys into authorized_keys
mkdir -p $TMPDIR/root/.ssh $TMPDIR/home/grml/.ssh
chmod 0700 $TMPDIR/root/.ssh $TMPDIR/home/grml/.ssh
cat /home/$USER/.ssh/*.pub > $TMPDIR/root/.ssh/authorized_keys
cat /home/$USER/.ssh/*.pub > $TMPDIR/home/grml/.ssh/authorized_keys
sudo chown -R 1000:1000 $TMPDIR/home/grml || exit 1
echo Generating overlay
tar --numeric-owner -j -c -f $OVERLAYDIR/config.tbz $TMPDIR || exit 1
echo Generating $OUTFILE
[ -f "OUTFILE" ] && rm $OUTFILE
sudo python=python2 GRML2USB=grml2usb/grml2usb grml2usb/grml2iso -b "$GRMLCODES" -c $OVERLAYDIR -o $OUTFILE $ISO
sudo chown $USER $OUTFILE
echo Cleanup
echo DONE
echo Your new ISO is $OUTFILE
echo I injected your pubkey and following GRML cheats: $GRMLCODES
Copy link

Razikus commented Feb 6, 2018

Hey, add "config" for GRMLCODES by default please - it's needed to autoconfigure grml in newest versions.

Copy link

mafrosis commented Nov 9, 2018

This is awesome. Thank you @psi-4ward

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment