home | list info | list archive | date index | thread index

Re: $100 bounty for resolving my issue for creating bootable USB drive

Hey Robert,

Saw your email about the Ubuntu ISO.

Please try this way, I think it will work: [Link to the solution steps]

Let me know.

Best,

Qingwei


Step 1: Set Up Your Workspace

First, create a workspace, unpack the ISO’s file content, and extract the
specific boot files needed by xorriso.

# 1. Create directories for your workmkdir -p
ubuntu-custom/iso_contentsmkdir -p ubuntu-custom/boot_files
# 2. Define the original ISO path
ORIGINAL_ISO="ubuntu-24.04.3-live-server-amd64.iso"
# 3. Unpack the ISO contents using bsdtar (it handles rock ridge, etc.
well)# Using 'mount -o loop' is not sufficient as it doesn't expose
the boot images.
bsdtar -C ubuntu-custom/iso_contents -xf "$ORIGINAL_ISO"
# 4. Extract the MBR boot code template from the original ISOdd
if="$ORIGINAL_ISO" bs=1 count=432
of=ubuntu-custom/boot_files/isohdpfx.bin

------------------------------
Step 2: The xorriso Command to Rebuild the ISO

This is the critical step. The following command tells xorriso to rebuild
the ISO while embedding all the necessary boot information for BIOS and
UEFI systems. Run this from the ubuntu-custom directory.

# Change into the working directorycd ubuntu-custom/
# The magic incantation
xorriso -as mkisofs \
  -r \
  -V "Ubuntu 24.04.3 LTS" \
  --grub2-mbr boot_files/isohdpfx.bin \
  --protective-msdos-label \
  -partition_offset 16 \
  --mbr-force-bootable \
  -append_partition 2 0xef iso_contents/boot/grub/efi.img \
  -appended_part_as_gpt \
  -iso_mbr_part_type 0x00 \
  -c boot/boot.cat \
  -b boot/grub/i386-pc/eltorito.img \
  -no-emul-boot -boot-load-size 4 -boot-info-table --grub2-boot-info \
  -eltorito-alt-boot \
  -e boot/grub/efi.img \
  -no-emul-boot \
  -o ../rebuilt-ubuntu-server.iso \
  iso_contents/

------------------------------
Step 3: Create the Bootable USB

Once the rebuilt-ubuntu-server.iso is created, write it to your USB drive
using dd.

   1. Identify your USB drive with lsblk. Be *absolutely certain* of the
   device name (e.g., /dev/sdc). Using the wrong device will destroy data.
   2. Write the ISO to the drive.

# Replace /dev/sdX with your actual USB device namesudo dd
if=../rebuilt-ubuntu-server.iso of=/dev/sdX bs=4M status=progress
oflag=sync

The oflag=sync flag ensures all data is physically written before the
command returns. The resulting USB drive should now be recognized as
bootable by your appliances.
------------------------------

On Fri, Aug 22, 2025 at 4:45 PM Dnkorovkin via linux <linux [ at ] linux-ottawa [ dot ] org>
wrote:

> Hi Robert.
> I am quite busy at the moment to try it, but the general idea of it is:
> 1. mount the disk image with mount -o loop
> 2. cp -a source to usb
> 3. Run syslinux to make bootable USB drive.
>
> Hope this helps,
>
> Dmitriy
>
> -------- Original message --------
> From: "Robert P. J. Day via linux" <linux [ at ] linux-ottawa [ dot ] org>
> Date: 2025-08-22 16:00 (GMT-05:00)
> To: OCLUG mailing list <linux [ at ] linux-ottawa [ dot ] org>
> Subject: [linux] $100 bounty for resolving my issue for creating bootable
> USB drive
>
>
>   i will recap the fight i am currently having in trying to create a
> bootable USB drive from Ubuntu Server 24.04.3 ["24.04"], and i will
> interac $100 to the first person who can solve the problem i am about
> to describe. (i will start writing this up in detail at my
> crashcourse.ca wiki, but i'll supply enough here that you will have
> enough information to take a crack at it.)
>
>   previously, i described how i want to customize a 24.04 ISO image to
> add some autoinstall configuration, but the problem here is way
> simpler -- i just want to take that original ISO and turn it into a
> bootable USB drive *as is*. but wait ... there's more.
>
>   if i just want an equivalent bootable USB drive from the ISO image,
> well, that's trivial -- just "dd" from the ISO image to the USB drive.
> that works just fine and, when i do that, the USB drive is recognized
> by two different appliances i'm playing with when i go into the BIOS
> on either appliance, go top the "Boot" menu, and i can see that both
> BIOSes list the USB drive as a boot option. in short, those USB drives
> are visible as bootable devices. and that's what i'm after.
>
>   but i don't just want to use "dd" -- that's too easy. rather, i want
> to take the 24.04 ISO image and *unpack* it ("mount -o loop",
> "bsdtar", whatever) to get the directory structure, which is where i
> would add the autoinstall stuff, but i want to keep it simple, and
> after i unpack the ISO image, i'm happy to *immediately* pack it up
> again (unchanged) to get the equivalent bootable ISO image. then i can
> "dd" that to a USB drive and boot from that.
>
>   that's it -- i want to take canonical's 24.04 ISO image, unpack it
> (however you want), then recreate a bootable ISO image from that (most
> likely with "xorriso"), dd to USB drive and boot from that. and from
> my poking around, it seems like the work involves invoking "xorriso"
> with all of the appropriate options, a good example seen here:
>
>
> https://www.reddit.com/r/Ubuntu/comments/1g0cq09/how_to_create_a_custom_ubuntu_24041_image_by/
>
> that makefile ostensibly does what i want, except we can ignore all
> the cloud-init stuff since i don't want to make any changes, and the
> real work is done by the "ubuntu" target, which runs "xorriso" with a
> truckload of options in order to recreate a bootable ISO image.
>
>   i used something very much like that but, no matter how i tweak it,
> once i recreate an ISO image and copy to USB drive, neither appliance
> recognizes that USB drive as a boot option, so i am clearly
> overlooking something critical.
>
>   there's the $100 bounty -- figure out the magic incantation of
> "xorriso" that allows me to do the above:
>
>   1) start with canonical 24.04.3 ubuntu server image
>   2) unpack into directory structure
>   3) use xorriso to immediately repack into bootable ISO image
>   4) copy to USB drive, and boot from that USB drive
>
> i've played with those options all morning and haven't succeeded.
> thoughts?
>
> rday
>
> To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
> To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
> To visit the archives: https://lists.linux-ottawa.org
>
>