[Bug 1369187] Re: Installation on Macs could use EFI booting instead of legacy BIOS

Jack Howarth 1369187 at bugs.launchpad.net
Fri Dec 16 06:54:02 UTC 2016


I have successfully installed Debian Jessie using the multi-arch netinst
iso

https://cdimage.debian.org/debian-cd/current/multi-arch/iso-
cd/debian-8.6.0-amd64-i386-netinst.iso

which leverages the new mixed mode support described in
https://wiki.debian.org/UEFI

Support for mixed-mode systems: 64-bit system with 32-bit UEFI
Some systems have been released containing 64-bit Intel Atom CPUs (such as the Bay Trail), but unfortunately use 32-bit UEFI firmware with no BIOS compatibility mode. Using the 32-bit UEFI x86 support, an i386 installation should be possible on these machines but it won't make the most of the 64-bit hardware.

Debian Jessie (8.0) was the first Linux distribution to include full
support for mixed-mode UEFI installation on these machines. The multi-
arch installation media (available in netinst and DVD form) include the
UEFI boot loaders necessary for both i386 and amd64 boot. By selecting
"64-bit install" from the initial boot menu, debian-installer will
install a 64-bit (amd64) version of Debian. The system will
automatically detect that the underlying UEFI firmware is 32-bit and
will install the appropriate version of grub-efi to work with it.

The resulting Debian Jessie install was transitioned to Ubuntu 16.10
by...

1) replacing the /etc directory with a copy from a fresh Ubuntu 16.10 x86_64 install while retaining copies of the fstab, shadow and passwd files generated by the Debian Jessie installation.
2) Using 

apt-get -f update
apt-get clean
for pkg in `dpkg --get-selections | awk '{print $1}' | egrep -v '(dpkg|apt|mysql|mythtv)'` ; do apt-get -y  -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" --force-yes install --reinstall $pkg ; done


At this point, the only problem remaining was that the boot selector doesn't detect the Ubuntu installation. I solved this by reformatting the /boot/efi partition as HFS+ with journaling disabled so that Linux could access it for writing. I then used the following script to generate the appropriate boot.ef in /tmp, depending on whether the machine has EFI-32 or EFI-64 firmware, and then installed in /boot/efi/System/Library/CoreServices along side the SystemVersions.plist installed from the current mactel-boot package files and a /boot/efi/mach_kernel file. Lastly the script blesses the newly installed boot.efi.

#!/bin/bash -ex
# update-efi-booter script
pushd /
grub-mkconfig -o /boot/grub/grub.cfg
efi_arch="x86_64"
coreservices_dir="/boot/efi/System/Library/CoreServices/"
boot_efi_dir="/boot/efi/"
mactel_boot_dir="/usr/share/mactel-boot/"
mactel_boot_logo_dir="/usr/share/mactel-boot-logo/"
grep -q "32" /sys/firmware/efi/fw_platform_size && efi_arch="i386"
echo 'Creating boot.efi for '$efi_arch
case "$efi_arch" in
x86_64)
  grub-mkstandalone -o /tmp/boot.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress=xz boot/grub/grub.cfg
  ;;
i386)
  grub-mkstandalone -o /tmp/boot.efi -d usr/lib/grub/i386-efi -O i386-efi --compress=xz boot/grub/grub.cfg
  ;;
esac
echo 'Installing boot.efi for '$efi_arch 
mount -t hfsplus -o force,remount,rw $boot_efi_dir && sleep 1
test ! -d $coreservices_dir && install -d $coreservices_dir
install -m 644 /tmp/boot.efi $coreservices_dir
test ! -f $boot_efi_dir/.VolumeIcon.icns && -f $mactel_boot_logo_dir/ubuntu.icons && install -m 644 $mactel_boot_logo_dir/ubuntu.icns $boo
t_efi_dir/.VolumeIcon.icns
test ! -f $boot_efi_dir/mach_kernel && echo "This file is required for booting" > $boot_efi_dir/mach_kernel
test ! -f $coreservices_dir/SystemVersion.plist && -f $mactel_boot_dir/SysytemVersion.plist && install -m 644 $mactel_boot_dir/SystemVersi
on.plist $coreservices_dir
hfs-bless $coreservices_dir/boot.efi && sleep 1 && mount -t hfsplus -o remount $boot_efi_dir


** Attachment added: "script to automate the generation and installation of the appropriate architecture boot.efi into a HFS+ formatted /boot/efi partition"
   https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1369187/+attachment/4792306/+files/update-efi-booter

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to debian-installer in Ubuntu.
https://bugs.launchpad.net/bugs/1369187

Title:
  Installation on Macs could use EFI booting instead of legacy BIOS

Status in debian-installer package in Ubuntu:
  Confirmed
Status in ubiquity package in Ubuntu:
  Confirmed

Bug description:
  I recently installed Ubuntu 14.04.1 LTS (Trusty) on my Mac Mini 6,1
  using the server installer. First I tried the "+mac" variant, which
  gave me a system that booted in legacy BIOS mode, and then then I
  tried the normal variant, which gave me an unbootable system.

  I eventually got the EFI installation working, resulting in an Ubuntu
  installation that boots directly from the Mac bootloader firmware (ie.
  no rEFInd/rEFIt). The basic steps are to use an HFS+ filesystem
  instead of VFAT for the EFI partition, to "bless" the EFI boot image,
  and to create a couple of files that the Mac bootloader requires.

  I wrote the full procedure up as a guide:

  http://heeris.id.au/2014/ubuntu-plus-mac-pure-efi-boot/

  While my guide only covers single-boot into Ubuntu on a Mac Mini, I
  hope there's enough detail there to illustrate what's needed for a
  more general case.

  Note that grub-efi-amd64 already does the right thing (except for
  Debian bug #716927 [1]). The only tool that isn't already in the repos
  is the mactel-boot utility (aka. hfsbless), which I've made available
  in my PPA[2] (see also the Github repo[3], which has the Ubuntu
  packaging metadata in various branches, and is git-buildpackage
  friendly).

  So it should be possible to install Ubuntu in EFI mode on Macs. This
  would reduce the options presented to a user when downloading the
  installer, and result in a more consistent experience for users across
  Windows and Mac.

  [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=716927#20
  [2] https://launchpad.net/~detly/+archive/ubuntu/mactel-utils
  [3] https://github.com/detly/mactel-boot

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/debian-installer/+bug/1369187/+subscriptions



More information about the foundations-bugs mailing list