Skip to content

RFC: Redesign of grml-live #267

Open
@mika

Description

@mika

Redesign of grml-live

Main tasks of grml-live

grml-live is a build system for creating a Grml and Debian based Linux Live system.

grml-live includes the following main stages:

  • FAI dirinstall: FAI (Fully Automatic Installation) does the chroot related work with hooks/scripts provided by grml-live (related to grml_chroot directory)
  • mksquashfs: generates the compressed squashfs file which provides the chroot in compressed format (related to grml_cd directory)
  • xorriso: generates the ISO itself, based on the output by mksquashfs and some further bootmanger related stuff handled by grml-live (related to grml_iso directory)

We don't plan to replace any of mksquashfs nor xorriso, though consider getting rid of FAI (with its dirinstall feature and its fcopy tool that we currently use within grml-live).

Rational for getting rid of FAI

FAI is a tool for unattended mass deployment of Linux, which is available since 1999. Especially the class system of FAI was a compelling and promising reason to build grml-live on top of FAI. grml-live therefore was based on FAI since its early beginnings in 2007.

grml-live was designed for building Debian based live systems and relied on FAI's dirinstall feature underneath. The way live systems are built might look similar to disk based installations. But with grml-live we have specific needs for our release process that FAI was never designed for. We also provide ISO specific customization options and need to comply with GPL needs. Neither of those requirements are fullfilled by FAI.

We also had to deal with behavior changes within FAI (e.g. shell.log vs. scripts.log: 74c4bce, make-fai-nfsroot.conf: 75e65f3, ignoring packages: 121b348).

As with any software, we hit bugs also with FAI, like e.g. #760133 ('mount --make-runbindable' breaks underlying device for unrelated operations), #989547 (ROOTCMD relies on specific unshare features), and #1056151 (which makes /usr/sbin/init vanish in /usr-move conditions).

For certain issues we implemented our own workarounds (e.g. 5c3e795, 4e93b8e, e5e4578, ef74e87, 8352df0 AKA https://bugs.debian.org/928981, e9da330, 4e027c7, 8cfed16, 4bc598a).

Usage of FAI within containers also isn't straight forward, we need to e.g. patch hardcoded behavior in /usr/lib/fai/subroutines (see

def fixup_fai():
).

We also hit problems with FAI's base tar files approach (see #143 (comment) + https://bugs.debian.org/881829), which we relied on for performance reasons (as bootstrapping a Debian system via https://wiki.debian.org/Debootstrap is quite slow).
Throughout the last years mmdebstrap became the go-to implementation for bootstrapping Debian systems, being a very fast and also customizable tool which we want to utilise for our needs and also avoid need for base files.
FAI hardcodes usage of debootstrap within fai-make-nfsroot (also see e.g. f365415), preventing us to switch to mmdebstrap therefore.

Last but not least, we also have several workarounds in place for dealing with the way FAI handles logfiles and exit codes, that we would like to get rid of.

Re-Design Goal

  • Minimize dependencies on 3rd party, most notably FAI
  • Build grml-live on top of mmdebstrap
  • Get rid of deprecated workarounds and backwards compatibility for anything older than oldstable
  • Use established and common Debian practices as much as possible
  • Keep FAI's class approach (GRMLBASE, GRML_FULL, GRML_SMALL,...) where useful
  • Remain as backwards-compatible for users of grml-live users as possible, but where necessary and sensible get rid of outdated customs and practices

What's going underneath FAI within grml-live usage

We invoke FAI from within grml-live via:

BUILD_ONLY="$BUILD_ONLY" BOOTSTRAP_ONLY="$BOOTSTRAP_ONLY" GRML_LIVE_CONFIG="$CONFIGDUMP" fai $VERBOSE \
              -C "$FAI_CONF_DIR" -s "file:///$GRML_FAI_CONFIG" -c"$CLASSES" \
              -u "$HOSTNAME" "$FAI_ACTION" "$CHROOT_OUTPUT" $FAI_ARGS

With a grml-live command like this:

 ./grml-live -s trixie -a amd64 -c GRMLBASE,GRML_SMALL,AMD64 -o /home/mika/build/grml-live-2025-01 -v 2025.01-rc0

The resulting fai dirinstall command line then looks like this:

BUILD_ONLY= BOOTSTRAP_ONLY= GRML_LIVE_CONFIG=/tmp/tmp.rxcvirnXxm WAYBACK_DATE= 
  fai -C /tmp/tmp.8tMsaOEkbQ \
      -s file:////home/mika/src/grml/grml-live/config \
      -cDEBIAN_TRIXIE,GRMLBASE,GRML_SMALL,AMD64 \
      -u grml \
      dirinstall /home/mika/build/grml-live-2025-01/grml_chroot

grml-live with FAI then underneath invokes:

Calling task_confdir
Calling task_setup
Calling task_defclass
Calling task_defvar
Calling task_action
Calling task_dirinstall
Calling task_extrbase
  -> Calling debootstrap --exclude=info,tasksel,tasksel-data,isc-dhcp-client,isc-dhcp-common --include=aptitude --arch amd64 trixie /home/mika/build/grml-live-2025-01/grml_chroot http://deb.debian.org/debian
