1

I am following steps from Ubuntu documentation https://help.ubuntu.com/community/LiveCDInternetKiosk

I have tried replacing final step that uses mkisofs with xorriso, did not help. My USB stick won't book, I get blank prompt. Think it may be related to filesystem (Hidden NTFS/FAT instead of VFAT) but changing it using cfdisk does not reslove the problem. The partition table is "dos", looks fine and /dev/sdb1 is active aka bootable. The original .iso image is new Ubuntu server 17.10 and modified one is copied using dd. System files are untouched on a modified version.

If I try to install syslinx on USB afterwards (syslinux -i /dev/sdb) i get following error: "syslinux: invalid media signature (not an FAT/NTFS volume?)"

If I upload the .iso to USB using unetbootin the system loads fine. I only had to do isolinux -> sysline rename to avoid default unetbootin's default boot prompt.

I would like to be able to script this last step without using X or user interaction at all.

Some relevant steps:

sudo rm extract-cd/casper/filesystem.squashfs
sudo mksquashfs edit extract-cd/casper/filesystem.squashfs

sudo chmod a+w extract-cd/casper/filesystem.size
printf $(sudo du -sx --block-size=1 edit | cut -f1) > extract-cd/casper/filesystem.size


cd extract-cd
sudo rm md5sum.txt
find -type f -print0 | sudo xargs -0 md5sum | grep -v syslinux/boot.cat | sudo tee md5sum.txt
cd ..

xorriso -as mkisofs \
  -o xgogi.iso \
  -isohybrid-mbr /usr/lib/SYSLINUX/mbr.bin \
  -c syslinux/boot.cat \
  -b syslinux/syslinux.bin \
   -no-emul-boot -boot-load-size 4 -boot-info-table \
  extract-cd/

#copy to USB works, needs X
sudo unetbootin lang=en method=diskimage isofile=xgogi.iso installtype=USB targetdrive=/dev/sdb1 autoinstall=yes

# doesn't work and I am badly frustrated why
sudo dd bs=4M if=gogi.iso of=/dev/sdb
kometonja
  • 155

2 Answers2

2

As you found out, you need a specially prepared MBR as input for xorriso. It has the unusual job to find and start program "isolinux.bin" inside the ISO.

The SYSLINUX project offers a suitable MBR under the name "isohdpfx.bin". Debian binary package "isolinux" has it as /usr/lib/ISOLINUX/isohdpfx.bin .

Although there is few development in SYSLINUX, one should take care to combine isohdpfx.bin and isolinux.bin only from compatible versions. So when modifying an ISO and keeping its file isolinux.bin it is wise to extract the first 432 bytes from that ISO and use them as MBR input. (It is not harmful to copy all 512 bytes of the first block. xorriso will overwrite the surplus bytes with appropriate values.)

  • Thanks for the clarification even though I had to find it in a harder way: I was unable to locate isohdpfx.bin on my Ubuntu 17.10 at home for whatever reason. In my /usr/lib/SYSLINUX/ there were only a few versions of mbr.bin. On my work computer I have no difficulties locating /usr/lib/ISOLINUX/isohdpfx.bin in the same directory. I have no clue why but at least I understand why my USB wasn't booting. – kometonja Nov 27 '17 at 10:24
  • My best guess is that package "isolinux" was not installed, but only package "syslinux". See https://packages.debian.org/sid/amd64/syslinux/filelist and https://packages.debian.org/sid/amd64/isolinux/filelist – Thomas Schmitt Nov 28 '17 at 10:48
  • I have created second partition, to store data but I am not able to mount it from my live distribution. I get "already mounted or /mnt busy error". None of that is true but it looks like whole device is mounted "/dev/sda on /cdrom type iso9660". How do I resolve this issue? – kometonja Dec 04 '17 at 22:05
  • Umount /dev/sda and mount /dev/sda1 instead. Then sda2 should become mountable. If you cannot do this switch, establish a loop device on /dev/sda2 and mount that loop device. (E.g.: losetup -f /dev/sda2) – Thomas Schmitt Dec 06 '17 at 07:45
  • I was not able to umount /dev/sda. Is there a syslinux flag or fstab setting that I can alter for Ubuntu to mount /dev/sda1 instead of /dev/sda? Or is /dev/sda prerequisite for booting isohybrid .iso image...? Loop device sounds promising way to go, but I am not sure I understand how it works- one can mount a partition with normal filesystem as a loop device? – kometonja Dec 06 '17 at 14:01
  • I guess it is udisks/systemd in the ISO which does the mounting. The proposal with the loop device circumvents the mount test for busy device. I use two of them to compare two ISO session on the same BD medium. Loop devices work with data files or block devices as storage medium. They offer this storage in the form of a block device. Command mount even has a shortcut for loop devices. Try: mount -o loop /dev/sda2 /your/directory – Thomas Schmitt Dec 06 '17 at 15:31
  • Wow, I have never met anyone that can fix my problems so quickly and precisely. Thank you, I can't upvote this enough (actually I can't upvote at all sice my low reputation does not allow it). Please post this as a answer on this question and I will accept it. https://askubuntu.com/questions/983224/live-usb-mount-second-partition-on-same-device?noredirect=1#comment1582754_983224 Have a nice day! – kometonja Dec 07 '17 at 17:13
1

My mbr.bin was incorrect. Instead, I had to create a new one from the original .iso. Like this:

$ sudo dd if=ubuntu-16.04-desktop-amd64.iso bs=512 count=1 of=custom-iso/isolinux/isohdpfx.bin

Found on this beautiful article: https://linuxconfig.org/legacy-bios-uefi-and-secureboot-ready-ubuntu-live-image-customization

kometonja
  • 155