Running Debian from an USB stick on a MacBook Pro

Yeah well, it happened. In my last post I was excited to get back to a BSD UNIX (FreeBSD) for my laptop, I thought I had fought the worse when rebuilding kernel and world in order to have a working DRM module for the Intel Iris 6100 that is bundled with this MacBook Pro generation. But I was wrong. None of the BSDs around had support for the BCM43602 chip that provides WiFi to the laptop. What’s the point of a laptop without WiFi…

So I turned my back at FreeBSD again and as usual, gave a shot at Debian GNU/Linux.

I won’t go through the installation process, you all know it very well and at the end of the day, the only issue is, as often, suspend and resume which seemed to have been broken since kernel 4.9 and superiors.

As for my last post, I’ll only point out how to make an USB stick act as a bootable device used as an additional hard drive with a MacBook Pro.
The puzzle is again EFI and how to prepare the target partitions in order for the Mac to display the USB stick as a bootable choice. The first thing to do is to prepare the USB drive with a first partition than will hold the EFI data. Using gparted I created a vfat partition of 512MB which seems to be the recommended size.


EFI partition

And pick the boot and esp flags:


boot flags

Now assuming the machine you’re preparing the key on is an Ubuntu or the like (I’m using Linux Mint), install the grub-efi-amd64-signed package, create an efi/boot directory at the root of the key, and copy the EFI loader provided by the previously installed package:

1
2
3
4
# apt-get install grub-efi-amd64-signed
# mount -t vfat /dev/sdc1 /mnt
# mkdir -p /mnt/efi/boot
# cp /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed /mnt/efi/boot/bootx64.efi

Now the trickiest part, this grub EFI loader expects the grub.conf part to reside on an ubuntu directory in the efi directory, because it has been built on an Ubuntu system and that is the value of the prefix parameter.

1
2
3
4
5
6
7
8
9
10
# mkdir /mnt/efi/ubuntu
# cat >/mnt/efi/ubuntu/grub.cfg<<EOF
timeout=20
default=0

menuentry "Debian MBP" {
root=hd0,2
linux /vmlinuz root=/dev/sdb2
initrd /initrd.img
}

And there you go, simply install Debian using kvm or any virtualization system on the second partition formatted as plain ext4 and you’re set, don’t worry about the installer complaining there’s no boot or swap partition, you definitely don’t want to swap on your USB key.


Debian 9 on the MacBook Pro