Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #200152 > unrolled thread

USB media install has wrong partition

Started byJohn Roman <john@dev1ce.com>
First post2018-09-15 04:30 +0200
Last post2018-09-15 20:50 +0200
Articles 16 — 7 participants

Back to article view | Back to linux.debian.user


Contents

  USB media install has wrong partition John Roman <john@dev1ce.com> - 2018-09-15 04:30 +0200
    Re: USB media install has wrong partition Steve McIntyre <steve@einval.com> - 2018-09-15 05:20 +0200
      Re: USB media install has wrong partition John Roman <john@dev1ce.com> - 2018-09-15 17:20 +0200
      Re: USB media install has wrong partition John Roman <john@dev1ce.com> - 2018-09-15 17:40 +0200
    Re: USB media install has wrong partition "Thomas Schmitt" <scdbackup@gmx.net> - 2018-09-15 19:20 +0200
      Re: USB media install has wrong partition John Roman <john@dev1ce.com> - 2018-09-15 20:10 +0200
        Re: USB media install has wrong partition "Thomas Schmitt" <scdbackup@gmx.net> - 2018-09-15 20:40 +0200
          Re: USB media install has wrong partition mick crane <mick.crane@gmail.com> - 2018-09-16 09:10 +0200
            Re: USB media install has wrong partition "Thomas Schmitt" <scdbackup@gmx.net> - 2018-09-16 09:40 +0200
              Re: USB media install has wrong partition mick crane <mick.crane@gmail.com> - 2018-09-16 10:10 +0200
              Re: USB media install has wrong partition David <bouncingcats@gmail.com> - 2018-09-16 10:20 +0200
                Re: USB media install has wrong partition "Thomas Schmitt" <scdbackup@gmx.net> - 2018-09-16 13:10 +0200
              Re: USB media install has wrong partition David <bouncingcats@gmail.com> - 2018-09-16 10:30 +0200
    Re: USB media install has wrong partition Pascal Hambourg <pascal@plouf.fr.eu.org> - 2018-09-15 20:20 +0200
      Re: USB media install has wrong partition Wayne Sallee <Wayne@WayneSallee.com> - 2018-09-15 20:40 +0200
      Re: USB media install has wrong partition "Thomas Schmitt" <scdbackup@gmx.net> - 2018-09-15 20:50 +0200

#200152 — USB media install has wrong partition

FromJohn Roman <john@dev1ce.com>
Date2018-09-15 04:30 +0200
SubjectUSB media install has wrong partition
Message-ID<wy8vn-7UL-3@gated-at.bofh.it>
greetings,
the USB install media for netinst and live both create a dos partition
table on dd, and cp.  This will result in media that can only be booted
legacy, as GPT is a requirement for EFI boot.

[toc] | [next] | [standalone]


#200153

FromSteve McIntyre <steve@einval.com>
Date2018-09-15 05:20 +0200
Message-ID<wy9hM-8pC-5@gated-at.bofh.it>
In reply to#200152
john@dev1ce.com wrote:
>greetings,
>the USB install media for netinst and live both create a dos partition
>table on dd, and cp.  This will result in media that can only be booted
>legacy, as GPT is a requirement for EFI boot.

Sorry, that's incorrect. It's perfectly valid in the UEFI spec for an
EFI System Partition to be a partition with type 0xEF in an
msdos-style partition table, particularly for removable media. Are you
having problems booting on a particular machines?

-- 
Steve McIntyre, Cambridge, UK.                                steve@einval.com
"Further comment on how I feel about IBM will appear once I've worked out
 whether they're being malicious or incompetent. Capital letters are forecast."
 Matthew Garrett, http://www.livejournal.com/users/mjg59/30675.html

[toc] | [prev] | [next] | [standalone]


#200174

FromJohn Roman <john@dev1ce.com>
Date2018-09-15 17:20 +0200
Message-ID<wykwx-6tW-7@gated-at.bofh.it>
In reply to#200153
Correct sir, I am having issues installing to an asus sabertooth 990
motherboard. namely, the boot override menu fails to recognize the EFI
media as a proper EFI bootable target.

As I understand, a Protective MBR may be located at LBA 0 (i.e., the first logical block)
of the disk if it is using the GPT disk layout. The Protective MBR precedes the GUID Partition Table
Header to maintain compatibility with existing tools that do not understand GPT partition
structures. is this what the live image does?

its perhaps my hypothesis that this protective mbr entry is stymying
attempts to boot a true EFI partition.  the specification ive referenced
is from 2017, and my motherboard is from 2012.
http://www.uefi.org/sites/default/files/resources/UEFI%20Spec%202_7_A%20Sept%206.pdf

0xEF is covered, as you rightly confirmed, in section 5.2.2.



On Sat, Sep 15, 2018 at 03:39:35AM +0100, Steve McIntyre wrote:
> john@dev1ce.com wrote:
> >greetings,
> >the USB install media for netinst and live both create a dos partition
> >table on dd, and cp.  This will result in media that can only be booted
> >legacy, as GPT is a requirement for EFI boot.
> 
> Sorry, that's incorrect. It's perfectly valid in the UEFI spec for an
> EFI System Partition to be a partition with type 0xEF in an
> msdos-style partition table, particularly for removable media. Are you
> having problems booting on a particular machines?
> 
> -- 
> Steve McIntyre, Cambridge, UK.                                steve@einval.com
> "Further comment on how I feel about IBM will appear once I've worked out
>  whether they're being malicious or incompetent. Capital letters are forecast."
>  Matthew Garrett, http://www.livejournal.com/users/mjg59/30675.html

[toc] | [prev] | [next] | [standalone]


#200175

FromJohn Roman <john@dev1ce.com>
Date2018-09-15 17:40 +0200
Message-ID<wykPT-6zG-1@gated-at.bofh.it>
In reply to#200153
As an update,
Ive tested devuan, debian, and ubuntu media on a newer laptop (2015)
which seems to recognize the EFI partition and boot normally.

my desktop (2012) does not seem to understand 0xEF...I wish I knew why.


On Sat, Sep 15, 2018 at 03:39:35AM +0100, Steve McIntyre wrote:
> john@dev1ce.com wrote:
> >greetings,
> >the USB install media for netinst and live both create a dos partition
> >table on dd, and cp.  This will result in media that can only be booted
> >legacy, as GPT is a requirement for EFI boot.
> 
> Sorry, that's incorrect. It's perfectly valid in the UEFI spec for an
> EFI System Partition to be a partition with type 0xEF in an
> msdos-style partition table, particularly for removable media. Are you
> having problems booting on a particular machines?
> 
> -- 
> Steve McIntyre, Cambridge, UK.                                steve@einval.com
> "Further comment on how I feel about IBM will appear once I've worked out
>  whether they're being malicious or incompetent. Capital letters are forecast."
>  Matthew Garrett, http://www.livejournal.com/users/mjg59/30675.html

[toc] | [prev] | [next] | [standalone]


#200177

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2018-09-15 19:20 +0200
Message-ID<wymoF-7yH-1@gated-at.bofh.it>
In reply to#200152
Hi,

John Roman wrote:
> As I understand, a Protective MBR may be located at LBA 0 

In the case of the isohybrid partition layout of Matthew J. Garrett,
which is used by Debian for i386 and amd64, the MBR is not protective.

A bit confusing can be the GPT partition table debris that follows the MBR.
It is supposed to be ignored by any entity which cares about GPT specs.
Matthew presented his layout at
  http://mjg59.dreamwidth.org/11285.html
He talks of Fedora ISOs. Debian joined that layout, but without HFS+
filesystem.


> is this what the live image does

>From the view of EFI and many partition editors, Debian's ISO MBR
effectively marks only one partition, the EFI partition, as entry number 2.

Entry number 1 has type 0x00 to avoid rejection by EFI due to partition 2
sitting inside partition 1. UEFI 2.4, 5.2.1 specifies:
  "A Partition Record that contains an OSType value of zero or a SizeInLBA
   value of zero may be ignored."
Partition 1 exists to mark the size of the ISO 9660 filesystem. It is not
supposed to matter during booting. (BIOS boots by the MBR x86 machine code.)


> my desktop (2012) does not seem to understand 0xEF...I wish I knew why.

If you have access to a running Debian System, then you could build a
grub-mkrescue ISO, which will have a protective MBR and valid GPT.
If it boots to a GRUB prompt, then we know that your machine would work
with GPT.

Try to create it with these commands ("minimal/file" is just to have a
directory and file, on which grub-mkrescue insists):

  sudo apt-get install grub-pc grub-efi-ia32-bin grub-efi-amd64-bin xorriso
  mkdir minimal
  echo hello >minimal/file
  grub-mkrescue -o output.iso minimal

Put output.iso onto an USB stick, as you did with the Debian ISO.

-------

Another test proposal:

Knoppix 8.1 ISOs have a different MBR based partition layout than Fedora,
Debian, et.al. If Knoppix 8.1 (or newer version) boots, then your
firmware probably hates that Debian partition 1 encloses partition 2,
despite its type 0x00.
(Knoppix 8.0 has a partition layout like Debian, but with appended
partition 3 of type 0x83. Knoppix 7 has no partition table at all.)


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#200179

FromJohn Roman <john@dev1ce.com>
Date2018-09-15 20:10 +0200
Message-ID<wynb4-83B-7@gated-at.bofh.it>
In reply to#200177
Thomas,
Thank you for clarification on the layout, as it is in fact most helpful
in understanding GPT cruft.  As a Gentoo user, I can in fact boot
system-rescue-cd and Knoppix as EFI USB.  Sadly, this seems like one
more nail in the coffin of reasons I need to upgrade my PC.  I cannot
reproduce the boot error on a dell system either.

Thank you for your support and time.


On Sat, Sep 15, 2018 at 07:09:58PM +0200, Thomas Schmitt wrote:
> Hi,
> 
> John Roman wrote:
> > As I understand, a Protective MBR may be located at LBA 0 
> 
> In the case of the isohybrid partition layout of Matthew J. Garrett,
> which is used by Debian for i386 and amd64, the MBR is not protective.
> 
> A bit confusing can be the GPT partition table debris that follows the MBR.
> It is supposed to be ignored by any entity which cares about GPT specs.
> Matthew presented his layout at
>   http://mjg59.dreamwidth.org/11285.html
> He talks of Fedora ISOs. Debian joined that layout, but without HFS+
> filesystem.
> 
> 
> > is this what the live image does
> 
> From the view of EFI and many partition editors, Debian's ISO MBR
> effectively marks only one partition, the EFI partition, as entry number 2.
> 
> Entry number 1 has type 0x00 to avoid rejection by EFI due to partition 2
> sitting inside partition 1. UEFI 2.4, 5.2.1 specifies:
>   "A Partition Record that contains an OSType value of zero or a SizeInLBA
>    value of zero may be ignored."
> Partition 1 exists to mark the size of the ISO 9660 filesystem. It is not
> supposed to matter during booting. (BIOS boots by the MBR x86 machine code.)
> 
> 
> > my desktop (2012) does not seem to understand 0xEF...I wish I knew why.
> 
> If you have access to a running Debian System, then you could build a
> grub-mkrescue ISO, which will have a protective MBR and valid GPT.
> If it boots to a GRUB prompt, then we know that your machine would work
> with GPT.
> 
> Try to create it with these commands ("minimal/file" is just to have a
> directory and file, on which grub-mkrescue insists):
> 
>   sudo apt-get install grub-pc grub-efi-ia32-bin grub-efi-amd64-bin xorriso
>   mkdir minimal
>   echo hello >minimal/file
>   grub-mkrescue -o output.iso minimal
> 
> Put output.iso onto an USB stick, as you did with the Debian ISO.
> 
> -------
> 
> Another test proposal:
> 
> Knoppix 8.1 ISOs have a different MBR based partition layout than Fedora,
> Debian, et.al. If Knoppix 8.1 (or newer version) boots, then your
> firmware probably hates that Debian partition 1 encloses partition 2,
> despite its type 0x00.
> (Knoppix 8.0 has a partition layout like Debian, but with appended
> partition 3 of type 0x83. Knoppix 7 has no partition table at all.)
> 
> 
> Have a nice day :)
> 
> Thomas
> 

[toc] | [prev] | [next] | [standalone]


#200182

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2018-09-15 20:40 +0200
Message-ID<wynE6-8ct-7@gated-at.bofh.it>
In reply to#200179
Hi,

John Roman wrote:
> As a Gentoo user, 

In 2016 the Gentoo ISOs were BIOS-only.
I now downloaded install-amd64-minimal-20180913T214501Z.iso which looks
much like a Debian ISO, partition-wise.

  xorriso -indev install-amd64-minimal-20180913T214501Z.iso \
          -report_system_area plain

reports:

  MBR partition table:   N Status  Type        Start       Blocks
  MBR partition      :   1   0x80  0x00            0       477184
  MBR partition      :   2   0x00  0xef          160        12912
  MBR partition path :   2  /gentoo.efimg
  ...
  GPT                :   N  Info
  GPT disk GUID      :      8d5cbf80b3cc5142b9803969f661ef0c
  ...

The file /gentoo.efimg in the ISO serves as System Partition
The GPT stuff is invalid, as usual with this layout.


> Sadly, this seems like one
> more nail in the coffin of reasons I need to upgrade my PC.

Can't you talk its firmware into BIOS emulating legacy mode ?
You could even use program fdisk to delete partition entry 2 in the ISO
in order to take away the USB boot lure for EFI. Some firmwares are
said to fall back to BIOS emulation automatically.


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#200187

Frommick crane <mick.crane@gmail.com>
Date2018-09-16 09:10 +0200
Message-ID<wyzlT-6JY-9@gated-at.bofh.it>
In reply to#200182
On 2018-09-15 19:33, Thomas Schmitt wrote:
<snip>
> Can't you talk its firmware into BIOS emulating legacy mode ?
> You could even use program fdisk to delete partition entry 2 in the ISO
> in order to take away the USB boot lure for EFI. Some firmwares are
> said to fall back to BIOS emulation automatically.
> 

never really understanding this.
If mount iso as loopback does it show up in fdisk ?

mick



-- 
Key ID    4BFEBB31

[toc] | [prev] | [next] | [standalone]


#200188

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2018-09-16 09:40 +0200
Message-ID<wyzOW-6SP-7@gated-at.bofh.it>
In reply to#200187
Hi,

i wrote:
> > You could even use program fdisk to delete partition entry 2 in the ISO

mick crane wrote:
> never really understanding this.
> If mount iso as loopback does it show up in fdisk ?

No loopback is needed. fdisk will operate directly on the ISO image file
as it would operate on the USB stick.

A partition table is just a bunch of bytes at some predifined position.
In case of MBR (aka "DOS") partition table, the position is from byte 446
of the file or device to byte 509. Essential is the "magic number" at
bytes 510 and 511. If those bytes say 0x55 and 0xAA, then BIOS, EFI, and
partition editors will accept the 512 bytes as Master Boot Record.
  https://en.wikipedia.org/wiki/Master_boot_record

In bytes 446 to 509, there are 4 partition entry slots of 16 bytes each.
If you set all 16 bytes from 446+16 to 446+31 to the value 0, then the
second partition slot will be considered as unused. Thus partition 2 will
not be to see any more, although its data (somewhere deep in the ISO)
will still be there and unchanged.

Program fdisk would be willing to do the zeroing. But you could also
let dd copy 16 bytes from /dev/zero to the partition entry:
  dd if=/dev/zero bs=1 seek=462 count=16 of=...ISO.or.USB.stick...

Goal is to take away the entry point by which EFI would recognize the
EFI System Partition, where it would find its start program.
Because the MBR x86 machine code program at bytes 0 to 445 stays unchanged,
EFI might decide to fall back to legacy mode, and execute those bytes
as start program.

This might be the mechanism which brings on some Apple machines success
with the "mac" ISOs: debian-mac-*-amd64-netinst.iso.
Those ISOs bear no EFI System Partition.
So alternatively to deleting partition 2 from a normal netinst ISO,
one may try a Debian "mac" ISO.

But John already stated that he wants EFI native, not BIOS emulation.
So for him, this is not an option.


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#200189

Frommick crane <mick.crane@gmail.com>
Date2018-09-16 10:10 +0200
Message-ID<wyAhX-7hz-7@gated-at.bofh.it>
In reply to#200188
On 2018-09-16 08:38, Thomas Schmitt wrote:
> Hi,
> 
> i wrote:
>> > You could even use program fdisk to delete partition entry 2 in the ISO
> 
> mick crane wrote:
>> never really understanding this.
>> If mount iso as loopback does it show up in fdisk ?
> 
> No loopback is needed. fdisk will operate directly on the ISO image 
> file
> as it would operate on the USB stick.
> 

thanks

mick


-- 
Key ID    4BFEBB31

[toc] | [prev] | [next] | [standalone]


#200190

FromDavid <bouncingcats@gmail.com>
Date2018-09-16 10:20 +0200
Message-ID<wyArD-7kE-1@gated-at.bofh.it>
In reply to#200188
On 16 September 2018 at 17:38, Thomas Schmitt <scdbackup@gmx.net> wrote:
> i wrote:
>> > You could even use program fdisk to delete partition entry 2 in the ISO
>
> mick crane wrote:
>> never really understanding this.
>> If mount iso as loopback does it show up in fdisk ?
>
> No loopback is needed. fdisk will operate directly on the ISO image file
> as it would operate on the USB stick.

As an aside, it is actually an error to describe this as a "loopback" device,
because that is incorrect.

It is a "loop" device [1].

The word "loopback" does not appear in 'man mount'.

A *loop* device is a filesystem technique to make a file accessible as
a block device.

A *loopback* device is a virtual network interface.

[toc] | [prev] | [next] | [standalone]


#200194

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2018-09-16 13:10 +0200
Message-ID<wyD69-sv-3@gated-at.bofh.it>
In reply to#200190
Hi,

mick crane lured me into writing:
> > No loopback is needed.

David wrote:
> It is a "loop" device.

Indeed. Probably i would also have adopted "loo-thingy" while my head
was wrapped around the partition table stuff.


Have a nice day :)

Thomas

[toc] | [prev] | [next] | [standalone]


#200191

FromDavid <bouncingcats@gmail.com>
Date2018-09-16 10:30 +0200
Message-ID<wyABk-7nJ-1@gated-at.bofh.it>
In reply to#200188
Sorry, in my previous message I forgot this footnote :)

[1] https://en.wikipedia.org/wiki/Loop_device

[toc] | [prev] | [next] | [standalone]


#200180

FromPascal Hambourg <pascal@plouf.fr.eu.org>
Date2018-09-15 20:20 +0200
Message-ID<wynkJ-86C-3@gated-at.bofh.it>
In reply to#200152
Le 15/09/2018 à 03:55, John Roman a écrit :
> 
> the USB install media for netinst and live both create a dos partition
> table on dd, and cp.

"On dd, and cp" ?

By default, the Debian installer creates a DOS partition table when 
booted in BIOS/legacy mode and a GPT partition table when booted in EFI 
mode. But if you select "expert install" in the boot menu and manual 
partitioning, you will be given the choice between DOS and GPT when 
creating a new "disk label" (partition table).

> This will result in media that can only be booted
> legacy, as GPT is a requirement for EFI boot.

Others already addressed this point.
Besides, what's wrong with booting in legacy mode ?

[toc] | [prev] | [next] | [standalone]


#200181

FromWayne Sallee <Wayne@WayneSallee.com>
Date2018-09-15 20:40 +0200
Message-ID<wynE5-8ct-3@gated-at.bofh.it>
In reply to#200180
On 09/15/2018 02:16 PM, Pascal Hambourg wrote:
> Others already addressed this point.
> Besides, what's wrong with booting in legacy mode ?
You have to keep changing the bios settings whenever you boot the memory stick on an EFI computer.

Wayne Sallee
Wayne@WayneSallee.com
http://www.WayneSallee.com

[toc] | [prev] | [next] | [standalone]


#200183

From"Thomas Schmitt" <scdbackup@gmx.net>
Date2018-09-15 20:50 +0200
Message-ID<wynNM-8fK-5@gated-at.bofh.it>
In reply to#200180
Hi,

John Roman wrote:
> > netinst and live both create a dos partition table on dd, and cp.

Pascal Hambourg wrote:
> "On dd, and cp" ?

Steve McIntyre and i understood John's statement that after dd or cp
there is a MBR partition table on the USB stick. The following
conversation would make few sense if we were wrong.

The MBR and its table are on the USB stick because they already are in
the ISO image. dd or cp just copy them to the medium.

  $  /sbin/fdisk -l debian-9.3.0-amd64-netinst.iso
  ...
  Device                          Boot Start    End Sectors  Size Id Type
  debian-9.3.0-amd64-netinst.iso1 *        0 593919  593920  290M  0 Empty
  debian-9.3.0-amd64-netinst.iso2       3760   4591     832  416K ef EFI (FAT-12/1


> Besides, what's wrong with booting in legacy mode ?

Good point. Let's hope the machine offers this mode.


Have a nice day :)

Thomas

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web