Bug 12822 - pmbr_boot should be off in EFI partition
Summary: pmbr_boot should be off in EFI partition
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: Installer (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal major
Target Milestone: ---
Assignee: Thierry Vignaud
QA Contact:
URL:
Whiteboard:
Keywords: NEEDINFO
Depends on:
Blocks:
 
Reported: 2014-02-19 20:26 CET by Nicolas Brouard
Modified: 2017-09-20 09:31 CEST (History)
5 users (show)

See Also:
Source RPM:
CVE:
Status comment:


Attachments

Description Nicolas Brouard 2014-02-19 20:26:41 CET
Description of problem:
Once Mageia 4 is installed on brand new PC in UEFI mode, you can't boot UEFI OS installed on the hard drive any more (Winodws 8.1 for example).

Version-Release number of selected component (if applicable):
Mageia 4, february 2014

How reproducible:
Just installing it. Can't reboot in UEFI mode.

Steps to Reproduce:
1.
2.
3.

I discovered another problem after Mageia 4 installation. The gpt EFI partition got a surprising boot flag "pmbr_boot" which makes some workstations ignore the scanning of the EFI partition (see bug https://bugzilla.redhat.com/show_bug.cgi?id=844551). And thus I could no more get an UEFI boot of the hard drive. The hard drive disappeared from the Boot setup. The station could only boot on legacy mode (or on Live CD with UEFI support).

The solution consists in clearing this boot flag, for example with parted:
 disk_set pmbr_boot off
 quit

Then Windows 8.1 appeared again. I spent a few days on this problem. And will probably not be alone. It could be an important information when Mageia 5 will support UEFI.

For users having a new PC with windows 8.1 install, there is no other solution than installing linux in UEFI mode. Thus many users are concerned.

Reproducible: 

Steps to Reproduce:
Manuel Hiebel 2014-02-28 16:13:29 CET

CC: (none) => tmb
Assignee: bugsquad => thierry.vignaud

Thierry Vignaud 2015-03-16 12:57:28 CET

CC: (none) => thierry.vignaud
Assignee: thierry.vignaud => tmb

Comment 1 Thierry Vignaud 2015-03-16 13:19:30 CET
Pascal I think you know better where this is set...

CC: (none) => pterjan

Comment 2 Thierry Vignaud 2015-03-16 14:59:55 CET
We could add a new gpt_clear_pmbr_flafg() function to the c module that would call ped_disk_set_flag() in order to remove PED_DISK_GPT_PMBR_BOOT
Comment 3 Thierry Vignaud 2015-03-16 15:11:21 CET
eg:

int
set_disk_flag(char * device_path, PedDiskFlag flag, int state)
  CODE:
  PedDevice *dev = ped_device_get(device_path);
  RETVAL = 0;
  if(dev) {
      PedDisk* disk = ped_disk_new_fresh(dev, type);
      if(disk) {
        RETVAL = ped_partition_set_flag(part, flag, state);
        ped_disk_destroy(disk);
      }
    }
  }
  OUTPUT:
  RETVAL
Comment 4 Samuel Verschelde 2015-05-02 19:20:10 CEST
Thierry, tmb, is this bug fixed by what you did for Mageia 5RC and EFI support?

Keywords: (none) => NEEDINFO
Version: 4 => Cauldron

Comment 5 Thierry Vignaud 2015-05-02 20:52:23 CEST
I don't know but this needs testing anyway...
Comment 6 Samuel Verschelde 2015-05-02 20:59:41 CEST
Nicolas, please test with Mageia 5RC so that we can know if the problem is still present.
Comment 7 Thierry Vignaud 2015-05-07 13:51:12 CEST
Humm, FC does remove it on EFI:

https://github.com/rhinstaller/anaconda/commit/e22421be32db7c93d99915bc4d
https://bugzilla.redhat.com/show_bug.cgi?id=844551

(this code is now in blivet)

Hardware: i586 => All

Comment 8 Thierry Vignaud 2015-05-07 14:00:14 CEST
See:

https://github.com/rhinstaller/anaconda/commit/0880c84628ae673f467ed46acc
https://github.com/rhinstaller/blivet/blob/master/blivet/blivet.py#L193
# GPT labeled disks should only have bootable set on the
# EFI system partition (parted sets the EFI System GUID on
# GPT partitions with the boot flag)

https://github.com/rhinstaller/blivet/blob/master/blivet/formats/disklabel.py#L159
(when writing changes to disk)
# Set the boot flag on the GPT PMBR, this helps some BIOS systems boot
if self._partedDisk.isFlagAvailable(parted.DISK_GPT_PMBR_BOOT):
    # MAC can boot as EFI or as BIOS, neither should have PMBR boot set
    if arch.isEfi() or arch.isMactel():
        self._partedDisk.unsetFlag(parted.DISK_GPT_PMBR_BOOT)
        log.debug("Clear pmbr_boot on %s", self._partedDisk)
    else:
        self._partedDisk.setFlag(parted.DISK_GPT_PMBR_BOOT)
        log.debug("Set pmbr_boot on %s", self._partedDisk)
else:
    log.debug("Did not change pmbr_boot on %s", self._partedDisk)

Assignee: tmb => thierry.vignaud

Comment 9 Thierry Vignaud 2015-05-07 14:18:30 CEST
parted maps:
- its boot flag to partition having ESP GUID
- its pmbr_boot flag to partition record having bootindicator set to 0x80

We don't do anything explicitely for none.
Since we tell libparted ESP is of ESP types, it sets the proper GUID which is good.
As for pmbr_boot, we don't do anything.

Can you try Mga5 RC?
Comment 10 Thierry Vignaud 2015-05-29 13:46:33 CEST
Ping?
Comment 11 Thierry Vignaud 2015-06-02 12:10:34 CEST
According to Colin, https://bugs.mageia.org/show_bug.cgi?id=12740#c8, it could be grub2 that set the flag: "I suspect grub2 is at fault here for setting the flag"

CC: (none) => zen25000
See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=12740

Comment 12 Marja Van Waes 2017-09-20 09:31:08 CEST
Closing as OLD, because the requested feedback wasn't given

@ Nicolas Brouard

Please reopen this report if this bug still happens with a Mageia 6 install.

Status: NEW => RESOLVED
Resolution: (none) => OLD
CC: (none) => marja11


Note You need to log in before you can comment on or make changes to this bug.