Skip to content

Instantly share code, notes, and snippets.

@chideat
Forked from jhaubrich/Arch Linux on a macbook.org
Created February 13, 2017 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chideat/9d339a5413f5a729b620f25ac98e647a to your computer and use it in GitHub Desktop.
Save chideat/9d339a5413f5a729b620f25ac98e647a to your computer and use it in GitHub Desktop.
Arch Linux on my MacBook 11,3

Arch Linux on a MacBookPro 11,3

Read The Arch Way, fall in.

Still Todo

I can’t believe how smoothly this went…

  • suspend - seems to work after installing gnome, pm-suspend works too… I have my eye on you. <.<
    • systemctl suspend works, but doesn’t wake properly.
  • power management
  • trackpad
  • wireless network management from gnome (graphical)
  • LCD backlight is stuck on max, fix in rc.local not running on boot.
  • <strike>keyboard backlight doesn’t dim, but can be controlled.</strike> Magically working.
  • <strike>Dropbox nautilus icon badges</strike>
  • etckeeper

Installation

The Arch wiki is a wonderful resource. Start with the [Beginner’s guide](https://wiki.archlinux.org/index.php/Beginners%27_guide) and refer to the [arch macbook wiki](https://wiki.archlinux.org/index.php/MacBookPro11,x) page for specifics.

Make a USB Stick from OSX

reference from the arch wiki

sudo dd if=/path/to/downloaded.iso of=/dev/disk1 bs=1m 

Make Room

Use the graphical Disk Utility in OS X to resize the OS X partition. I left a large unpartitoned space for arch.

From Arch I used cfdisk to create the following. I’m not sure having partitions for /var and /home give offer the advantages they did on magnetic storage. There’s a whole Arch wiki entry dedicated to filesystems on SSD. Worth the read.

mountsizefs
/150Gbtrfs
/boot500Mext2

Install GRUB

I generated a standalone grub boot.efi and copied it over to the native mac efi partition, /sda1, using these instructions. This seemed like the easiest thing to do for now. I will look into one of the other methods later.

# From memory
pacman -S grub
# add libata.force=noncq to /etc/defaults/grub.conf
cd /boot
grub-mkconfig -o grub/grub.cfg 
mount /dev/sda1 /mnt
grub-mkstandalone -o bootx64.efi /usr/lib/grub/x86_64-efi -O x86_64-efi /boot/grub/grub.cfg
cp bootx64.efi /mnt/EFI/boot/bootx64.efi

I made a script and stuck it in boot since you’ll have to do the following whenever you make changes to grub.

[root@Flexo boot]# cat grub-mkstandalone.sh 
#!/bin/sh -ex

grub-mkstandalone -o bootx64.efi /usr/lib/grub/x86_64-efi -O x86_64-efi /boot/grub/grub.cfg
cp bootx64.efi /mnt/EFI/boot/bootx64.efi

Later…

I wanted the macbook to boot into arch by default. And I wanted Grub. After much googling without any help I decided to throw caution to the wind and just install grub. It worked. Grub comes up after powering on, and if you hold down alt you can select OS X from apple’s bootloader. This is what I did.

sudo mount /dev/sda1 /mnt
sudo grub-install --efi-directory=/mnt/ --recheck --debug

I’m not exactly sure what happened. Grub created EFI/arch/grubx64.efi on /dev/sda1. I determined it is safe to delete the old /EFI/boot directory.

I enlarged the grub font to test the whole grub process start to finish. This is what I did.

sudo mount /dev/sda1 /mnt
sudo grub-mkfont -s 22 -o /boot/grub/ubuntumono.pf2 /usr/share/fonts/TTF/UbuntuMono-R.ttf
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo grub-install --efi-directory=/mnt/ --recheck --debug

Setup

Welcome to your new Linux system.

Thunderbolt Ethernet

Works out of the box, hotswappable and everything!

ip link set ens9 up

Wireless Networking

Worked dandy after installing broadcom-wl from the AUR.

yaourt -S broadcom-wl
pacman -S wpa_supplicant  # may require restart
wifi-menu

Netctl is cool, but NetworkManager is probably the way to go on a laptop.

pacman -Rdds netctl
pacman -S networkmanager
pacman -S network-manager-applet  # gnome
sudo systmectl disable netctl  # I think
sudo systemctl enable NetworkManager 

Besides the applet, you also get a cli, nmcli, and an ncurses app, nmtui.

Retina support

install terminus font for the virtual console.

pacman -S terminus-font
setfont ter-u32n

And some window manager advice.

Power Management

Works out of the box. Gnome reports the battery state, and suspends automatically after inactivity. pm-suspend from pm-utils <strike>will do it from the command line</strike> stopped working. systemctl suspend suspends, but the display does not come on with wake.

Check out powertop. Nvidia drivers do better than nouveau, bumblebee is probably worth looking into.

update: pm-suspend is working now! The lid switch was bouncing or usb was waking it.

Removing the lid and USB3 from the acpi awake list seems to have fixed this.

jhaus@flexo ~ % cat /proc/acpi/wakeup                 
Device	S-state	  Status   Sysfs node
P0P2	  S3	*disabled  pci:0000:00:01.0
GFX0	  S3	*disabled  pci:0000:01:00.0
PEG1	  S3	*disabled  pci:0000:00:01.1
EC	  S4	*disabled  platform:PNP0C09:00
GMUX	  S3	*disabled  pnp:00:03
HDEF	  S3	*disabled  pci:0000:00:1b.0
RP03	  S3	*disabled  pci:0000:00:1c.2
ARPT	  S4	*disabled  pci:0000:03:00.0
RP04	  S3	*disabled  pci:0000:00:1c.3
RP05	  S3	*disabled  pci:0000:00:1c.4
XHC1	  S3	*enabled   pci:0000:00:14.0
ADP1	  S4	*disabled  platform:ACPI0003:00
LID0	  S4	*enabled   platform:PNP0C0D:00

jhaus@flexo ~ % echo LID0 | sudo tee /proc/acpi/wakeup
jhaus@flexo ~ % echo XHC1 | sudo tee /proc/acpi/wakeup

jhaus@flexo ~ % cat /proc/acpi/wakeup                 
Device	S-state	  Status   Sysfs node
P0P2	  S3	*disabled  pci:0000:00:01.0
GFX0	  S3	*disabled  pci:0000:01:00.0
PEG1	  S3	*disabled  pci:0000:00:01.1
EC	  S4	*disabled  platform:PNP0C09:00
GMUX	  S3	*disabled  pnp:00:03
HDEF	  S3	*disabled  pci:0000:00:1b.0
RP03	  S3	*disabled  pci:0000:00:1c.2
ARPT	  S4	*disabled  pci:0000:03:00.0
RP04	  S3	*disabled  pci:0000:00:1c.3
RP05	  S3	*disabled  pci:0000:00:1c.4
XHC1	  S3	*disabled  pci:0000:00:14.0
ADP1	  S4	*disabled  platform:ACPI0003:00
LID0	  S4	*disabled  platform:PNP0C0D:00

TODO: Laptop-mode-tools caused strange behavior, should look at it again later. note: not sure if acpid is installed or not, I removed it with yaourt -Rdd acpid but acpid is still available, and so is acpi_listen; which is great for reading acpi_events.

Backlight

This worked.

sudo setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0

Add it to /etc/rc.local to make it stick.

Dropbox

Its in the AUR. Also get nautilus-dropbox for icon badges in nautilus.

Seiki 4k Monitor

Reference.

Works out of the box at low resolution. We just need to add the following xorg entry to /usr/share/X11/xorg.conf.d/10-monitor.conf

Section "Monitor"
  Identifier "Monitor0"
  Modeline "3840x2160" 165.00 3840 3888 3920 4000 2160 2163 2168 2222 +hsync +vsync
EndSection
Section "Screen"
  Identifier "Screen0"
  Device "HDMI-0"
  Option "ModeValidation" "AllowNon60hzmodesDFPModes, NoEDIDDFPMaxSizeCheck, NoVertRefreshCheck, NoHorizSyncCheck, NoDFPNativeResolutionCheck, NoMaxSizeCheck, NoMaxPClkCheck, AllowNonEdidModes, NoEdidMaxPClkCheck"
  Monitor "Monitor0"
  DefaultDepth 24
  SubSection "Display"
    Depth 24
    Modes "3840x2160" "1920x1080"
  EndSubSection
EndSection

This monitor also goes to sleep every 4 hours, which is annoying. Even more so since I have to kill X to get it to come back.

> To disable this, go to the service menu (Menu + 0000), then select “Others”, then scroll down past the bottom item (or scroll up previous to the top since it wraps) to expose the next page of the menu (not obvious it’s there!) and turn off “4Hours Auto Standby”. reference.

Fonts

Disable bitmap fonts that are sometimes used for missing fonts.

ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d/

I also disabled gdm on boot because of the stern warning about an inoperable system if these packages get out of sync.

Additional fonts

Extra

  • ttf-bitstream-vera - Bitstream vera fonts
  • ttf-dejavu - Font family based on the Bitstream Vera Fonts with a wider range of characters

Community

  • ttf-inconsolata - Monospace font for pretty code listings and for the terminal
  • ttf-liberation - Red Hats Liberation fonts.
  • ttf-ubuntu-font-family - Ubuntu font family

AUR

  • otf-exo - A geometric sans serif font with a technological feel
  • ttf-lato - a sanserif type­face family
  • ttf-opensans - Open Sans is a humanist sans serif typeface designed by Steve Matteson, Type Director of Ascender Corp.
  • ttf-mac-fonts - Mac fonts including Lucida Grande, Apple Garamond and other fonts from Apple
  • ttf-win7-fonts - Microsoft Windows 7 TrueType Fonts

Gnome Topbar was oversized

sudo vim /usr/share/gnome-shell/theme/gnome-shell.css

then in that file right in the begining you’ll see

/* default text style */ 
stage { 
   font-family: cantarell, sans-serif; 
   font-size: 11pt; 
   color: white; 
} 

Change font-size: 11pt to font-size: 9pt

press alt + F2 and enter r and press enter

Spell Checking

Spell checking wasn’t working in firefox or anywhere. hunspell was installed already, not sure if its in core or what. Just needed a dictionary. Now spell checking works everywhere.

yaourt hunspell-en

Virtual console had wrong keymap

Show locals with localectl status. Edit the following to make it permanent.

KEYMAP=colemak

rc.local

What this guy said.

Put this in /usr/lib/systemd/system/rc-local.service.

[Unit]
Description=/etc/rc.local compatibility

[Service]
Type=oneshot
ExecStart=/etc/rc.local
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Enable it:

systemctl enable rc-local.service

Backlight

The backlight works after starting gnome, but since I’m not running gnome I ended up with the following.

xfce-power-manager and writing to /sys/class/backlight/gmux_backlight/brightness works after running the setpci command.

tee /sys/class/backlight/gmux_backlight/brightness <<< 5

I put this into /etc/rc.local, and made an rc.local service

#!/bin/bash
setpci -v -H1 -s 00:01.00 BRIDGE_CONTROL=0

I also added to the device section of xorg.conf.

Option         "RegistryDwords"   "EnableBrightnessControl=1"

I also added video.use_native_backlight=0 to grub’s kernel line, but I don’t think it did anything. Pretty sure, actually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment