From LedHed's Wiki
Jump to: navigation, search
(Created page with "== Overview == This article will explain how to create a custom USB Boot disk for automatic installation of Ubuntu 22.04 including an answer file. == Quick-n-Dirty == === In...")
 
(No difference)

Latest revision as of 15:01, 24 August 2022

Overview

This article will explain how to create a custom USB Boot disk for automatic installation of Ubuntu 22.04 including an answer file.


Quick-n-Dirty

Installation Media

Partition USB stick into 2 pieces
Partition 1 = 16M, EFI, Format FAT32
Partition 2 = 4G, MS Dos, Format FAT32


Mount Partition 2 (make sure to use the right device, you can check with lsblk)

mount /dev/sdb2 /mnt


Extract ISO to Partition 2

7z -y x ubuntu-22.04.1-live-server-amd64.iso -o/mnt


Edit /mnt/boot/grub/grub.cfg Add these lines after the end of the first 'menuentry'

menuentry "Auto Install Ubuntu Server" {
        set gfxpayload=keep
        linux   /casper/vmlinuz autoinstall quiet  ---
        initrd  /casper/initrd
}


Update /mnt/md5sum.txt

cd /mnt
md5sum ./boot/grub/grub.cfg >> /mnt/md5sum.txt

Remember to delete the old grub.cfg line.


Create an efi directory under /mnt/boot/:

mkdir /mnt/boot/efi


Mount Partition 1

mount /dev/sdb1 /mnt/boot/efi


Install grub on Partition 2 (this assumes the system is x64 UEFI):

grub-install --boot-directory=/mnt/boot /dev/sdb2


Unmount Partition 1, then Partition 2

umount /mnt/boot/efi
umount /mnt


Answer File Media

Generate a user-data file, this is most easily done by copying one from a manual installation. This file can be found at:

/var/log/install/autoinstall-user-data


Generate a meta-data file, this file is typically empty.

touch meta-data


Create the answer-file.iso

cloud-localds ./answer_file.iso user-data meta-data


Burn answer-file.iso to a USB stick.


Unmount the Answer File USB stick


Boot it!

Insert the newly created Installation USB stick and invoke your system's boot menu (F11 perhaps).

  • Highlight Partition 2
  • Insert the Answer File Media
  • Press [Enter]

The system should install unattended including the network settings, user credentials, and packages you selected when generating the user-data file on the manual installation.


Reference

https://ubuntu.com/server/docs/install/autoinstall
https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
https://github.com/covertsh/ubuntu-autoinstall-generator/blob/main/ubuntu-autoinstall-generator.sh#L249
https://linuxconfig.org/ubuntu-autoinstall-example
https://gist.github.com/jamiekurtz/26c46b3e594f8cdd453a