2

I am trying to build an ISO that can also boot from a USB drive, using the isohybrid utility on RedHat 7.7. But when I try booting from the generated USB media, my target system says "media not found" (both when using legacy BIOS booting, and when using UEFI). Using a downloaded bootable ISO image on the same USB media and same target system, it works. That rules out a hardware problem with the USB stick.

I have also in the past successfully built hybrid ISO images.

The goal is to build a generic boot image for Satellite Server 6.5, as documented here: https://access.redhat.com/articles/3464601 (link is behind a login)

After testing and ruling out most of my other theories, I am focusing mostly on the isohybrid --uefi command.

What I have already done:

  • test the generated ISO as a CD image using VirtualBox. It appears to boot without a problem both in legacy and UEFI mode.
  • reduce the size of the efiboot.img file from 64MB suggested in RedHat's article to 2MB; apparently, isohybrid had a problem with a 64MB image.
  • Insert the USB media and see if the partitions can be mounted. No problem.
  • inspect the partition tables (both MBR and GPT) that isohybrid generated, and compare with a known-working image. I did not find any significant differences. As expected, the main image partition is marked as bootable.
  • inspect the MBR that isohybrid added. Again, no significant differences that I could tell.
  • Added the --eltorito-platform 0xEF option to mkisofs (the default seems to be 0x07). That probably does not make any difference as the working ISO images also use 0x07.

At this point, I'm at a loss what else I could try and why my target system does not see the media as bootable.

fdisk shows the following partition table:

You must set cylinders.
You can do this from the extra functions menu.
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk generic-boot-usb.iso: 4 MB, 4194304 bytes, 8192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x6233e677

               Device Boot      Start         End      Blocks   Id  System
generic-boot-usb.iso1   *           0        8191        4096    0  Empty
generic-boot-usb.iso2             148        4243        2048   ef  EFI (FAT-12/16/32)

And the GPT partition table reported by gdisk:

Command (? for help): p
Disk generic-boot-usb.iso: 8192 sectors, 4.0 MiB
Logical sector size: 512 bytes
Disk identifier (GUID): E3E66CDD-C58D-45C0-BA06-06D20DFABD21
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 8158
Partitions will be aligned on 4-sector boundaries
Total free space is 30 sectors (15.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   2             148            4243   2.0 MiB     0700  I

Here is the complete script:

#!/bin/bash

OUTDIR=${PWD}
OUTFILE_CD=${OUTDIR}/generic-boot-cd.iso
OUTFILE_USB=${OUTDIR}/generic-boot-usb.iso
DIR=${PWD}/Generic_Boot
CDROOT=${DIR}/CD_Root

sudo yum install gcc xz-devel dosfstools syslinux genisoimage

mkdir -p ${DIR}
cp generic-boot-script ${DIR}/script
cp generic-boot-isolinux-cfg ${DIR}/isolinux.cfg
pushd ${DIR}
 git clone git://git.ipxe.org/ipxe.git


 pushd ${DIR}/ipxe/src
  make clean
  make bin/ipxe.lkrn
  make bin-x86_64-efi/ipxe.efi EMBED=${DIR}/script
 popd

 dd if=/dev/zero of=${DIR}/efiboot.img bs=1024 count=2048
 mkfs.fat -s1 -F32 ${DIR}/efiboot.img

 mkdir -p efiboot
 sudo mount -o loop efiboot.img efiboot
 sudo mkdir -p efiboot/EFI/BOOT
 sudo rm -f efiboot/EFI/BOOT/BOOTX64.EFI
 sudo cp ipxe/src/bin-x86_64-efi/ipxe.efi efiboot/EFI/BOOT/BOOTX64.EFI
 sudo umount efiboot
 rmdir efiboot

 mkdir -p ${CDROOT}/EFI/BOOT

 cp efiboot.img ${CDROOT}
 cp script ${CDROOT}
 cp isolinux.cfg ${CDROOT}
 cp ipxe/src/bin-x86_64-efi/ipxe.efi ${CDROOT}/EFI/BOOT/BOOTX64.EFI
 cp ipxe/src/bin/ipxe.lkrn ${CDROOT}/EFI/BOOT
 cp ipxe/src/bin/ipxe.lkrn ${CDROOT}
 cp /usr/share/syslinux/isolinux.bin ${CDROOT}
popd

mkisofs \
  -untranslated-filenames \
  -rational-rock \
  -v \
  -translation-table \
  -input-charset UTF-8 \
  -J \
  -joliet-long \
  -V "Generic Boot" \
  -A "Generic Boot" \
  -volset "Generic Boot" \
  -x ./lost+found \
  -b isolinux.bin \
  -c boot.cat \
  -no-emul-boot \
  -boot-load-size 4 \
  -boot-info-table \
  -eltorito-alt-boot \
  -eltorito-platform 0xEF \
  -efi-boot efiboot.img \
  -no-emul-boot \
  -o ${OUTFILE_CD} \
  ${CDROOT}

cp ${OUTFILE_CD} ${OUTFILE_USB}
/usr/bin/isohybrid -v --uefi ${OUTFILE_USB}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.