Yep, it’s a new year, and a time to put that old Mac hardware to proper new use….. by installing Linux. Of course!
This video guide shows you how to get an installation set up on a Macbook Pro (this particular one is a Late 2013 Retina one, however should work for all Macs from ). It shows how WiFi doesn’t work out of the box, and how to fix that. Be prepared to have a USB wifi ethernet dongle or some other form of getting connected so you can get your WiFi drivers installed!
The basis of this guide is rooted in our comprehensive guide on installing Linux on a mac, which you should check out for any further information, as it covers everything from partitioning your drive, unlocking disk encryption more. If you run into any bothers, start there.
Without further ado, here’s the video howto:
Other Things you will want to sort out…
Unfortunately, Apple don’t favour an open hardware or software ecosystem. In fact, I’d argue that they grow more proprietary and locked down every year, which is why I wanted to switch from macOS to Linux on my Macbook in the first place. The hardware is great, but it is propriatery, and that means that getting the slightly more esoteric things going, isn’t just out of the box in most cases. Fortunately most of the things I found that were an issue before (Keyboard lights, suspend/resume, dual monitors and sound) have basically been fixed by the community over the years, as there are now plenty of people using macs with Linux. However, many still say they can’t get their FaceTime webcam working, and they also report issues with performance – the CPU chewing up 80-100% on one core. Read the following points on how to fix these issues.
If, like me, you notice that the mac starts running hot and the CPU fans are burning away then have a look at the output of the CPU history in the resources view of the System Monitor app (or using top at the terminal), you’ll probably find that a ‘kworker’ process is chewing up CPU. This is a well known bug, so to fix this, run the following commands at the terminal:
$sudo -s grep . -r /sys/firmware/acpi/interrupts/
You’ll see a list of probably 70 or so lines relating to the firmware that works with ACPI (Advanced Configuration and Power Interface). Most of these are doing their thing quite happily, but you’ll find one of them that has a number like gpe16 has a large number beside it. It’ll look like this:
/sys/firmware/acpi/interrupts/gpe16: 225420 STS enabled unmasked
When you think you’ve found it, you can simply disable it, but first, just back up the file, just in case you make the wrong change. Note I am using gpe16 as that’s the one I found the problem with, yours is probably different:
cp /sys/firmware/acpi/interrupts/gpe16 /root/gpe16.backup echo "disable" > /sys/firmware/acpi/interrupts/gpe16
If after a few seconds, the CPU fans stop whirring as much, and top/system monitor starts showing normal usage statistics, then you know its the right one. If it isn’t the right one simply echo “enable”, rather than disable.
To make the change permanent, do the following tasks, again at the terminal, changing the value ’16’ to the value you used:
# crontab -e --Add the below line to the crontab, so it will be executed every startup/reboot: @reboot echo "disable" > /sys/firmware/acpi/interrupts/gpe16 -- Save/exit. Then, to make it work also after wakeup from suspend: # touch /etc/pm/sleep.d/30_disable_gpe16 # chmod +x /etc/pm/sleep.d/30_disable_gpe16 # vim /etc/pm/sleep.d/30_disable_gpe16 -- Add this stuff: #!/bin/bash case "$1" in thaw|resume) echo disable > /sys/firmware/acpi/interrupts/gpe16 2>/dev/null ;; *) ;; esac exit $?
FaceTime HD Camera:
You’ll need the FaceTime HD module for your kernel. It’s a bit of a pain in the butt to get going, but it does go once you’ve set it up. Full documentation is here: https://github.com/patjak/bcwc_pcie/wiki/Get-Started#get-started-on-ubuntu
Here are the steps I followed to get everything working on Ubuntu. You need to be running a fairly recent version of Ubuntu (16.04 onwards should be fine), so 18.10 will be no worries. You’ll need to run all the following commands from the Terminal.
$ indicates running the command as a normal user
$ indicates running the command as a normal user
# indicates as root (use the sudo command), eg: $sudo apt-get install …
- Install the dependencies :
# apt-get install linux-headers-`
uname -r`git kmod libssl-dev checkinstall curl xzcat cpio
- Extract and install the firmware file:
$ git clone https://github.com/patjak/bcwc_pcie.git
$ cd bcwc_pcie/firmware
sudo make install
- The output should say ‘
Copying firmware into '/usr/lib/firmware/facetimehd'
- Now you need to build the kernel module (driver). Change into that dir:
$ cd ..
- (you should now be in the bcwc_pcie folder)
- Build the kernel module:
- Generate dkpg and install the kernel module, this is easy to uninstall later:
Run depmod for the kernel to be able to find and load it:
- Load kernel module:
# modprobe facetimehd
- Try it out by installing like ‘cheese’ and seeing if your webcam works.
/dev/video does not exist
I had a problem with the driver at this point, where /dev/video was not there, which was easily fixed by performing the following steps:
In some scenarios, you’ll have to unload
bdc_pci before inserting the kernel module, or
/dev/video0) won’t be created. Do this with
modprobe -r bdc_pci. If you’ve already done a modprobe facetimehd, also do a modprobe -r facetimehd, before re-running modprobehd. This fixed the issue for me.
Making the camera work on startup
If you want the driver to be enabled on startup, extra steps may be required. On Ubuntu, the following should work:
$sudo echo facetimehd >> /etc/modules
sudo gedit /lib/systemd/system-sleep/99facetimehd or if /lib/systemd/system-sleep does not exist:
sudo gedit /usr/lib/systemd/system-sleep/99facetimehd
Paste this in the empty file:
case $1/$2 in
echo "Going to $2..."
modprobe -r facetimehd
echo "Waking up from $2..."
modprobe -r bdc_pci
Make it executable:
sudo chmod a+x /lib/systemd/system-sleep/99facetimehd or
sudo chmod a+x /usr/lib/systemd/system-sleep/99facetimehd
Making sure when you update your system your facetimehd driver updates too
When you perform a system update in Ubuntu, it often updates the Kernel too. When you update the kernel, the modules need to be upgraded to work with that Kernel version. As you’ve build a custom module, you’ll need to ensure that the module is up to date too. Here’s how to do that:
You will need to verify
dkms.conf that the module name
facetimehd and version number
0.1 are correct and either update the
dkms.conf or adjust the instructions where
-v are used.
- Install needed packages:
# apt install debhelper dkms
- Remove old package if installed:
# dpkg -r bcwc-pcie
- Make a directory to work from:
# mkdir /usr/src/facetimehd-0.1
- Change into the git repo dir:
$ cd bcwc_pcie
- Copy files over:
# cp -r * /usr/src/facetimehd-0.1/
- Change into that dir:
# cd /usr/src/facetimehd-0.1/
- Remove any previous debs and backups:
# rm backup-*tgz bcwc-pcie_*deb
- Clear out previous compile:
# make clean
- Register the new module with DKMS:
# dkms add -m facetimehd -v 0.1
- Build the module:
# dkms build -m facetimehd -v 0.1
- Build a Debian source package:
# dkms mkdsc -m facetimehd -v 0.1 --source-only
- Build a Debian binary package:
# dkms mkdeb -m facetimehd -v 0.1 --source-only
- Copy deb locally:
# cp /var/lib/dkms/facetimehd/0.1/deb/facetimehd-dkms_0.1_all.deb /root/
- Get rid of the local build files:
# rm -r /var/lib/dkms/facetimehd/
- Install the new deb package:
# dpkg -i /root/facetimehd-dkms_0.1_all.deb
If you have any trouble, please read this guide on making a DKMS package:http://www.xkyle.com/building-linux-packages-for-kernel-drivers/