Booting GPT part table via BIOS, bootable flag required in protective MBR

Mike Gabriel mike.gabriel at das-netzwerkteam.de
Wed Feb 9 12:05:32 CET 2022


Hi all, hi Thomas esp.,

for a school customer we set up a FAI environment recently and  
stumbled over a phenomenon that might required an adjust in FAI's  
partitioning tool.

We installed an HP notebook via BIOS mode using the partitioning rules  
given below. After FAI installation was successful, the notebook would  
not boot into the installed system. The notebook BIOS acted as if  
there was no system installed on the hard drive / SSD.

What fixed the problem was toggling the boot flag (i.e. enabling) on  
the first partition of the protective MBR (see at the very end of this  
mail).

The below data has been obtained from a VM installation. On the VM,  
the booting also works without above named bootable flag being set.

Is this something, we should amend in FAI's set-storage tool?

Mike



Our disk config we use is this:

```
disk_config  disk1  disklabel:gpt-bios bootable:1 fstabkey:uuid
primary  /boot/efi   512M         vfat    rw
primary  /boot       512M-2G      ext4    rw
primary  -           0-           -       -

disk_config lvm
vg  vg_system  disk1.3
vg_system-root   /      2G-4G     ext4  errors=remount-ro
vg_system-swap_1 swap   RAM:150%  swap  sw
vg_system-usr    /usr   28G-36G   ext4  defaults
vg_system-var    /var   8G-10G    ext4  defaults
```

A resulting partition table for this config is this:

```
root at test-workstation:~# fdisk -l  /dev/vda
Disk /dev/vda: 64 GiB, 68719476736 bytes, 134217728 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: gpt
Disk identifier: D35E0D51-44FC-42A5-AA8E-6F6EF5F42837

Device       Start       End   Sectors  Size Type
/dev/vda1     4096   1052671   1048576  512M EFI System
/dev/vda2  1052672   5126858   4074187  1.9G Linux filesystem
/dev/vda3  5126859 134215646 129088788 61.6G Linux LVM
/dev/vda4     2048      4095      2048    1M BIOS boot

Partition table entries are not in disk order.
```

For the same partition table the format.log looks like this:

```
root at test-workstation:~# cat /tmp/fai/format.log
Starting setup-storage 2.3
Using config file: /var/lib/fai/config/disk_config/LVM_EDU_ROAMING
Executing: wipefs -af /dev/vda4
Executing: wipefs -af /dev/vda1
Executing: wipefs -af /dev/vda2
Executing: vgchange -a y vg_system
Executing: wipefs -a /dev/vg_system/swap_1
Executing: lvremove -f /dev/vg_system/swap_1
Executing: vgchange -a y vg_system
Executing: wipefs -a /dev/vg_system/var
Executing: lvremove -f /dev/vg_system/var
Executing: vgchange -a y vg_system
Executing: wipefs -a /dev/vg_system/home
Executing: lvremove -f /dev/vg_system/home
Executing: vgchange -a y vg_system
Executing: wipefs -a /dev/vg_system/usr
Executing: lvremove -f /dev/vg_system/usr
Executing: vgchange -a y vg_system
Executing: wipefs -a /dev/vg_system/root
Executing: lvremove -f /dev/vg_system/root
Executing: vgchange -a n vg_system
Executing: vgremove vg_system
Executing: pvremove  /dev/vda3
Executing: wipefs -af /dev/vda3
Executing: wipefs -af /dev/vda3
Executing: parted -s /dev/vda mklabel gpt
Executing: parted -s /dev/vda mkpart primary "fat32" 2097152B 538968063B
Executing: parted -s /dev/vda set 1 boot on
Executing: parted -s /dev/vda mkpart primary "ext3" 538968064B 2624951807B
Executing: parted -s /dev/vda mkpart primary "" 2624951808B 68718411263B
Executing: parted -s /dev/vda mkpart primary "" 1048576B 2097151B
Executing: parted -s /dev/vda set 4 bios_grub on
Executing: mkfs.vfat  /dev/vda1
Executing: mkfs.ext4  /dev/vda2
Executing: parted -s /dev/vda set 3 lvm on
Executing: parted /dev/vda set 1 boot on
Executing: pvcreate -ff -y  /dev/vda3
Executing: vgcreate  vg_system  /dev/vda3
Executing: vgchange -a y vg_system
Executing: lvcreate  --yes -n root -L 2615.39721762767 vg_system
Executing: mkfs.ext4  /dev/vg_system/root
Executing: lvcreate  --yes -n swap_1 -L 2973.955078125 vg_system
Executing: mkswap  /dev/vg_system/swap_1
Executing: lvcreate  --yes -n usr -L 30941.5888705107 vg_system
Executing: mkfs.ext4  /dev/vg_system/usr
Executing: lvcreate  --yes -n var -L 10807.3972176276 vg_system
Executing: mkfs.ext4  /dev/vg_system/var
Executing: lvcreate  --yes -n home -L 15062.9800340777 vg_system
Executing: mkfs.ext4  /dev/vg_system/home
/dev/vda2 UUID=3463e974-58a5-4195-97b3-91a63c348ca3
/dev/vda1 UUID=B803-DF11
/dev/vg_system/home UUID=67fe2d5a-06cf-4bb1-bded-59fcab454e95
/dev/vg_system/var UUID=476eca23-14c3-49d9-9a98-b32d2dc068f6
/dev/vg_system/swap_1 UUID=3af7d13f-6b7f-4676-afc0-24273ad45477
/dev/vg_system/root UUID=40eb465f-0de1-400f-8fe1-59506e5f563d
/dev/vg_system/usr UUID=14d51891-168e-4227-a925-6def80496da4

```

