linux-unattended-installation
linux-unattended-installation copied to clipboard
Feature request: extend compatibility to Ubuntu server image
It works with netboot.iso perfectly thank you!
I tried to replace netboot.iso with ubuntu-18.04-server-amd64.iso but ran into two issues so far.
- The patching doesn't seem to work
- cat: /tmp/tmp.oEoTzfiQlV/initrd.gz: No such file or directory
Not sure what is going on.
@tachang Sadly the structure of ubuntu-18.04-server-amd64.iso
is not the same. The preseed
file itself might work (not tested), but the scripts generating the ISO are not compatible at the moment. I will have a look and get back to you.
I'm also looking as well. I just want to speed things up a bit (I guess next thing to look at is hosting the packages locally). It would be really nice though to have them in the iso already.
Thanks so much!
@tachang I adjusted the script. It works fine. See the ubuntu/18.04/build-iso-server-image.sh
script which is part of the feature/ubuntu-server-image
branch.
# clone branch feature/ubuntu-server-image
git clone -b feature/ubuntu-server-image https://github.com/core-process/linux-unattended-installation.git
# build iso based on server image
./linux-unattended-installation/ubuntu/18.04/build-iso-server-image.sh
We do not need to apply the patch for the boot menu, because the server image has a boot timeout of 30 seconds by default. Do not be confused by the language selection dialog of the boot manager. The countdown gets triggered anyway.
Here you can see the differences between the build-iso.sh
and the build-iso-server-image.sh
script formatted as patch file:
--- ./linux-unattended-installation/ubuntu/18.04/build-iso.sh
+++ ./linux-unattended-installation/ubuntu/18.04/build-iso-server-image.sh
@@ -3,7 +3,7 @@
# get parameters
SSH_PUBLIC_KEY_FILE=${1:-"$HOME/.ssh/id_rsa.pub"}
-TARGET_ISO=${2:-"`pwd`/ubuntu-18.04-netboot-amd64-unattended.iso"}
+TARGET_ISO=${2:-"`pwd`/ubuntu-18.04-server-amd64-unattended.iso"}
# check if ssh key exists
if [ ! -f "$SSH_PUBLIC_KEY_FILE" ];
@@ -19,15 +19,11 @@
TMP_DISC_DIR="`mktemp -d`"
TMP_INITRD_DIR="`mktemp -d`"
-# download and extract netboot iso
-SOURCE_ISO_URL="http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/mini.iso"
+# download and extract server iso
+SOURCE_ISO_URL="http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04-server-amd64.iso"
cd "$TMP_DOWNLOAD_DIR"
-wget -4 "$SOURCE_ISO_URL" -O "./netboot.iso"
-7z x "./netboot.iso" "-o$TMP_DISC_DIR"
-
-# patch boot menu
-cd "$TMP_DISC_DIR"
-patch -p1 -i "$SCRIPT_DIR/custom/boot-menu.patch"
+wget -4 "$SOURCE_ISO_URL" -O "./server.iso"
+7z x "./server.iso" "-o$TMP_DISC_DIR"
# prepare assets
cd "$TMP_INITRD_DIR"
@@ -38,15 +34,15 @@
# append assets to initrd image
cd "$TMP_INITRD_DIR"
-cat "$TMP_DISC_DIR/initrd.gz" | gzip -d > "./initrd"
+cat "$TMP_DISC_DIR/install/initrd.gz" | gzip -d > "./initrd"
echo "./preseed.cfg" | fakeroot cpio -o -H newc -A -F "./initrd"
find "./custom" | fakeroot cpio -o -H newc -A -F "./initrd"
-cat "./initrd" | gzip -9c > "$TMP_DISC_DIR/initrd.gz"
+cat "./initrd" | gzip -9c > "$TMP_DISC_DIR/install/initrd.gz"
# build iso
cd "$TMP_DISC_DIR"
rm -r '[BOOT]'
-mkisofs -r -V "ubuntu 18.04 netboot unattended" -cache-inodes -J -l -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -input-charset utf-8 -o "$TARGET_ISO" ./
+mkisofs -r -V "ubuntu 18.04 server unattended" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -input-charset utf-8 -o "$TARGET_ISO" ./
# go back to initial directory
cd "$CURRENT_DIR"
Wow. Trying this out now!
Is there a way to reduce the 30s? I assume it would be in the preseed?
@tachang in that case we need to add a slightly modified boot-menu.patch
. The timeout is encoded in the isolinux/isolinux.cfg
.
Quick question, is there any particular reason for building the server image? I find the netboot image works fine for creating servers where I install what I want and nothing more. Is it just to have the included deb packages included in the new image?
The server image saves bandwidth and gets the OS up and running much faster than having to download things. With the netboot one you if you have a bunch of machines you want to bring up at the same time it can really bring the network to it's knees (depending on how good your network is).
A proxy cache server can help the netboot image if you're doing a bunch at once, it also ensures you get the latest packages everytime the installer is ran. :)
Consider this approach to lookup the newest server iso images: https://github.com/core-process/linux-unattended-installation/issues/11
It would be nice to also extend the hybrid iso functionnality to this branch, I didn't find a way to use xorriso within the build-iso-server-image.sh script
I managed to get xorriso working with the server image I had with those following commands added to the script
# create the mbr binary from the downloaded iso
sudo dd if=ubuntu-18.04.1-server-amd64.iso bs=512 count=1 of=custom_isohdpfx.bin
# use xorriso to create the iso
xorriso -as mkisofs -r -V "ubuntu_1804_netboot_unattended" -J -b isolinux/isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -input-charset utf-8 -isohybrid-mbr "$CURRENT_DIR"/custom_isohdpfx.bin -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -o "$TARGET_ISO" ./
# add the following block the to preseed.cfg file
### Do NOT install on the USB stick(!)
#
# The Debian installer will install on the first disk it finds which can
# sometimes be the USB stick itself. Work around this by rolling our own auto
# detect logic which disallows installing on USB devices.
d-i partman/early_command string \
USBDEV_LIST="$(mktemp)"; \
list-devices usb-partition | sed "s/\(.*\)./\1/" > "$USBDEV_LIST"; \
BOOTDEV="$(list-devices disk | grep -vf "$USBDEV_LIST" | head -n 1)"; \
debconf-set partman-auto/disk "$BOOTDEV"; \
debconf-set grub-installer/bootdev "$BOOTDEV"; \
while /bin/true; do sleep 0.01; rm -f /target/etc/grub.d/30_os-prober; done &
Hopefully this will be useful for someone who wants to achieve the same goal