The web design and pages for my personal website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long. 7.3KB

  1. # Fedora on Macbook
  2. Notes on running Fedora Linux on a Macbook (Air 2015).
  3. Updated September 19, 2018 on Fedora 28 (Xfce Desktop).
  4. # What Works?
  5. Most functionality works out of the box. The function keys to control the display
  6. brightness, keyboard backlight brightness, and media playback control all work
  7. fine. The keys for Mission Control and Dashboard are recognized by X11 as keys
  8. named `XF86LaunchA` and `XF86LaunchB` respectively, and could be bound to custom
  9. application shortcuts or whatever.
  10. For example I bound the Dashboard key to `xfdashboard` which gives me a GNOME 3
  11. like overview of my desktop that I'll probably never use.
  12. * Function keys: all supported
  13. * Suspend and Hibernate: works, but Xfce desktop gets confused if you use "suspend when the laptop lid is closed" and enters a suspend-wakeup-suspend cycle; but manual suspending is fine.
  14. * Bluetooth: recognized but audio quality is flaky
  15. * WiFi: with proprietary Broadcom `wl` driver
  16. * Camera: doesn't work, but see below.
  17. * SD Card Reader: works
  18. * External Display: works
  19. ## WiFi
  20. The WiFi chip in the Macbook Air is a Broadcom device that uses the `wl` driver.
  21. It's easily available from RPMFusion via the `akmod-wl` package and then you
  22. never need to worry about it again.
  23. Use a USB to Ethernet adapter or use USB tethering from your mobile phone to
  24. download the `wl` driver.
  25. # What Doesn't Work?
  26. ## FaceTime HD Camera
  27. The webcam on the Macbook is a strange device because it's registered on the
  28. motherboard as a PCIe device rather than USB like what most laptop webcams are.
  29. There are generic USB video drivers that work for all USB cameras but there
  30. aren't generic PCIe drivers because PCIe cameras are rare.
  31. I found [this project]( for a Linux driver
  32. that gets the camera to work, but I haven't tested it.
  33. ## Bluetooth is flakey
  34. The Bluetooth quality is pretty bad, with audio lagging and hanging and
  35. disconnecting a lot. I haven't tried other kinds of Bluetooth functionality.
  36. Inserting a USB Bluetooth adapter caused the system to prioritize that device
  37. over the built-in which worked around any audio problems.
  38. # Installation/Boot
  39. Make a Fedora USB stick like usual. Hold Option when booting the Macbook and
  40. choose the Fedora Media from USB to boot.
  41. I found that rEFIt/rEFInd are no longer necessary when installing Fedora.
  42. Just free up some partition space and allow Fedora to automatically create a
  43. partition layout, and it sets up a /boot/efi HFS+ partition automatically to
  44. make the OS bootable. Manual instructions for this are available for Debian
  45. and Arch, etc.
  46. GRUB installs itself and things work just like any other PC. In Fedora
  47. (as of v22), the GRUB menu lists a couple entries for Mac OS X (32-bit
  48. and 64-bit) but neither one works. Booting Fedora works though.
  49. To boot OS X, hold down the Option key during boot and pick OS X from the
  50. firmware bootloader. If you want OS X to be the default OS you can pick it
  51. as the System Disk from within OS X's settings. In this case, to boot Linux
  52. you'd hold Option on boot and choose Fedora, which takes you to GRUB and then
  53. you boot Fedora from there.
  54. # Backlight Brightness
  55. When I first started running Fedora on my Macbook it was Fedora 22 and the
  56. display backlight keys didn't work, so I wrote a script to do this the hard
  57. way. The script may still be useful if this problem comes back again.
  58. See <> for this. The keyboard brightness
  59. keys (in Xfce at least) don't work; they show a brightness graph but the
  60. actual brightness doesn't change. This script uses root to write brightness
  61. values to files in /sys.
  62. In case that link stops working, it basically manipulates values in these two
  63. files (writable only to root):
  64. ```
  65. BRIGHTNESS = "/sys/class/backlight/intel_backlight/brightness"
  66. MAX_BRIGHTNESS = "/sys/class/backlight/intel_backlight/max_brightness"
  67. ```
  68. `MAX_BRIGHTNESS` has some arbitrary value like `2777` and you just write a
  69. number between 0 and `MAX_BRIGHTNESS` into the other file.
  70. ```bash
  71. # to set the display to 50% brightness, you get the max brightness
  72. $ cat /sys/class/backlight/intel_backlight/max_brightness
  73. 2777
  74. # divide it in half
  75. $ perl -E 'say 2777 / 2'
  76. 1388.5
  77. # write that into the brightness file
  78. $ echo 1388 | sudo tee /sys/class/backlight/intel_backlight/brightness
  79. ```
  80. # Battery Saving
  81. Use `powertop` to tune the battery. The easiest thing is to just make it run `--auto-tune` automatically on boot via systemd.
  82. The `powertop` package comes with a systemd service you can enable. If you don't have one for some reason, create `/etc/systemd/system/powertop.service` with these contents:
  83. ```ini
  84. [Unit]
  85. Description=Powertop tunings
  86. [Service]
  87. Type=oneshot
  88. ExecStart=/sbin/powertop --auto-tune
  89. [Install]
  91. ```
  92. And enable the service with `sudo systemctl enable powertop.service`
  93. Other things to mess with are `powertop --calibrate` and `powertop --html`
  94. With this you can typically squeeze 7+ hours of battery life out of the 13" Macbook Air 2015 (which gets about 12 hours battery life under OS X, but this is possibly the best you can do with non-Apple software on a Macbook).
  95. # Keyboard Tweaks
  96. This section provides some tips on changing keyboard settings. All of these are temporary (they don't persist across reboots), and making them permanent varies from distro to distro. [Arch Linux]( and [Ubuntu]( make them permanent by adding configs to `/etc/modprobe.d/hid_apple.conf` and maybe rebuilding the initramfs (Fedora uses `dracut` and this whole method *does not work*).
  97. The way to make these changes permanent in Fedora is to use systemd's `rc.local` compatibility service. This works as of Fedora 22.
  98. Create a shell script at `/etc/rc.d/rc.local` with the commands below for the features you want to enable. For example:
  99. ```bash
  100. #!/bin/bash
  101. echo 0 | tee /sys/module/hid_apple/parameters/iso_layout
  102. echo 1 | tee /sys/module/hid_apple/parameters/swap_opt_cmd
  103. ```
  104. Make the script executable (`sudo chmod 0755 /etc/rc.d/rc.local`) and reboot.
  105. ## Tilde/Backtick Key
  106. The keyboard layout on the Macbook maps the tilde/backtick key to `<` and `>` under Linux. The fix that works for me is:
  107. ```
  108. $ echo 0 | sudo tee /sys/module/hid_apple/parameters/iso_layout
  109. ```
  110. ## Swap the Command and Option Keys
  111. By default the Option/Alt key is mapped as Alt in Linux, and the Command key is mapped to Super (equivalent to the Windows key on a PC). To swap these the other way around, so e.g. Command+Tab brings up the window switcher instead of Alt+Tab (as it does under Mac OS X), do this:
  112. ```
  113. $ echo 1 | sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd
  114. ```
  115. ## Function Keys
  116. By default if you want to input a function key (F1-F12) you have to hold Fn and press the key you want. Otherwise those keys map to the media keys when pressed. You can swap this behavior backwards (sort of like a `Fn Lock` feature of some PCs), so that the keys will input their function key when pressed and you need to hold Fn down to input the media key.
  117. ```bash
  118. # FnLock ON
  119. $ echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode
  120. # FnLock OFF
  121. $ echo 1 | sudo tee /sys/module/hid_apple/parameters/fnmode
  122. ```
  123. If you echo `0` into it, it effectively *disables* the `Fn` key. So pressing `Fn+F11` is the same as pressing `F11` and this renders the media functions inaccessible.