Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 22.04 #30

Open
cantoni opened this issue Apr 14, 2022 · 26 comments
Open

Support for 22.04 #30

cantoni opened this issue Apr 14, 2022 · 26 comments

Comments

@cantoni
Copy link

cantoni commented Apr 14, 2022

Hi folks! I've been trying, unsucessfully, to modify this script to install beta versions of Jammy Jellyfish. The release candidate should be out today — any chance this will be updated for 22.04 support?

@NetForces
Copy link

Just tried it on 22.04 and it fails here:

courchea@X1-Andre:{11:46}~/Documents/test ➭ bash ubuntu-autoinstall-generator.sh -a -u user-data.example -d ubuntu-autoinstall-example.iso -s ~/Downloads/ubuntu-22.04-live-server-amd64.iso -k

[2022-04-22 11:46:49] 👶 Starting up...
[2022-04-22 11:46:49] 📁 Created temporary working directory /tmp/tmp.M60p1w7NFE
[2022-04-22 11:46:49] 🔎 Checking for required utilities...
[2022-04-22 11:46:49] 👍 All required utilities are installed.
[2022-04-22 11:46:49] ☑️ Using existing /home/courchea/Downloads/ubuntu-22.04-live-server-amd64.iso file.
[2022-04-22 11:46:49] 🤞 Skipping verification of source ISO.
[2022-04-22 11:46:49] 🔧 Extracting ISO image...
[2022-04-22 11:46:50] 👍 Extracted to /tmp/tmp.M60p1w7NFE
[2022-04-22 11:46:50] 🧩 Adding autoinstall parameter to kernel command line...
sed: can't read /tmp/tmp.M60p1w7NFE/isolinux/txt.cfg: No such file or directory
[2022-04-22 11:46:51] 🚽 Deleted temporary working directory /tmp/tmp.M60p1w7NFE

@NetForces
Copy link

It's far from perfect but I was able to generate a 22.04 Server ISO with the following modifications:

diff --git a/ubuntu-autoinstall-generator.sh b/ubuntu-autoinstall-generator.sh
index 5229d83..8b3f1f0 100644
--- a/ubuntu-autoinstall-generator.sh
+++ b/ubuntu-autoinstall-generator.sh
@@ -228,7 +228,9 @@ if [ ${use_hwe_kernel} -eq 1 ]; then
 fi
 
 log "🧩 Adding autoinstall parameter to kernel command line..."
-sed -i -e 's/---/ autoinstall  ---/g' "$tmpdir/isolinux/txt.cfg"
+if [ -e $tmpdir/isolinux/txt.cfg ]; then
+        sed -i -e 's/---/ autoinstall  ---/g' "$tmpdir/isolinux/txt.cfg"
+fi
 sed -i -e 's/---/ autoinstall  ---/g' "$tmpdir/boot/grub/grub.cfg"
 sed -i -e 's/---/ autoinstall  ---/g' "$tmpdir/boot/grub/loopback.cfg"
 log "👍 Added parameter to UEFI and BIOS kernel command lines."
@@ -242,7 +244,9 @@ if [ ${all_in_one} -eq 1 ]; then
         else
                 touch "$tmpdir/nocloud/meta-data"
         fi
-        sed -i -e 's,---, ds=nocloud;s=/cdrom/nocloud/  ---,g' "$tmpdir/isolinux/txt.cfg"
+        if [ -e $tmpdir/isolinux/txt.cfg ]; then
+                sed -i -e 's,---, ds=nocloud;s=/cdrom/nocloud/  ---,g' "$tmpdir/isolinux/txt.cfg"
+        fi
         sed -i -e 's,---, ds=nocloud\\\;s=/cdrom/nocloud/  ---,g' "$tmpdir/boot/grub/grub.cfg"
         sed -i -e 's,---, ds=nocloud\\\;s=/cdrom/nocloud/  ---,g' "$tmpdir/boot/grub/loopback.cfg"
         log "👍 Added data and configured kernel command line."
@@ -263,7 +267,7 @@ fi
 
 log "📦 Repackaging extracted files into an ISO image..."
 cd "$tmpdir"
