Debian Jessie on an iMac
Upgrading to Debian GNU/Linux 8 running natively on an Intel Mac's bare metal
apple debian gnu linux imac backlight howto
Unfinished business
It’s been over a year since my initial installation of Debian GNU/Linux on my iMac. By now, Wheezy’s successor Debian 8 (Jessie) has been released and since there had been some open issues for my Debian installation, I thought I’d give upgrading the Debian system a bash.
What happened in the meantime?
Tiple-boot configuration restored
I already had a dual boot configuration set up using Bootcamp. However, the Debian 7 installation rendered my Windows 7 installation unavailable. I could fix this by switching to a Hybrid MBR. It wasn’t pretty, but I made it through alright and I can now boot all three operating systems directly from rEFInd.
Sometime over the course of the year, an Apple security fix overwrote the EFI partition, but reinstantiating the rEFInd bootloader was as simple as repeating the steps for the initial rEFInd installation.
Brightness control
I found the proper command that allowed me to configure the brightness: xrandr --output eDP --brightness 0.5
.
However, this one is only software-based. It gets the job done, but it doesn’t really touch the backlight.
Post-upgrade
I followed Debian’s instructions on how to upgrade an existing installation and encountered no problems related to the Apple hardware.
Sound
The kernel that comes with Debian 8 supports the imac27_*
option for the Intel ICH driver. The new driver in turn provides
control options for the internal bass speaker, removing the “tinny” sound that annoyed me so much under Wheezy. You can pass
the model option to the sound driver like this:
Once loaded (reboot), bring up the command line tool alsamixer
, select the Intel PCH sound driver using the F6 key and unmute the bass speaker.
By default, GNOME’s volume control keeps lowering the bass volume out of the red area. The fix was to tell GNOME via its audio preferences to select another sound card (“Analogue Sound” in my case).
Keyboard
I want my function keys to behave as F1, F2, …, without modifying it with the fn switch. The keyboard driver has an option to swap the fn behaviour for the function keys F1 … F12:
If hid_apple.ko
is loaded as a module, making this persist between reboots works like this:
However, it would seem that hid_apple
is statically compiled into the kernel and so I had to pass
the option to Grub in order to make it stick:
I wanted to preserve the media keys on F7 … F12 so I remapped their functionality in my ~/.Xmodmap
:
I saved the original F7 … F12 bindings in a gist.
I wasn’t lucky making the Left Alt behave like its right hand sibling. I tried several Xmodmap mappings but to no avail. It is recognized as a modifier key (ie. Alt + F2 brings up the run-command-window in GNOME) but I can only get the @-sign with ALT_R + l. I guess I have to get using Right Alt into my muscle memory then…
Brightness
Apparently GNOME’s brightness control accesses /sys/class/backlight/acpi_video0
but the firmware
for that adapter doesn’t seem to have support for it. Luckily, /sys/class/backlight/radeon_bl1
does.
Since I couldn’t find a way to tell GNOME to use the raw radeon_bl1 interface, I wrote a script that
I bound to the brightness control keys (inspired by a Debian wiki page):
The script checks whether /sys/class/backlight/radeon_bl1
exists. It will access the raw backlight
interface if it does or fall back to software-based xrandr
brightness correction if not. You can
get the latest version of this file from my dotfiles repo.
Copy the file to /usr/local/bin
and make sure it’s executable.
Now, bind the script to the fn + F1 and
fn + F2 keys. You need xbindkeys
for that, which you can install
with:
Create ~/.xbindkeysrc
with the following contents and run xbindkeys -f $HOME/.xbindkeysrc
after that.
The last step is to allow users to run the script as root without checking for a password. Use
sudo visudo
to add the following line to the sudoers file:
Reboot and rejoice: you can control your brightness again! There is one cosmetic drawback, though: after rebinding XF86MonBrightnessUp/Down, I don’t get the pretty brightness control overlay in GNOME anymore. Ideally, one tells GNOME directly which sysfs citizen it should use. If anyone is successul getting it to work with the following Xorg config hint, do drop me a line. I wasn’t able to start X any longer with this file being loaded:
comments powered by Disqus