--------------------------
Since this includes the fix, I wanted to post it separately somewhere for community visibility. I hope that's okay.
I'm using Porteus 5.0 for size constraints, but the same code is also in 5.01 (and probably other versions, but I haven't checked).
How I found this issue:
macOS cannot read files >4GB in size from any ISO9660 optical format. Apple has only ever supported ISO levels 1 and 2, not level 3 or ISO9660:1999, which added support for large files. (You can force-mount level 3, but large files will not be accessible.)
The workaround is to add "-udf" to the mkisofs command to create an ISO-UDF hybrid, which is recognizable as either format, and macOS can read UDF just fine. But I was stumped that Porteus was unable to boot from an ISO-UDF hybrid (neither via grub/syslinux/bios/uefi).
Extract the initrd.xz/cpio, and view the 'finit' file. Notice in this section there are 2 invalid 'mount' invocations:
Code: Select all
# Device partitions:
EOF
for x in $dev; do
fs=`grep -w /dev/$x /tmp/devices | egrep -o ' TYPE=[^ ]+' | cut -d'"' -f2`
[ $fs = vfat ] && echo "/dev/$x /mnt/$x vfat $MOPT,umask=0,check=s,utf8,uid=1000 0 0" >>/etc/fstab || echo "/dev/$x /mnt/$x $fs $MOPT 0 0" >>/etc/fstab
if [ ! -d /mnt/$x ]; then
mkdir /mnt/$x
if [ $fs = ntfs ]; then
ntfs-3g /dev/$x /mnt/$x -o $MOPT,uid=1000,big_writes 2>/dev/null || { sed -i "/$x /d" /etc/fstab; rmdir /mnt/$x; }
else
mount -n /mnt/$x 2>/dev/null || { modprobe $fs 2>/dev/null && mount -n /mnt/$x 2>/dev/null || { sed -i "/$x /d" /etc/fstab; rmdir /mnt/$x; }; }
fi
fi
done
Code: Select all
mount -n /mnt/$x 2>/dev/null || ... && mount -n /mnt/$x 2>/dev/null
At first glance, locate()'s later calls to mount_device() (which does invoke mount correctly) might appear to cover for those failed mounts, but alas! those get called only if the user specifies a from= cheatcode that hardcodes a "/mnt/" path or a UUID. Without either of those, the "search" case depends on the earlier mounts to have worked (which they didn't).
Anyway, if you fix that mount line under "# Device partitions":
Code: Select all
mount -n /mnt/$x 2>/dev/null || ... && mount -n /mnt/$x 2>/dev/null
Code: Select all
mount -n /dev/$x /mnt/$x 2>/dev/null || ... && mount -n /dev/$x /mnt/$x 2>/dev/null
I see that FAT and NTFS are special cases (and so they avoid this problem),
but it looks as if this issue might affect booting from other alternative filesystems too.
If anyone needs to backport this fix to an earlier version, here's the way to extract and repack the initrd.xz:
Code: Select all
mkdir -p work/imgroot && cd work/imgroot
xz -dc < /mnt/Porteus/boot/syslinux/initrd.xz | cpio -idmv
# fix the finit file, then repack
find . 2>/dev/null | cpio -o -H newc -R root:root | xz -9 --format=xz --check=crc32 > ../initrd_new.xz