-xorriso -as mkisofs -r -V "ubuntu-autoinstall-$today" -J -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -boot-info-table -input-charset utf-8 -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -o "${destination_iso}" . &>/dev/null
+xorriso -as mkisofs -r -V "ubuntu-autoinstall-$today" -c boot.cat -no-emul-boot -boot-load-size 4 -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -boot-info-table -eltorito-alt-boot -no-emul-boot -isohybrid-gpt-basdat -b '/boot/grub/i386-pc/eltorito.img' -o "${destination_iso}" . &>/dev/null
 cd "$OLDPWD"
 log "👍 Repackaged into ${destination_iso}"

And the following command line:

bash ubuntu-autoinstall-generator.sh -a -u user-data.example -d ubuntu-autoinstall-example.iso -s ~/Downloads/ubuntu-22.04-live-server-amd64.iso --no-verify --all-in-one

@dcd-arnold
Copy link

The script completes successfully. However, if I dd the resulting .iso to an thumb-drive and try to boot from it, it fails.

@Benjoban
Copy link

I would also really like this for ubuntu 22.04, any help getting it up and working :-)
kind regards Ben

@eddie4
Copy link

eddie4 commented May 16, 2022

Can confirm that the solution that @NetForces posted works. We use Idrac & NFS to mount iso's. Perhaps there are some flags you are missing when making your usb bootable @dcd-arnold.

@dcd-arnold
Copy link

Hi @eddie4,

I do nothing else than dd the resulting iso to an usb stick and try to boot from my boot manager. It works with the original iso, but not with the result form the script. I would expect it to work just like the original iso. I am not sure what flags you mean. I run the script like shown above:

bash ubuntu-autoinstall-generator.sh -a -u user-data.example -d ubuntu-autoinstall-example.iso -s ~/Downloads/ubuntu-22.04-live-server-amd64.iso --no-verify --all-in-one

@NetForces
Copy link

@eddie4 try adding back the -J in the xorriso line:

xorriso -as mkisofs -J -r -V "ubuntu-autoinstall-$today" -c boot.cat -no-emul-boot -boot-load-size 4 -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -boot-info-table -eltorito-alt-boot -no-emul-boot -isohybrid-gpt-basdat -b '/boot/grub/i386-pc/eltorito.img' -o "${destination_iso}" . &>/dev/null

I may have time to try it myself today as having it working on a USB key is also my goal.

@NetForces
Copy link

Ok so far no luck in generating a working USB key...
Found this post that probably contains the key but no luck yet https://askubuntu.com/questions/1404757/create-custom-ubuntu-22-04-live-server-iso

@cantoni
Copy link
Author

cantoni commented May 17, 2022

I've run into the same problem @dcd-arnold is facing — I can get a modified version of the script to run, but the resulting USB key (made using Etcher) won't boot a physical machine. It won't even try to boot.

If I install the unmodified 22.04 ISO on a USB key it boots as expected.

@Gertm
Copy link

Gertm commented May 17, 2022

With the patch by @NetForces I can get a working USB stick. Just don't use Etcher, I've had bad experiences with that as well. Rufus (in Windows) does it flawlessly. Haven't tried dd yet.

@dcd-arnold
Copy link

@Gertm are you booting to boot a BIOS (or UEFI with legacy support) or an UEFI machine? I try to boot UEFI.

@Gertm
Copy link

Gertm commented May 17, 2022

@dcd-arnold I'm booting a UEFI machine. I have the user-data file on a webserver so I can easily change it without having to remake the ISO all the time.

@dcd-arnold
Copy link

@Gertm I copy it onto the iso with the command above. That seems to be the difference.

@NetForces
Copy link

@Gertm Your comment about Rufus vs Etcher is interesting.

On my side, I have been using dd as my final solution needs to be 100% Linux. I will give it a try to see if I have the same result.

@NetForces
Copy link

Ok I confirm that the same generated ISO works when using Rufus to copy it to a USB thumb drive and fails when using dd

So Rufus is doing some kind of changes. I'll compare a USB key made with the 2 methods and see if I can find out what is done.

@NetForces
Copy link

So the contect of the Rufus generated USB thumb drive and the dd one appears identical. However the generated partition is different:

dd:

Disk model: Flash Disk      
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2d13944a

Device     Boot Start     End Sectors  Size Id Type
/dev/sda1  *        0 2877951 2877952  1.4G  0 Empty
/dev/sda2         688     744      57 28.5K ef EFI (FAT-12/16/32)

Rufus:

