Modifying Ubuntu/Debian installer iso

Jurjen Bokma

Last modified: "2020-04-13 10:27:33 jurjen"

Abstract

How to set preseed values inside an Ubuntu installer iso. This is useful when using DHCP/PXE is not feasible.


This page leans heavily on https://wiki.debian.org/DebianInstaller/Preseed/EditIso.

  1. sudo apt-get install xorriso isolinux

  2. wget http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso

    Be careful not to use too old an iso.

  3. 7z x -oDESTINATION mini.iso

  4. If you don't know which file to edit, you could create this fancy graph, where an arrow from A to B means A may include B, and a diamond arrow means A might cause syslinux to restart using B as a config file.

    Figure 1.  Syslinux menu configuration file dependency graph
    Dependencies of syslinux menu configuration files


    using this ad-hoc command:

    (cd DESTINATION && \
    TF=$(tempfile) ; \
    for f in $(ls -1 *.cfg) ; do \
        grep -i ${f} *.cfg ; \
    done| \
    sed -E \
        '1 s/^/strict digraph {\n/ ;
        /[[:space:]]config[[:space:]]/ s/[\n\r]/ [arrowhead = diamond]/ ;
        s/:[[:space:]]*(include|config)/ -> / ;
        s/\./_/g ; $ s/$/\n}\n/' >${TF} ; \
    dot -Tsvg ${TF} > ../syslinux_menucfg_dep_graph.svg ;\
    rm -f ${TF} \
    )

  5. Consider DESTINATION/txt.cfg (line numbers added):

     1	default install
     2	label install
     3		menu label ^Install
     4		menu default
     5		kernel linux
     6		append vga=788 initrd=initrd.gz --- quiet 
     7	label cli
     8		menu label ^Command-line install
     9		kernel linux
    10		append tasks=standard pkgsel/language-pack-patterns= pkgsel/install-language-support=false vga=788 initrd=initrd.gz --- quiet
    	

    We changed line 6 (this time without line number) into:

              append vga=788 initrd=initrd.gz auto=true ipv6.disable=1 priority=high locale=en_US hostname=myhost domain=mydomain.com console-setup/layoutcode=us console-setup/ask_detect=false keyboard-configuration/layoutcode=us url=http://path/to/preseed.txt pkgsel:pkgsel/update-policy="Install security updates automatically" postfix:postfix/mailname="host.mydomain.com" --- quiet
    	

    [2]

    We also tried to change the timeout. But that failed, and in hindsight it wouldn't even have served our purpose. So we stopped trying.

  6. xorriso -as mkisofs -o lwp.iso -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c boot.cat -b isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table DESTINATION



[2] Pkgsel and postfix are examples of how to preseed using kernel boot parameters. Find out what those parameters are by querying debconf.