Casey Bralla on 3 Aug 2014 16:40:32 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Why Doesn't dd work for all ISO files?


Wow!  Quite a post, Brent.  That's why I ask questions on this list.  Thank 
you!

Just don't call me "sassypants" any more! <grin>


On Saturday 2014-08-02 11:58:06 PM brent timothy saner wrote:
> On 08/02/2014 08:40 AM, Casey Bralla wrote:
> > I've been doing a bunch of distro testing lately, and so have had the
> > opportunity to transfer iso files to thumb drives.
> > 
> > Most distros can be loaded onto a bootable thumb drive using the
> > fantastic unetbootin utility. Some (such as KaOS (http://kaosx.us/ )
> > cannot be loaded with netbootin and instead need the "dd" command to
> > copy the iso file as a binary onto the thumb drive.
> > 
> > BTW, isn't KaOS a great distro name? They could have cool code names for
> > their versions such as "Chief", "Siegfried", or "Hymie".
> > 
> > Anyway, it seem to me that __ALL__ iso files from distros should be
> > transferable to thumb drives by using dd. I've tried this, however, and
> > most of them fail to boot.
> > 
> > Can anybody explain why this is so?
> 
> Howdy! Live-distro hacker, here.
> 
> I'll try to keep this pretty simple, because once you go down this
> rabbit-hole you lose sleep for three nights straight and then once you
> get it you make an obnoxious ALL CAPS tag in your git repo and your
> commit message is just sobbing.
> 
> ISO files are, essentially, raw image dumps.
> 
> "Well, duh- I knew THAT. How else could I dd from /dev/cdrom to MAKE an
> .iso from an existing disc?"
> 
> Well, chill, sassypants. Because there is a difference between an ISO
> file and a *bootable* ISO file, just as there's a difference between a
> hard drive and a *bootable* hard drive (assuming you're using MBR/BOIS.
> UEFI, the same holds true, but it's a bit different from my comparison,
> but more on that in a bit)...
> 
> Where was I?
> 
> Oh! Right. So of these bootable ISOs, there are two types:
> 
> -normal "el torito" bootable image, "legacy"; these are the ISOs that
> have been popular and used ever since some nerd first thought to make a
> linux bootable CD, more or less.
> 
> -Hybrid ISO's, which support the eltorito image but *also* have an
> embedded MBR in the ISO image
> 
> 
> Pre-boot Execution (BIOS, UEFI...) when booting from CD are looking
> *specifically* for an el torito header. When booting from a hard drive
> (i.e., as far as the system is concerned, a USB thumb-drive), it's
> looking for an MBR.
> 
> SO the short, tl;dr (I know, I know. I'm not even done yet.) answer is
> "because the newer ISO's that not every distro is even using yet but
> should be is actually using two different boot technologies within the
> same ISO image".
> 
> Not all distro's engineers/development teams even REALIZE the above.
> Granted, a lot of live-centric distros avoid hybrid ISO's because it
> would generally render the rest of the USB stick unusable from the live
> environment without some nasty hackstuffs. It's possible, just not
> generally worth it compared to releasing separate USB image files or
> scripts.
> 
>
> 
> So! Did you catch the difference?
> No? I don't blame you. It's subtle. VERY, very subtle.
> 
> Well, let's try to sleuth the hell out of it, then:
> 
> 
> Legacy:
> 
> [bts@workhorse sysresc]$ fdisk -l systemrescuecd-x86-4.3.1-beta002.iso
> 
> Disk systemrescuecd-x86-4.3.1-beta002.iso: 388 MiB, 406886400 bytes,
> 794700 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
> [bts@workhorse sysresc]$ file systemrescuecd-x86-4.3.1-beta002.iso
> systemrescuecd-x86-4.3.1-beta002.iso: # ISO 9660 CD-ROM filesystem data
> 'sysrcd-4.3.1' (bootable)
> 
> 
> Hybrid:
> 
> [bts@workhorse arch]$ fdisk -l archlinux-2014.07.03-dual.iso
> 
> Disk archlinux-2014.07.03-dual.iso: 558 MiB, 585105408 bytes, 1142784
> 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
> Disklabel type: dos
> Disk identifier: 0x6039e1c4
> 
> Device                         Boot Start       End Blocks  Id System
> archlinux-2014.07.03-dual.iso1 *        0   1142783 571392   0 Empty
> archlinux-2014.07.03-dual.iso2        252     63739  31744  ef EFI
> (FAT-12/16/32)
> [bts@workhorse arch]$ file archlinux-2014.07.03-dual.iso
> archlinux-2014.07.03-dual.iso: DOS/MBR boot sector
> 
> 
> 
> AHA!
> 
> AHA!!
> 
> Pay special attention to the output from the File commands- because the
> embedded MBR is at the beginning of the hybrid ISO, it is able to be
> booted from persistent media (USB flash drive).
> 
> 
> 
> And, for the sake of thoroughness, in case you doubt:
> 
> Legacy:
> 
> [bts@workhorse sysresc]$ strings systemrescuecd-x86-4.3.1-beta002.iso |
> head -n5
> CD001
>                                 sysrcd-4.3.1
> 
> 
> 
>                                         XORRISO-1.2.8 2013.03.18.093001,
> LIBISOBURN-1.2.8, LIBISOFS-1.2.8, LIBBURN-1.2.8
> 
> 
> 
>                                               2014073017414300
> 2014073017414300
> CD001
> 
> 
> Hybrid:
> 
> [bts@workhorse tmp]$ strings archlinux-2014.07.03-dual.iso | head -n5
> fSfQ
> xpu
> isolinux.bin missing or corrupt.
> f`f1
> {fRfP
> 
> 
> (you should see a similar output to the Hybrid if you operate the same
> on /dev/sda<boot partition #> *and* are using MBR/BIOS booting rather
> than UEFI.)
> 
> 
> 
> I hope this helps.
> 
> 
> In retrospect, I should have done a talk on it.
> 
> 
> On that note, who wants a "spin your own livecd from bare scratch" talk?
> ___________________________________________________________________________


-- 

Casey Bralla

Chief Nerd in Residence
The NerdWorld Organisation

www.NerdWorld.org
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug