{"id":2919,"date":"2024-10-07T12:34:12","date_gmt":"2024-10-07T11:34:12","guid":{"rendered":"https:\/\/www.robert-oswald.de\/blog\/?p=2919"},"modified":"2025-03-30T13:51:01","modified_gmt":"2025-03-30T12:51:01","slug":"create-an-ubuntu-autoinstall-iso-image","status":"publish","type":"post","link":"https:\/\/www.robert-oswald.de\/blog\/?p=2919","title":{"rendered":"Create an Ubuntu 24.04 Desktop Autoinstall ISO Image"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites<\/h3>\n\n\n\n<p><code>apt install 7zip xorriso whois<\/code><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"unpack-files-and-partition-images-from-iso\">Unpack Files and Partition Images from ISO<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir autoinstall-iso\ncd autoinstall-iso\n7z -y x ~\/Downloads\/ubuntu-24.04.1-desktop-amd64.iso\nmv \\&#91;BOOT\\] ..\/BOOT\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"edit-the-iso-grubcfg-file\">Edit the ISO grub.cfg file<\/h3>\n\n\n\n<p>Set grub timeout to 3s.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>set timeout=3\n<\/code><\/pre>\n\n\n\n<p>Add new menu entry above existing menu entries in <code>autoinstall-iso\/boot\/grub\/grub.cfg<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>menuentry \"Autoinstall Ubuntu\" {\n        set gfxpayload=keep\n        linux   \/casper\/vmlinuz  --- quiet splash autoinstall ds=nocloud\\;s=\/cdrom\/autoinstall\/\n        initrd  \/casper\/initrd\n}\n<\/code><\/pre>\n\n\n\n<p>This menue entry adds the autoinstall kernel directive and the &#8220;data source&#8221; (ds) for cloud-init of type &#8220;nocloud&#8221;. <code>s=\/cdrom\/autoinstall\/<\/code> is reference to the directory where we will add <code>user-data<\/code> and <code>meta-data<\/code> files that contain the installer configuration yaml. <code>\/cdrom<\/code> is the top level directory of the ISO.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"create-autoinstall-directory-and-files\">Create Autoinstall Directory and Files<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir autoinstall\ntouch autoinstall\/meta-data\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"generate-password-hash\">Generate Password Hash<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>echo start123 | mkpasswd -s\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"autoinstalluser-data\">autoinstall\/user-data<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>#cloud-config\nautoinstall:\n  version: 1\n  source:\n    id: ubuntu-desktop-minimal\n  identity:\n    hostname: autoinstall\n    password: $y$j9T$MYuc23vJIEA6BBnpY1y001$0FMBxaFV\/5xumNOTq9o.AG68KRe9wVYhvVoSUsi75L2\n    username: erwin\n  locale: en_US.UTF-8\n  keyboard:\n    layout: de\n    variant: nodeadkeys\n  storage:\n    layout:\n      name: lvm\n      sizing-policy: all\n      password: start123\n      match:\n        size: largest  \n  timezone: Europe\/Berlin\n  packages:\n    - ansible\n    - sshpass\n    - bzip2\n  ssh:\n    install-server: true\n    allow-pw: true\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"generate-a-new-autoinstall-iso\">Generate a new Autoinstall ISO<\/h3>\n\n\n\n<p>The following command is helpful when trying to setup the arguments for building an ISO. It will give flags and data to closely reproduce the source base install ISO.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xorriso -indev ~\/Downloads\/ubuntu-24.04.1-desktop-amd64.iso -report_el_torito as_mkisofs\n<\/code><\/pre>\n\n\n\n<p>Editing the report to come up with the command for creating the autoinstall ISO.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>xorriso -as mkisofs -f \\\n-V 'Ubuntu 24.04.1 LTS AUTOINSTALL' \\\n-o ..\/ubuntu-24.04.1-desktop-autoinstall-amd64.iso \\\n--grub2-mbr ..\/BOOT\/1-Boot-NoEmul.img \\\n-partition_offset 16 \\\n--mbr-force-bootable \\\n-append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b ..\/BOOT\/2-Boot-NoEmul.img \\\n-appended_part_as_gpt \\\n-iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 \\\n-c '\/boot.catalog' \\\n-b '\/boot\/grub\/i386-pc\/eltorito.img' \\\n-no-emul-boot \\\n-boot-load-size 4 \\\n-boot-info-table \\\n--grub2-boot-info \\\n-eltorito-alt-boot \\\n-e '--interval:appended_partition_2:::' \\\n-no-emul-boot \\\n.\n<\/code><\/pre>\n\n\n\n<p>Based on this article:<br><a href=\"https:\/\/www.pugetsystems.com\/labs\/hpc\/ubuntu-22-04-server-autoinstall-iso\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.pugetsystems.com\/labs\/hpc\/ubuntu-22-04-server-autoinstall-iso\/<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisites apt install 7zip xorriso whois Unpack Files and Partition Images from ISO Edit the ISO grub.cfg file Set grub timeout to 3s. Add new menu entry above existing menu entries in autoinstall-iso\/boot\/grub\/grub.cfg. This menue entry adds the autoinstall kernel directive and the &#8220;data source&#8221; (ds) for cloud-init of type &#8220;nocloud&#8221;. s=\/cdrom\/autoinstall\/ is reference to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","ngg_post_thumbnail":0,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-2919","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2919"}],"version-history":[{"count":7,"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2919\/revisions"}],"predecessor-version":[{"id":3056,"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2919\/revisions\/3056"}],"wp:attachment":[{"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2919"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2919"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.robert-oswald.de\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}