[syslinux] "isolinux.bin missing or corrupt" when booting USB flash drive in old PC

Thomas Schmitt
Mon, 20 Mar 2017 07:57:53 -0000

Hi,

MartinS wrote:
> Is it the isohdppx or isohdpfx (or both) that is relevant?

The file /.disk/mkisofs in the ISO tells that option

  -isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin

was used. (This file is a Debian specialty.)
I guess you can see at the first bytes of the ISO that the partition
interpreter code is not there.


> For isohdpfx.bin it will print:
> E if EBIOS
> C if not EBIOS (from "CHS").
> Is that interesting for you/us?

It will tell us whether C/H/S addressing is a suspect.


My main point of interest is which block is really loaded as first one
of isolinux.bin.

My program block_seq.c to create a stream with recognizable block
content is:
------------------------------------------------------------------
#include <unistd.h>

int main()
{
 int ret;
 unsigned int i, j, k;
 char buf[512];

 for(i= 0; ; i++) {
   for(j= 0; j < 128; j++)
     for(k= 0; k < 4; k++)
       buf[4 * j + k]= (i >> (24 - 8 * k)) & 0xff;
   ret= write(1, buf, 512);
   if(ret != 512)
 break;
 }
 return 0;
}
------------------------------------------------------------------
(It could be shorter if i did not insist in big endian words.)

To be compiled by

 cc -o block_seq block_seq.c

and used like

  ./block_seq | dd bs=512 skip=1 count=1325055 seek=1 of=/dev/sdc

to overwrite the ISO except the MBR.
(1325056 blocks is the size of the Debian ISO in question. One could
of course fill the whole stick until it throws an i/o error.)

The block at LBA 1 bears as content
  00  00  00  01  00  00  00  01  00  00  00  01  00  00  00  01
  ...
The last block at LBA 1325055:
  00  14  37  ff  00  14  37  ff  00  14  37  ff  00  14  37  ff
  ...

None of these blocks bears the isolinux.bin signature
  fb  c0  78  70
anywhere.
So the original MBR should bail out with the known message.
It would be nice if it tells the block content before it ends.


> Further how do I test that I haven't done anything really stupid?
> I have debian install .isos e. g. debian-8.7.0-i386-CD-1.iso and
> debian-8.7.0-i386-DVD-1.iso. I can boot these with qemu. But where
> shall I insert this creation of mine.

Just overwrite the first 432 bytes of the ISO.
Make a backup of the original bytes, so you can restore it later.

  dd bs=1 count=432 if=debian-8.7.1-i386-xfce-CD-1.iso of=mbr.backup

  dd conv=notrunc bs=1 count=432 if=your_test_mbr \
     of=debian-8.7.1-i386-xfce-CD-1.iso

To restore the original MBR code:

  dd conv=notrunc bs=1 count=432 if=mbr.backup \
     of=debian-8.7.1-i386-xfce-CD-1.iso


Have a nice day :)

Thomas