This fixes the boot problem with GPT-BIOS partition table and the HP notebook:

```
root at test-workstation:~# fdisk /dev/vda

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/vda: 64 GiB, 68719476736 bytes, 134217728 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: gpt
Disk identifier: D35E0D51-44FC-42A5-AA8E-6F6EF5F42837

Device       Start       End   Sectors  Size Type
/dev/vda1     4096   1052671   1048576  512M EFI System
/dev/vda2  1052672   5126858   4074187  1.9G Linux filesystem
/dev/vda3  5126859 134215646 129088788 61.6G Linux LVM
/dev/vda4     2048      4095      2048    1M BIOS boot

Partition table entries are not in disk order.

Command (m for help): m

Help:

   GPT
    M   enter protective/hybrid MBR

   Generic
    d   delete a partition
    F   list free unpartitioned space
    l   list known partition types
    n   add a new partition
    p   print the partition table
    t   change a partition type
    v   verify the partition table
    i   print information about a partition

   Misc
    m   print this menu
    x   extra functionality (experts only)

   Script
    I   load disk layout from sfdisk script file
    O   dump disk layout to sfdisk script file

   Save & Exit
    w   write table to disk and exit
    q   quit without saving changes

   Create a new label
    g   create a new empty GPT partition table
    G   create a new empty SGI (IRIX) partition table
    o   create a new empty DOS partition table
    s   create a new empty Sun partition table


Command (m for help): M
Entering protective/hybrid MBR disklabel.

Command (m for help): p
Disk /dev/vda: 64 GiB, 68719476736 bytes, 134217728 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: 0x00000000

Device     Boot Start       End   Sectors Size Id Type
/dev/vda1           1 134217727 134217727  64G ee GPT


Command (m for help): a
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): w
The partition table has been altered.


-- 

DAS-NETZWERKTEAM
c\o Technik- und Ökologiezentrum Eckernförde
Mike Gabriel, Marienthaler Str. 17, 24340 Eckernförde
mobile: +49 (1520) 1976 148
landline: +49 (4351) 850 8940

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabriel at das-netzwerkteam.de, http://das-netzwerkteam.de

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 851 bytes
Desc: Digitale PGP-Signatur
URL: <http://lists.uni-koeln.de/pipermail/linux-fai/attachments/20220209/62300ab7/attachment.sig>


More information about the linux-fai mailing list