Disk /dev/sdb: 7.34 GiB, 7885291520 bytes, 15400960 sectors
Disk model: JumpDrive       
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00026ff6

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdb1  *     2048 15400959 15398912  7.3G  c W95 FAT32 (LBA)

@NetForces
Copy link

Ok partial success or failure.... I found these projects:

I took mix parts of these 2 projects. The resulting xorriso command is (with 2 added dd lines to extract data from the source ISO):

dd if=${source_iso} bs=1 count=432 of=$tmpdir/boot/boot_hybrid.img
dd if=${source_iso} bs=512 skip=`fdisk -l ${source_iso} | grep iso2 | cut -f 2 -d ' '` count=8496 of=$tmpdir/boot/efi.img

xorriso -as mkisofs -r \
    -V "ubuntu-autoinstall-$today" \
    -o ${destination_iso} \
    --grub2-mbr boot/boot_hybrid.img \
    -partition_offset 16 \
    --mbr-force-bootable \
    -append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b boot/efi.img \
    -appended_part_as_gpt \
    -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:::' \
    -no-emul-boot \
    ./

(I don't claim to understand all the options in that command line, I just adapted it to the ubuntu-autoinstall-generator.sh script environment)

With the resulting ISO (copied to a USB thumb drive with dd or used an an ISO over IPMI) I was able to boot on it and get the "Try or Install Ubuntu Server" grub option. But then I get stuck with:

image

@eNBeWe
Copy link

eNBeWe commented May 28, 2022

I gave it my best shot and greated the pull request #33
I tested all four possible combinations (focal-daily, focal-release, jammy-daily, jammy-release) in a virtual machine.
What I haven't done yet, is dumping the images to a usb stick and trying from there, since I don't have test-devices with me right now.

@cloudymax
Copy link

cloudymax commented May 31, 2022

Isolinux got deprecated starting 20.10 but looks like a solution has been outlined here: https://askubuntu.com/questions/1289400/remaster-installation-image-for-ubuntu-20-10

I haven't had time to test though

EDIT:
It looks like the author is no-longer maintaining this project, so I have created a fork and added support for 20.10+ images, added a dockerized env, as well as automated builds with github actions. If you're still stuck here in Aug 2022 here's my best attempt at helping: https://github.com/cloudymax/pxeless

@majidalikhan8baader
Copy link

I gave it my best shot and greated the pull request #33 I tested all four possible combinations (focal-daily, focal-release, jammy-daily, jammy-release) in a virtual machine. What I haven't done yet, is dumping the images to a usb stick and trying from there, since I don't have test-devices with me right now.

I followed your updated version for 22.04, I booted the iso on a usb using rufus and tried to run the ubuntu but it just gets stuck and boot screen and doesn't go beyond. Did I miss something or is there something in addition to what I have to do?

@eNBeWe
Copy link

eNBeWe commented Mar 10, 2023

I followed your updated version for 22.04, I booted the iso on a usb using rufus and tried to run the ubuntu but it just gets stuck and boot screen and doesn't go beyond. Did I miss something or is there something in addition to what I have to do?

To be honest, I can't remember. I switched to using pxeless (see a few comments up) and have not maintained any interest in this project anymore.

@majidalikhan8baader
Copy link

majidalikhan8baader commented Mar 10, 2023

I followed your updated version for 22.04, I booted the iso on a usb using rufus and tried to run the ubuntu but it just gets stuck and boot screen and doesn't go beyond. Did I miss something or is there something in addition to what I have to do?

To be honest, I can't remember. I switched to using pxeless (see a few comments up) and have not maintained any interest in this project anymore.

Thank you for your reply and mention of pxeless as this actually helped solve my issue and I was able to generate the iso.

@agusserraa98
Copy link

Hi @majidalikhan8baader, can you tell me how you solved it? Did you achieve it only with the pxeless project?

@majidalikhan8baader
Copy link

majidalikhan8baader commented Mar 13, 2023

Hi @majidalikhan8baader, can you tell me how you solved it? Did you achieve it only with the pxeless project?

@agusserraa98 Since I needed the ISO only, I shifted my concentration to the pxeless project and it was quite easier and properly documented. So, this helped and yes I was able to achieve it only using pxeless project.

@agusserraa98
Copy link

Great, use the Pexels project and it's really good, very well documented. Thank you

@koenvandesande
Copy link

I recommend PXEless as well instead of this project: https://github.com/cloudymax/pxeless/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests