Feature #9067
closedSupport PMBR customisation with EFI label
100%
Description
When writing an EFI label to disk, efi_write() also creates a protective MBR (PMBR). This PMBR contains a single partition which spans the entire disk (in so far as can be addressed in an MBR) and by default it places the partition in the first slot within the MBR and does not mark it as active.
Some systems have firmware bugs that mean that they will not boot from an EFI-labelled disk with a PMBR in this configuration. The workaround is to place the partition entry in a different slot and/or to mark the partition as active. The FreeBSD installer makes these changes for particular systems - see http://src.illumos.org/source/xref/freebsd-head/usr.sbin/bsdinstall/scripts/auto#179
This came up at FOSDEM when trying to install OmniOS on a Lenovo X1 laptop - as luck would have it, the FreeBSD table was adjacent and helped to debug the problem.
illumos should have a way of customising the PMBR parameters so that these workarounds can be implemented in installers.
Updated by Toomas Soome over 4 years ago
Andy Fiddaman wrote:
When writing an EFI label to disk, efi_write() also creates a protective MBR (PMBR). This PMBR contains a single partition which spans the entire disk (in so far as can be addressed in an MBR) and by default it places the partition in the first slot within the MBR and does not mark it as active.
Some systems have firmware bugs that mean that they will not boot from an EFI-labelled disk with a PMBR in this configuration. The workaround is to place the partition entry in a different slot and/or to mark the partition as active. The FreeBSD installer makes these changes for particular systems - see http://src.illumos.org/source/xref/freebsd-head/usr.sbin/bsdinstall/scripts/auto#179
This came up at FOSDEM when trying to install OmniOS on a Lenovo X1 laptop - as luck would have it, the FreeBSD table was adjacent and helped to debug the problem.illumos should have a way of customising the PMBR parameters so that these workarounds can be implemented in installers.
Yes this is an issue and have been waiting for test case. Thanks for attending it.
Updated by Jorge Schrauwen over 4 years ago
I’m not using the laptop often so once there is a fix I can test it.
Updated by Andy Fiddaman about 4 years ago
Almost ready for RTI so here's some of the testing I've performed for the record:
libefi:
reaper# grep Dell /usr/share/hwdata/efi.fixes | tail -1 sys.manufacturer="Dell Inc." sys.product="PowerEdge R730" mb.version=A04 pmbr_active=1 pmbr_slot=3 reaper# zpool create test c0t13d1 reaper# fdisk -W - c0t13d1p0 | tail -5 * Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 238 128 255 63 1023 255 63 1023 1 62499999 reaper# zpool replace test c0t{13,14}d1 reaper# fdisk -W - c0t14d1p0 | tail -5 * Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 238 128 255 63 1023 255 63 1023 1 62499999 reaper# sed -i '/PowerEdge/s/active=1/active=0/' /usr/share/hwdata/efi.fixes reaper# zpool replace test c0t{14,13}d1 reaper# fdisk -W - c0t13d1p0 | tail -5 * Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 238 0 255 63 1023 255 63 1023 1 62499999 reaper# sed -i '/PowerEdge/s/slot=3/slot=1/' /usr/share/hwdata/efi.fixes reaper# zpool replace test c0t{13,14}d1 reaper# fdisk -W - c0t14d1p0 | tail -5 * Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect 0 0 0 0 0 0 0 0 0 0 238 0 255 63 1023 255 63 1023 1 62499999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 reaper# sed -i '/PowerEdge/s/^/#/' /usr/share/hwdata/efi.fixes reaper# zpool replace test c0t{14,13}d1 reaper# fdisk -W - c0t13d1p0 | tail -5 * Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect 238 0 255 63 1023 255 63 1023 1 62499999 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
fdisk:
reaper# zpool export test reaper# fdisk -E 2:1 c0t13d1p0 reaper# fdisk -W - c0t13d1p0 | tail -5 * Id Act Bhead Bsect Bcyl Ehead Esect Ecyl Rsect Numsect 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 238 128 255 63 1023 255 63 1023 1 62499999 0 0 0 0 0 0 0 0 0 0 reaper# zpool import test reaper# zpool status test pool: test state: ONLINE scan: resilvered 86K in 0h0m with 0 errors on Mon Feb 12 10:46:49 2018 config: NAME STATE READ WRITE CKSUM test ONLINE 0 0 0 c0t13d1 ONLINE 0 0 0 errors: No known data errors
Updated by Electric Monk about 4 years ago
- Status changed from New to Closed
- % Done changed from 80 to 100
git commit 7e934d3acc051b7ee3ef0d11571fd1225800a607
commit 7e934d3acc051b7ee3ef0d11571fd1225800a607 Author: Andy Fiddaman <omnios@citrus-it.co.uk> Date: 2018-03-30T01:17:56.000Z 9067 Support PMBR customisation with EFI label 9116 fdisk limits heads to 254 (mostly) Reviewed by: Toomas Soome <tsoome@me.com> Reviewed by: Jorge Schrauwen <sjorge@blackdot.be> Reviewed by: Dominik Hassler <hadfl@omniosce.org> Approved by: Robert Mustacchi <rm@joyent.com>
Updated by Yuri Pankov about 4 years ago
This forgot to add the libefi -> libsmbios dependency in usr/src/lib/Makefile; it doesn't seem to be causing build failures at the moment, but should be fixed anyway.