Macbook

From Void Linux Wiki
Jump to: navigation, search
Note: Please keep an extra USB drive handy. It is required for installing additional firmware on your MacBook, if it does not have a dedicated Ethernet port.

Installing Void Linux on MacBook is fairly straightforward. Most of the things work out of the box, but some things do require tweaking. Following this guide carefully will provide you with a stable Void Linux setup on your MacBook.

The installation has been tested on all variants of MacBook Pro (2011-2013).


Getting Started

To install Void Linux on a MacBook Pro, download the latest ISO available in the repository:

   https://repo.voidlinux.eu/live/current/

After downloading, Burn the ISO to a CD/DVD or write the files on a USB stick. You do not need to follow this guide if you plan on using the distribution inside a VM.

Note: The flavor that you choose to download will be the flavor that is installed along with the operating system.

Creating a bootable USB media

To create a bootable USB, we will be using dd. Depending on the Operating System you are currently using, this step might vary slightly.

GNU/Linux

Use the following command to create a bootable USB media on GNU/Linux:

   $ sudo dd if=/path/to/void-live-<flavor>.iso of=/dev/sdX bs=1M

Make sure to replace /dev/sdX with your USB device. You may increase the size under bs, but 1M is suggested.

MacOS

Use the following command to create a bootable device on MacOS:

   $ sudo dd if=/path/to/void-live-<flavor>.iso of=/dev/sdX bs=1m

Make sure to replace /dev/sdX with your USB device. You may increase the size under bs, but 1M is suggested. Also, make note of the character "m" while specifying bs. This is because dd on MacOS differs from the GNU dd command.

If you get any errors regarding this, you might be using GNU dd. Try replacing "m" with "M".

Installation

All the newer MacBooks have Wikipedia-logo.png UEFI support, so booting the device in UEFI mode should work fine for the installation.

Booting into USB media

To boot into the newly created USB media, hold down the option key while booting. You should now be able to choose from multiple drives. Choose the USB media device on which the void installation image has been flashed.

Booting into a CD/DVD

To boot into the CD/DVD media, hold down the "c" key while booting. This should boot right into the CD/DVD.

Installing the Void

The installation process is streamlined. In UEFI mode, we need to create a ESP partition /boot/efi, optimally of the size 512MB.

If you want the "suspend on closing lid" feature to work on the system, you need to create a swap partition. A swap of size 4GB should be enough and is recommended.

Please follow the UEFI Installation instructions for further details, and return to this page after the process is complete.


Note: If your version of MacBook does not have an ethernet port, Void Linux supports offline installation. WiFi does not work out of the box and needs configuration.

Post Installation

The device should be successfully booting into the OS at this point in time. Although, a few tweaks will be required for a stable system.

Setting Up Network

The network might not be working if you do not have a dedicated Ethernet port on your MacBook. To fix this, we will be installing the WiFi drivers for BCM43XX devices.

Download the following packages on another computer and transfer it to a USB Device.

Note: We will be installing connman in this guide, as it supposedly provides the best stability on Macbooks. You are free to choose from other connection managers out there, like NetworkManager.
  • b43-fwcutter:
 https://repo.voidlinux.eu/current/b43-fwcutter-019_2.x86_64.xbps
  • broadcom-wl firmware:
 http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2
  • connman:
 https://repo.voidlinux.eu/current/connman-1.35_1.x86_64.xbps
  • dbus:
 https://repo.voidlinux.eu/current/dbus-1.12.2_1.x86_64.xbps

Given that you have mounted the USB device on your Void Linux setup, run the following commands to install b43-fwcutter:

 # xbps-install /path/to/b43-fwcutter.xbps

After the installation is complete, run the following commands to setup the broadcom-wl drivers:

 # export FIRMWARE_INSTALL_DIR="/usr/lib/firmware"
 # tar xjf broadcom-wl-5.100.138.tar.bz2
 # b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" broadcom-wl-5.100.138/linux/wl_apsta.o

This should enable wifi on the device, but we still need to install some things to get the WiFi working. There are many different WiFi managers available, but connman provides by far the best stability. To install connman:

 # xbps-install connman

We then need to symlink the process in order to enable it

 # ln -s /etc/sv/connmand /var/service/
 # ln -s /etc/sv/dbus /var/service/

connman should now be working, but we still need to connect to a wireless network.

 # connmanctl
 connmanctl> enable wifi
 enabled wifi
 connmanctl> agent on
 agent registered
 connmanctl> scan wifi
 Scan completed for wifi
 connmanctl> connect <wifi-SSID>

If all goes well, it should prompt you to enter the wifi passphrase, after which you should be connected to the wireless network and have a working wifi.

Graphical User Interface

Note: If you chose any of the Desktop Environment flavors, or if you do not need any GUI to your installation, you may skip to the next step.

To have a usable GUI environment, we need to install the xorg server and a desktop environment or a window manager.

Installing Xorg Server

Installation of Xorg Server is really easy. The X server is provided as two different packages on Void Linux, xorg and xorg-minimal.

The xorg package contains all of the components for the Xorg Server, whereas the xorg-minimal package contains bare minimal components required to run X server.

  • To install the base xorg package:
   # xbps-install -S xorg xterm

The xterm package provides a terminal for the X Server.

  • To install the xorg-minimal package:
   # xbps-install -S xorg-minimal xorg-fonts xf86-video-intel

The xf86-video-intel package provides Intel Graphics Driver for the Intel based cards.

To install drivers for AMD and Nvidia based video cards, refer to Proprietary Video Drivers Installation Instructions.

Desktop Environment/Window Manager

Void Linux provides many options for installing desktop environment or a window manager.

Considering a minimal installation, we will install i3wm.

 # xbps-install i3 i3lock i3status dmenu

