UbuntuInstaller - ErikStaats/Notes GitHub Wiki
- Links
- Automation links
- How to make a custom USB installer
- How to debug the Ubuntu installer
- How to automate the installer with a preseed file
- InstallCDCustomization
- Remastering the Install ISO
- How do I create an EFI-bootable ISO of a customized version of Ubuntu?
- Explanation of mkisofs CLI argument ordering
- Debugging Ubiquity
- Installer options
- Automating Ubiquity
- Debian Automating the installation using preseeding
- Modify installer behaviour using a Preseed file
In this example, a custom USB installer is created from the ubuntu-18.04.2-desktop-amd64.iso standard installer ISO image.
Start by mounting the standard installer ISO image at cd_mnt
and extracting
the files to cd_image
. Change the permissions so that you can write to the
files in cd_image
.
Edee$ mkdir cd_mnt
Edee$ sudo mount -o loop ubuntu-18.04.2-desktop-amd64.iso cd_mnt
mount: /home/erikstaats/dev/install/install/cd_mnt: WARNING: device write-protected, mounted read-only.
Edee$ ls cd_mnt
boot casper dists EFI install isolinux md5sum.txt pics pool preseed README.diskdefines ubuntu
Edee$ cp -rT cd_mnt cd_image
Edee$ chmod -R u+w cd_image
Edee$ ls cd_image
boot casper dists EFI install isolinux md5sum.txt pics pool preseed README.diskdefines ubuntu
Edee$ ls -l cd_image | head -3
total 72
drwxr-xr-x 3 erikstaats erikstaats 4096 Mar 3 20:00 boot
drwxr-xr-x 2 erikstaats erikstaats 4096 Mar 3 20:00 casper
Edee$
Next, add a custom boot menu option for the custom installer in
cd_image/boot/grub/grub.cfg
.
Edee$ vi cd_image/boot/grub/grub.cfg
Edee$ grep -A 9 "Install My Ubuntu" cd_image/boot/grub/grub.cfg
menuentry "Install My Ubuntu" {
set gfxpayload=keep
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash ---
initrd /casper/initrd
}
menuentry "Install Ubuntu" {
set gfxpayload=keep
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash ---
initrd /casper/initrd
}
Edee$
Extract the MBR from the standard installer ISO to use as the MBR template for the custom installer.
Edee$ dd if=ubuntu-18.04.2-desktop-amd64.iso bs=512 count=1 of=isohdpfx.bin
1+0 records in
1+0 records out
512 bytes copied, 0.000344763 s, 1.5 MB/s
Edee$
Use xorriso
to create the custom installer ISO image. Note that the order of
arguments is significant. Incorrect ordering can lead to errors like
"invalid image size".
Edee$ xorriso -as mkisofs \
-iso-level 3 \
-full-iso9660-filenames \
-volid "My Ubuntu Install" \
-eltorito-boot isolinux/isolinux.bin \
-eltorito-catalog isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-isohybrid-mbr isohdpfx.bin \
-eltorito-alt-boot \
-e boot/grub/efi.img \
-no-emul-boot -isohybrid-gpt-basdat \
-output my_ubuntu_install.iso \
cd_image
xorriso 1.4.8 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:my_ubuntu_install.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 429g free
xorriso : WARNING : -volid text problematic as automatic mount point name
xorriso : WARNING : -volid text does not comply to ISO 9660 / ECMA 119 rules
Added to ISO image: directory '/'='/home/erikstaats/dev/install/install/cd_image'
xorriso : UPDATE : 675 files added in 1 seconds
xorriso : UPDATE : 675 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/home/erikstaats/dev/install/install/isohdpfx.bin'
libisofs: NOTE : Automatically adjusted MBR geometry to 1024/119/32
libisofs: NOTE : Aligned image size to cylinder size by 211 blocks
xorriso : UPDATE : 7.12% done
xorriso : UPDATE : 80.12% done
ISO image produced: 974848 sectors
Written to medium : 974848 sectors at LBA 0
Writing to 'stdio:my_ubuntu_install.iso' completed successfully.
Edee$
Finally, use dd to copy the custom installer ISO image to a USB drive -- in this
example, /dev/sda
. Make sure that no partitions on the USB drive are mounted.
After copying the image, reboot the system and boot from the USB drive.
Edee$ time (sudo dd status=progress bs=4M if=my_ubuntu_install.iso of=/dev/sda && sync)
476+0 records in
476+0 records out
1996488704 bytes (2.0 GB, 1.9 GiB) copied, 135.596 s, 14.7 MB/s
real 2m15.610s
user 0m0.006s
sys 0m1.325s
Edee$ sudo reboot
Edee$
After booting the USB drive, the custom installer boot menu should be presented.
To debug the Ubuntu installer, add the DEBCONF_DEBUG=developer
option to the
installer boot command line.
Edee$ vi cd_image/boot/grub/grub.cfg
Edee$ grep -A 4 "Install Ubuntu" cd_image/boot/grub/grub.cfg
menuentry "Install Ubuntu" {
set gfxpayload=keep
linux /casper/vmlinuz DEBCONF_DEBUG=developer file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash ---
initrd /casper/initrd
}
Edee$
Build and boot the installer, and when the first installer screen is presented,
Use Ctrl-Atl-F2
to enter a virtual console. Log in with username "ubuntu".
Ubuntu 18.04.2 LTS ubuntu tty2
ubuntu login: ubuntu
Welcom to Ubuntu 18.04.2 LTS (GNU/Linux 4.18.0-15-generic x86_64)
.
.
.
ubuntu@ubuntu:~$
Installer debug logs will be written to /var/log/installer/debug
.
ubuntu@ubuntu:~$ more /var/log/installer/debug
Ubiquity 18.04.14.12
.
.
.
To automate the Ubiquity installer, add the automatic-ubiquity
option to the
installer boot command line. This causes Ubiquity to skip installer pages for
configuration options that have been specified in preseed files.
Additional preseed files can be specified with the file=
boot command line
option. In this example, the edee.seed
preseed file is added to the
installation and is configured to set the locale to en_US
.
Edee$ vi cd_image/preseed/edee.seed
Edee$ more cd_image/preseed/edee.seed
d-i debian-installer/locale string en_US
Edee$ vi cd_image/boot/grub/grub.cfg
Edee$ grep -A 4 "Install Ubuntu" cd_image/boot/grub/grub.cfg
menuentry "Install Ubuntu" {
set gfxpayload=keep
linux /casper/vmlinuz DEBCONF_DEBUG=developer automatic-ubiquity file=/cdrom/preseed/edee.seed file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash ---
initrd /casper/initrd
}
Edee$
Build and boot the installer. The installer locale screen should be skipped. In
addition, checking the installer boot logs should show that the
debian-installer/locale
setting has been seen and set to en_US
.
ubuntu@ubuntu:~$ sudo grep debian-installer/locale /var/log/boot.log
debconf (developer): <-- SET debian-installer/locale en_US
debconf (developer): <-- FSET debian-installer/locale seen true
ubuntu@ubuntu:~$