live-custom-ubuntu-from-scratch
live-custom-ubuntu-from-scratch copied to clipboard
Update xorriso paramters for 22.04
I have been doing a lot of trial and error in my own from scratch ubuntu project to get 22.04 working with bios installers without the use of isolinux and also to fix rufus persistent mode. My project is very different than yours and not publicly available yet but yours has been very helpful so I thought I would share what I have discovered.
As stated these flags should work without isolinux files (i am still using the folder name, i plan to change this) and enable both EFI/BIOS on a usb key while also getting Rufus ISO & Persistent mode to work again.
xorriso -as mkisofs -r \
-volid "${image_name}" \
-full-iso9660-filenames \
-J -J -joliet-long \
-output "../$output_name" \
--grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \
-partition_offset 16 \
--mbr-force-bootable \
-append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b isolinux/efiboot.img \
-appended_part_as_gpt \
-iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 \
-eltorito-boot isolinux/bios.img \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
--eltorito-catalog boot/grub/boot.cat \
--grub2-boot-info \
-eltorito-alt-boot \
-e '--interval:appended_partition_2:::' \
-no-emul-boot \
"."
Thanks @piexil , I will certainly take a look at this for the next regolith ISO release
After blindly copy/pasting got the following error (regolith ISO generation):
xorriso 1.5.4 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:/home/runner/work/regolith-ubuntu-iso-builder/regolith-ubuntu-iso-builder/scripts/Regolith.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 29.6g free
xorriso : WARNING : -volid text does not comply to ISO 9660 / ECMA 119 rules
Added to ISO image: directory '/'='/home/runner/work/regolith-ubuntu-iso-builder/regolith-ubuntu-iso-builder/scripts/image'
xorriso : UPDATE : 19 files added in 1 seconds
libisofs: FAILURE : Cannot find directory for El Torito boot catalog in ISO image: '/boot/grub'
libisofs: FAILURE : A requested node does not exist
xorriso : FAILURE : Could not attach El-Torito boot image to ISO 9660 image
xorriso : UPDATE : 19 files added in 1 seconds
xorriso : aborting : -abort_on 'FAILURE' encountered 'FAILURE'
@kgilmer
I think it's because the classic bios boot files need to be generated. The given parameter's are how most similar to how modern (>21.10) ubuntu builds their hybrid image.
As I said my project is different so this won't be exact copy-paste to this one, but here's the aprt of my scripts that generates the grub images and makes an ISO.
# # generate grub images
working_dir="$(pwd)"
cd "$iso_rw"
#grub uefi
grub-mkstandalone \
--format=x86_64-efi \
--output=isolinux/bootx64.efi \
--modules="part_gpt part_msdos" \
--locales="" \
--fonts="" \
"boot/grub/grub.cfg=isolinux/grub.cfg"
#fat16 uefi disk image containing bootloader
(
cd isolinux &&
dd if=/dev/zero of=efiboot.img bs=1M count=10 &&
sudo mkfs.vfat efiboot.img &&
LC_CTYPE=C mmd -i efiboot.img EFI EFI/BOOT &&
LC_CTYPE=C mcopy -i efiboot.img ./bootx64.efi ::EFI/BOOT/
)
#grub bios images
grub-mkstandalone \
--format=i386-pc \
--output=isolinux/core.img \
--install-modules="linux16 linux normal iso9660 biosdisk memdisk search tar ls" \
--modules="linux16 linux normal iso9660 biosdisk search" \
--locales="" \
--fonts="" \
"boot/grub/grub.cfg=isolinux/grub.cfg"
#combine
cat /usr/lib/grub/i386-pc/cdboot.img isolinux/core.img >isolinux/bios.img
# some broken UEFIs wont boot unless I do this
cp isolinux/efiboot.img EFI/BOOT/efiboot.img
cp isolinux/bios.img boot/grub/bios.img
cp isolinux/bootx64.efi EFI/BOOT/BOOTx64.EFI
cd "$working_dir"
LC_CTYPE=C mcopy -i ${iso_rw}/isolinux/efiboot.img -s ::EFI/ ${iso_rw}/EFI
# set seed files
cp installer/ubiquity/preseed/* "${iso_rw}/preseed/" || true
# this file will tell grub to look here
touch ${iso_rw}/$OS_NAME
# Regenerate the md5sum over the ISO contents.
working_dir="$(pwd)"
cd "$iso_rw"
rm md5sum.txt || true
/bin/bash -c "(find . -type f -print0 | xargs -0 md5sum | grep -v -e 'md5sum.txt' -e 'bios.img' -e 'efiboot.img' > md5sum.txt)"
cd "$working_dir"
working_dir="$(pwd)"
cd "$iso_rw"
# Create the ISO.
xorriso -as mkisofs -r \
-volid "${image_name}" \
-full-iso9660-filenames \
-J -J -joliet-long \
-output "../$output_name" \
--grub2-mbr /usr/lib/grub/i386-pc/boot_hybrid.img \
-partition_offset 16 \
--mbr-force-bootable \
-append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b isolinux/efiboot.img \
-appended_part_as_gpt \
-iso_mbr_part_type a2a0d0ebe5b9334487c068b6b72699c7 \
-eltorito-boot isolinux/bios.img \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
--eltorito-catalog boot/grub/boot.cat \
--grub2-boot-info \
-eltorito-alt-boot \
-e '--interval:appended_partition_2:::' \
-no-emul-boot \
"../${iso_rw}"
cd "$working_dir"
Thanks for the additional details @piexil . I am unable to determine what the following paths are set to in your setup as they don't exist in the mvallim
repo:
working_dir
iso_rw
I looked for a fork of yours to see the diff but didn't see one listed on the github forks page. LMK if I missed it. TIA
@kgilmer, I was able to following closely notes from piexil
without much effort and I'm now able to use only Grub
for both BIOS/Legacy
and UEFI
boot modes (in my own project, unrelated to this one and for a Debian-based Live CD).
Answers to your questions
-
working_dir
is just the parent directory from where all the commands get executed- You might have noticed that there are few "cd" commands implying a certain folder structure ("isolinux" folder, etc.)
- In my own project, I try to always use absolute paths, unless a relative path is required by programs (
xorriso
)
-
iso_rw
would be the directory containing all the files that will end up on the Live CD in layman terms
Other notes
- For the part "this file will tell grub to look here", you can just use labels in your
grub.cfg
and skip that part- The label needs to match the volume ID specified in the
xorriso
command "-volid" (i.e.-volid REGOLITH_LIVECD
) - The label in question would be in the
grub.cfg
file (i.e.search --set=root --label REGOLITH_LIVECD
)
- The label needs to match the volume ID specified in the
- For the part "some broken UEFIs wont boot unless I do this", I personally don't think that it's absolutely required
- My approach is just to capitalize
EFI
related files and folders - I believe is what most UEFI implementations assume capitalized files and folders names.
- My approach is just to capitalize
Example
This is not meant for a "blind copy paste", but to better understand what you might need for "regolith" specifically.
Scripted step resulting in the ISO image creation for my application called Entrusted