After installing a Window Manager or a Desktop Environment, we need to enable it.

 # echo "exec i3" >> .xinitrc

Now, you can start i3wm by executing startx

Note: You might want to check out some i3wm configuration, here[1] is a good guide for beginners.

Fixing the Trackpad

If you chose any Desktop Environment or Window Manager, you will see that the Trackpad on the MacBook does not work as intended, and the cursor only moves up and down. This can be fixed with an easy driver installation.

We will be installing the xf86-input-mtrack touchpad driver, as it provides the best MacBook experience.

 # xbps-install -S xf86-input-mtrack
 # mkdir -p /etc/X11/xorg.conf.d

Now, we need to setup the trackpad with custom settings. To do so, we need to edit a file at /etc/X11/xorg.conf.d/ and save it as 50-synaptics.conf The following settings provide a smooth, near-MacBook trackpad experience with tap to click, 2-finger scrolling and 3-finger-swipe to go back:

 Section "InputClass"
       MatchIsTouchpad "on"
       Identifier      "Touchpads"
       Driver          "mtrack"
       Option          "Sensitivity" "0.55"
       Option          "FingerHigh" "6"
       Option          "FingerLow" "1"
       Option          "IgnoreThumb" "true"
       Option          "IgnorePalm" "true"
       Option          "ThumbRatio" "70"
       Option          "ThumbSize"  "25"
       Option          "TapButton1" "1"
       Option          "TapButton2" "3"
       Option          "TapButton3" "2"
       Option          "TapButton4" "0"
       Option          "ClickFinger1" "1"
       Option          "ClickFinger2" "3"
       Option          "ClickFinger3" "3"
       Option          "ButtonMoveEmulate" "false"
       Option          "ButtonIntegrated" "true"
       Option          "ClickTime" "25"
       Option          "BottomEdge" "25"
       Option          "SwipeLeftButton" "9"
       Option          "SwipeRightButton" "8"
       Option          "SwipeUpButton" "0"
       Option          "SwipeDownButton" "0"
       Option          "ScrollDistance" "75"
       Option          "ScrollUpButton" "5"
       Option          "ScrollDownButton" "4"
       Option          "ScrollLeftButton" "7"
       Option          "ScrollRightButton" "6"
       Option          "ScaleUpButton" "12"
       Option          "ScaleDownButton" "13"
       Option          "TapDragEnable" "false"
 EndSection

Reboot the system after saving the settings. The trackpad should now be working on the MacBook.

Note: If, for some reason, the trackpad still does not work (eg: trackpad moves only up/down), this is because of some dracut driver inclusion issue. Running the following command should fix it: # dracut --force --add-drivers bcm5974

Enabling the Fans

To enable the fans, we need to install mbpfan and set it up to run every time the system starts.

 # xbps-install -S mbpfan
 # ln -s /etc/sv/mbpfan /var/service
 # mbpfan -t

This should make the fans spin on the system and keep the system cool.

Fixing the Lid

If you try to close the lid on your MacBook, it would do nothing and still keep running. We don't want this. To fix this, we need to enable the acpid service.

 # ln -s /etc/sv/acpid /var/service

The system should now suspend to RAM when the lid is closed.

Powersaving

Intel Processors on the MacBook provides with multiple powersaving techniques.

Thermald

Firstly, we will regulate the CPU speed on the system using a tool called thermald

 # xbps-install -S thermald
 # ln -s /etc/sv/thermald /var/service/

This should automatically regulate the CPU processing speed.

Powertop

Intel provides with a powerful tool to enable powersaving and achieve maximum battery life with a tool called powertop

 # xbps-install -S powertop
 # powertop --auto-tune
Note: Powertop might require you to take some measurements before it can auto tune your system, to do that, run # powertop --calibrate on battery power and keep it running for a while. You may use the laptop only after it is done calibrating, which usually takes 20 minutes.

Intel HDA Audio

Intel HDA Audio chipset has a powersave mode which can be enabled to save some battery.

To do so, we need to enable a few parameters. We will edit /etc/modprobe.d/60-snd_hda_intel.conf with the following content:

 options snd_hda_intel power_save=1

Intel i915 GPU

Intel i915 GPU chipset has an experimental mode to save power. We will edit /etc/modprobe.d/60-i915.conf with the following content:

 options i915 enable_rc6=1 enable_fbc=1 lvds_downclock=1

We will also suppress the errors that may pop up during the boot process. To do so, edit /etc/default/grub and find the following line:

 GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 slub_debug=P page_poison=1"

We will append and update the line to say:

 GRUB_CMDLINE_LINUX_DEFAULT="loglevel=4 slub_debug=P page_poison=1 i915.enable_rc6=7 i915.enable_fbc=1 i915.fastboot=1"

Save and exit. We now need to update the grub config

 # grub-mkconfig

The errors about i915 should be suppressed after reboot.

Updating the Intel Microcode

Intel Microcode updates provides with updated instruction set for the system, and is recommended to install.

 # xbps-install -S intel-ucode

Reboot after installing intel-ucode. Now, we need to reconfigure the kernel to make sure that the microcode has been updated.

 # xbps-reconfigure -f linux4.13
Note: 4.13 is the latest kernel version on Void Linux at the time of writing this manual. Please change the number depending on the kernel version installed on your system.

Reboot the system. The microcode should be updated after rebooting.

Fixing Audio

We will fix the audio by installing alsa-utils and pulseaudio:

 # xbps-install -S alsa-utils pulseaudio upower ConsoleKit
 # ln -s /etc/sv/pulseaudio /var/service/
 # ln -s /etc/sv/upower /var/service/
 # ln -s /etc/sv/ConsoleKit /var/service/

Unmute all the mixers through alsamixer.

The audio should now be working.

Extra Notes

Note: This part of the page in under construction.