Calling task_debconf
Calling task_repository
Calling hook: updatebase.GRMLBASE
Calling task_updatebase
Calling hook: instsoft.GRMLBASE
Action dirinstall of FAI (hooks/instsoft.GRMLBASE) via grml-live running
Diverting update-grub executable
Adding 'local diversion of /usr/sbin/update-grub to /usr/sbin/update-grub.distrib'
Diverting grub-probe executable
Adding 'local diversion of /usr/sbin/grub-probe to /usr/sbin/grub-probe.distrib'
instsoft.GRMLBASE    OK.
Calling task_instsoft
Calling task_configure
GRMLBASE/01-packages OK.
GRMLBASE/02-run      OK.
GRMLBASE/03-get-sources OK.
GRMLBASE/05-hostname OK.
[...]
GRMLBASE/99-finish-grml-build OK.
GRML_SMALL/90-update-alternatives OK.
Calling task_tests
Calling task_finish
Calling task_savelog
Calling task_faiend

grml-live with -b (build only) invokes:

Calling task_confdir
Calling task_setup
Calling task_defclass
Calling task_defvar
Calling task_action
FAI_ACTION: softupdate
Calling task_softupdate
Performing FAI system update. All data may be overwritten!
Calling task_debconf
[...]
Calling task_repository
[...]
Calling hook: updatebase.GRMLBASE
Action softupdate of FAI (hooks/updatebase.GRMLBASE) via grml-live running
fcopy: destination etc/apt/sources.list.d/debian.list remains unchanged
fcopy: destination etc/apt/sources.list remains unchanged
[...]
updatebase.GRMLBASE  OK.
Calling task_configure
GRMLBASE/01-packages OK.
GRMLBASE/02-run      OK.
GRMLBASE/03-get-sources OK.
GRMLBASE/05-hostname OK.
[...]
GRMLBASE/99-finish-grml-build OK.
GRML_SMALL/90-update-alternatives OK.
Calling task_tests
Calling task_finish
Calling task_savelog
Calling task_faiend

grml-live with -u (update) invokes:

Calling task_confdir
Calling task_setup
Calling task_defclass
Calling task_defvar
Calling task_action
FAI_ACTION: softupdate
Calling task_softupdate
Calling task_debconf
Calling task_repository
Calling hook: updatebase.GRMLBASE
Action softupdate of FAI (hooks/updatebase.GRMLBASE) via grml-live running
[...]
updatebase.GRMLBASE  OK.
Calling hook: instsoft.GRMLBASE
Action softupdate of FAI (hooks/instsoft.GRMLBASE) via grml-live running
Diverting update-grub executable
Adding 'local diversion of /usr/sbin/grub-probe to /usr/sbin/grub-probe.distrib'
Hit:1 http://security.debian.org/debian-security trixie-security InRelease
Get:2 http://deb.debian.org/debian trixie InRelease [175 kB]
Get:3 http://deb.debian.org/debian trixie/main Sources [10.3 MB]
Hit:4 http://deb.grml.org grml-live InRelease
[...]
instsoft.GRMLBASE    OK.
Calling task_instsoft
Calling task_configure
GRMLBASE/01-packages OK.
GRMLBASE/02-run      OK.
GRMLBASE/03-get-sources OK.
GRMLBASE/05-hostname OK.
[...]
GRMLBASE/99-finish-grml-build OK.
GRML_SMALL/90-update-alternatives OK.
Calling task_tests
Calling task_finish
Calling task_savelog
Calling task_faiend

Migration plan

Currently existing FAI related files + scripts in grml-live and their purpose:

  • config/debconf/GRMLBASE: debconf preseeding (idea: provide script which invokes debconf-set-selections within mmdebstrap?)
  • config/class/GRMLBASE.var: setting environment variables (idea: should be set by default by grml-live and be customizable via grml-live.conf?)
  • config/files: system specific configuration for e.g. apt, initramfs-tools + systemd
  • config/grml/squashfs-excludes: grml-live specific configuration to exclude files during mksquashfs execution (idea: move to etc/grml/?)
  • config/hooks/instsoft.ZFS: build zfs modules (idea: convert into a script for usage within mmdebstrap?)
  • config/hooks/updatebase.GRMLBASE: mostly workarounds to handle FAI in different build modes (idea: most shouldn't be relevant without FAI, relevant steps could be handled directly within grml-live or mmdebstrap scripts)
  • config/hooks/instsoft.GRMLBASE: in build-only mode (-b) doesn't do anything, otherwise only legacy actions or FAI workarounds take place (idea: most shouldn't be relevant without FAI, relevant steps could be handled directly within grml-live or mmdebstrap scripts)
  • config/hooks/savelog.LAST.source: FAI specific for log files related to error.log (idea: shouldn't be relevant with deprecation of FAI?)
  • config/package_config/*: which Debian packages should be installed in which grml flavour, also depending on Debian release (idea: investigate whether to keep as is or reconsider file format, also research what options could we have with apt/aptitude to easily ignore packages on-demand? how to implement class approach on our own?)
  • config/scripts: executing tools to apply configuration changes, updates etc (idea: drop scripts that only invoke FAI's fcopy to install configuration files, provide $ROOTCMD + $target via grml-live to keep scripts functional as-is

Feedback

Constructive comments, feedback and suggestions highly welcome!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions