Score:1

How to Make Ubuntu Autoinstall ISO with Cloud-init in Ubuntu 21.10

uy flag

I have working 20.04 process where able to create the ISO file. Reference: https://gist.github.com/s3rj1k/55b10cd20f31542046018fcce32f103e

But if I an trying the same with ubuntu 21.10, few files are missing from extracted directory. Is there any major changes went in ubuntu 21.10?

Please help me to create the ISO with Cloud-init autoinstall.

Score:1
cn flag

TL;DR:

Use xorriso -indev ubuntu.iso -report_el_torito as_mkisofs to find out the options you need to rebuild the ISO after patching it.

Full steps:

This assumes you have a "ubuntu.iso" and will create a new "ubuntu-autoinstall.iso".

  1. Unpack the ISO with: mkdir new && bsdtar -C new -xf ubuntu.iso

    (install libarchive-tools to get bsdtar)

  2. Patch new/boot/grub/grub.cfg as follows:

    Modify set timeout=30 to set timeout=1

    Add a new menuentry on top of all others as follows:

    menuentry "autoinstall" {
       set gfxpayload=keep
       linux  /casper/vmlinuz quiet autoinstall ds=nocloud\;s=/cdrom/server/ ---
       initrd /casper/initrd
    }
    
  3. Add the cloud-init files as follows (the encrypted password is "ubuntu"):

    mkdir new/server
    touch new/server/meta-data
    cat << _EOF_ > new/server/user-data
    #cloud-config
    autoinstall:
      version: 1
      identity:
        hostname: ubuntu-server
        password: "$6$exDY1mhS4KUYCE/2$zmn9ToZwTKLhCw.b4/b.ZRTIZM30JZ4QrOQ2aOXJ8yk96xpcCof0kxKwuX1kqLG/ygbJ1f8wxED22bTL4F46P0"
        username: ubuntu
    
  4. Create a new ISO (the output of -report_el_torito for your ISO may differ; edit accordingly)

xorriso -as mkisofs --modification-date='2021101314195100' --grub2-mbr --interval:local_fs:0s-15s:zero_mbrpt,zero_gpt:'ubuntu.iso' --protective-msdos-label -partition_cyl_align off -partition_offset 16 --mbr-force-bootable -append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b --interval:local_fs:2470124d-2478587d::'ubuntu.iso' -part_like_isohybrid -iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 -c '/boot.catalog' -b '/boot/grub/i386-pc/eltorito.img' -no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info -eltorito-alt-boot -e '--interval:appended_partition_2_start_617531s_size_8464d:all::' -no-emul-boot -boot-load-size 8464 -isohybrid-gpt-basdat -o ubuntu-autoinstall.iso -V 'Ubuntu autoinstall' new/

Long version:

I started searching about subiquity, Ubuntu's new installer. I was particularly interested in finding out how they built the ISO, because I had the exact same problem you had! In its source code I came across make-edge-iso.sh which used something promising called livefs-editor. (I couldn't use that directly for what I wanted, but you'll see it offers a --add-autoinstall-config option that probably does exactly what we're after.) Digging through its code I came across the magic xorriso option "-report_el_torito as_mkisofs" which answered our questions! It attempts to tell you exactly how the ISO was built.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.