Page 1 of 1

Installing CentOS 7 manually on hybrid MBR/GPT systems

Posted: 2019/08/15 11:44:44
by lorn10
Hello to all!

Here follows a somewhat special topic about installing CentOS 7 at hybrid MBR/GPT based systems.
(https://www.rodsbooks.com/gdisk/hybrid.html)

Apple uses this principle on their Intel based computers since almost 13 years.

I am now stuck at the point that I have to install CentOS 7 manually in MBR mode. This can't be done with the CentOS installer, because Linux is more intelligent than Windows. ;) For example, when booting in legacy CSM "bios" mode, Windows doesn't care about any EFI partitions and is installing fine with old style MBR at the selected "Windows HD". When CentOS 7 is booting in legacy CSM mode it detects the EFI environment (from Mac OS X) and want to proceed on that way. The CentOS installer won't continue the installation with MBR style because it detects this partition layout as non-conformant. This is true in any other case, but not at hybrid MBR/GPT Apple systems.

Exist there now a way to enforce CentOS to use the MBR part of the hybrid MBR/GPT partition scheme? At the moment it looks like:

Code: Select all

sda 1  EFI System Partition
sda 2  HFS+
sda 3  HFS+
sda 4  / (includes root, boot, home)
sda 5  swap
The idea is to use partition 4 as main active "Linux HD". (Note, it could be possible that I had to kill sda 5 because of some strange limitations of the MBR/GPT scheme.)

As everybody knows, Apple uses at their Intel based systems quite special EFI implementations. First systems were EFI32 based, in 2007 Apple switched to EFI64 and since 2009 the iMac Models had more UEFI functions like GOP video implemented.

Well it is possible to install CentOS 7 alone at a blank SSD. Because there is no EFI information present, CentOS is installing fine in MBR mode.

The absolutely best would be to install CentOS 7 in native EFI mode. However, that's especially on older EFI32 based Apple systems a very hard task. There are some reports that this can work but it needs deeper Linux skills. Main problems are:

- Apple doesn't expose the vbios in EFI mode, it is only avaiable for a short time during power up
- EFI32 to EFI64 handover, for booting a 64bit CentOS 7 with a 64bit Intel C2D CPU on an EFI32 based system

The later one doesn't seems to be supported by GRUB, it could work with rEFInd. More information about that very complex topic can be found here: https://forum.artixlinux.org/index.php/ ... ml#msg4608

Re: Installing CentOS 7 manually on hybrid MBR/GPT systems

Posted: 2019/08/23 12:16:39
by lorn10
Here follows a little addition.

Also after intensive research I was not able to install CentOS 7. However, I was finally able to install Kubuntu 18.04 LTS and it runs awesome nice on that old, old Apple hardware! ;) (Well, this may be caused most likely because of the newly installed 1TB Mushkin SSD, - whatever.)

What is my conclusion so far? The CentOS installer is unfortunately very limited. For example, it does not allow a manual setting of the boot loader partition which is absolutely necessary in this context here. Furthermore the CentOS installer also rejects any non-standard conform MBR/GPT installation layout and blocks such installations. Also this is needed in this case with a hybrid MBR/GPT layout.

The Kubuntu/KDE installer allows the manual selection of the boot loader install partition. The installer is showing a warning when this is done. It notes that the installation will be most likely not bootable. There is furthermore also a warning that the "BIOS boot partition" is missing. Nevertheless the Kubuntu/KDE installer allows to continue the installation.

After the install is finished, it is necessary to boot up the first time through the rEFInd boot-loader (from CD, select EFI boot). There will be displayed Mac OS X and Linux. After selecting Linux, the iMac EFI settings will be automatically updated/corrected by rEFInd and Kubuntu is booting up. At the next restart, all bootable installations are available also from the stock Apple EFI boot-loader. Note, because Apple doesn't knows anything about Linux, - the Linux HD is named "Windows". :lol:

Important note, - you have to create and modify any disk partition layout changes always with the Apple disk utility. Do not use GParted for that because this will alter the MBR/GPT scheme. The Linux partitions must have the msftdata (Microsoft Basic Data partition) flag, this is necessary by Apple Boot Camp. The EXT4 root partition can have furthermore also additionally the "legacy_boot" flag. (This can be set later with GParted). According to the Microsoft perspective this makes the partition "active" and (MBR) bootable. Do NOT set the normal "boot" flag, only the EFI partition should have that flag.

My exact steps were:

1. Boot into Mac OS or a Mac OS install DVD, - run the Apple disk utility and set the preferred layout. On my 1TB SSD I decided me for:

Macintosh HD => 100GB (HFS+)
Linux HD => 892GB (exFAT)
swap => 8GB (exFAT)

Note, Mac OS 10.7 and higher will automatically add an OS X recovery partition, and also the EFI partition will be added if not present.

2. Boot into the Kubuntu Linux DVD. Select install, proceed until the partition configuration, and select manual.
Note, on older Apple computers the install DVD has to be remasterd to be bootable: https://bugs.launchpad.net/ubuntu-cdima ... omments/16

3. Select the "Linux HD", chose modify and format it with EXT4, it will became then automatically root /.

4. Select the swap partition, chose modify and select swap file format.

5. Select the partition for the boot files manually to the "Linux HD" which is in my case Partition 4. Continue the install, ignore any warning messages.

After booting the first time with rEFInd, - Kubuntu should work great. Thanks to the Kubuntu proprietary driver install option, also the Broadcom BCM94360CS (BCM4360) 802.11ac + BT 4.0 combo card is working perfectly. And thanks to the "isight-firmware-tools" package, also the Apple webcam can be used in conjunction with the iSight firmware file. If the iSight doesn't work at the first time, - it may be necessary to boot into Mac OS and start the "Photo Booth" app. It seems that in certain situations the iSight firmware has to be loaded in Mac OS (which runs in native EFI mode). I noticed this issue also on older iMac computers under Windows. After that, the iSight webcam worked on Windows, and it is also working in Linux.

Some final words regarding the partition scheme. Interestingly, Linux seems to be capable to use also in legacy MBR mode more than 4 primary partitions. Windows is definitely unable to do this. However, thanks to this behavior, it should be possible to set "home" to a separate partition. The GPT layout will then look like:

Code: Select all

sda 1  EFI System Partition
sda 2  HFS+ (Macintosh HD)
sda 3  HFS+ (recovery HD)
sda 4  / (includes root, boot)
sda 5  home
sda 6  swap
As mentioned, this hybrid MBR/GPT layout will be limited at the MBR side to:

Code: Select all

sda 1  EFI System Partition
sda 2  HFS+ (Macintosh HD)
sda 3  HFS+ (recovery HD)
sda 4  / (includes root, boot)