marvin.im

An awesome debian installation

Imagine you’ve got a Macbook A1181 from 2006. Which is also the perfect hardware if you want a nice libre notebook.

Okay I didn’t flash the EFI with Libreboot, because I’m afraid that I can’t go back then. But in theory it’s possible.

It is also a nice looking versatile notebook.

Goals

  • Get the keyboard working like the macos version (US mac + German Umlauts using Alt+U + umlaut or Alt+s)

  • Get copy paste working like on macos

  • Get a nice very fast window manager -> awesome

  • Try to avoid unnecessary software

  • Integrate the following programs nicly

    • luks - full disk encryption
    • tmux - start automatically
    • awesome - start only using startx after console login
    • stterm - minimalist xterm replacement by suckless.org
    • vim
    • chromium - with a behavior like vim (using a plugin)
    • git

Getting started

installing debian on A1181 macbook 2006

Just quick install steps

prepare the Installation USB Stick

apt-get install grub-efi-ia32-bin p7zip-full dosfstools
wget http://ftp.de.debian.org/debian/dists/stretch/main/installer-i386/current/images/netboot/mini.iso

the problem with this macbook is that it has a 32bit processor so we need a 32bit efi grub to boot. that is also the reason most systems which are normally booting on newer macs are

use fdisk to make a ‘W95 FAT32’ MBR partition (hex partition code 0x0b) and mkfs.vfat to clear the partition and make a new FAT32 filesystem.

Mount your USB drive to /mnt/usb and install grub with IA32 EFI boot files on the FAT file system using

grub-install --target=i386-efi --efi-directory=/mnt/usb --boot-directory=/mnt/usb/boot --bootloader-id=boot --removable

Now add a grub.cfg file in /mnt/usb/boot/grub/grub.cfg. The config below sets the graphics mode and font on the console to something the installer can use, loads the kernel and initrd into memory and boots. If you need to debug the GRUB settings interactively, remove the last line (boot).

if loadfont /boot/grub/fonts/unicode.pf2 ; then
    set gfxmode=800x600
    insmod efi_gop
    insmod efi_uga
    insmod video_bochs
    insmod video_cirrus
    insmod gfxterm
    insmod png
    terminal_output gfxterm
fi
linux (hd0,msdos1)/linux
initrd (hd0,msdos1)/initrd.gz
boot

Now copy installer and ISO image to the USB drive Extract the kernel and initrd from the ISO and copy them and the netboot ISO image itself to the USB stick:

7z x mini.iso linux initrd.gz -o/mnt/usb
cp mini.iso /mnt/usb

(more: https://wiki.debian.org/InstallingDebianOn/Apple/MacBook/2-1)

Wifi

This will put the psk and other stuff into the interfaces file.

wpa_passphrase SSID >> /etc/network/interfaces

Afterwards edit the mess in the file into the following:

auto wls1
iface wls1 inet dhcp
  wpa-ssid SSID
  wpa-psk <PSK FROM wpa_passphrase>

Install Software

apt-get update; apt-get install -y vim tmux xinit awesome stterm git sudo

vim

Set vim as default system editor

update-alternatives --config editor

Keyboard settings

Edit /usr/share/X11/xkb/symbols/us section xkb_symbols "mac" comment the following and add the missing lines.

//    key <LSGT> { [   section,  plusminus,       section,        plusminus ] };
//    key <TLDE> { [     grave, asciitilde,    dead_grave,        dead_horn ] };
    key <TLDE> { [   section,  plusminus,       section,        plusminus ] };
    key <LSGT> { [     grave, asciitilde,    dead_grave,        dead_horn ] };

This switches the keys with the ±/§ and the ~/\`.

//    include "level3(ralt_switch)"
    include "level3(lalt_switch)"

This makes it possible to use the left alt key as the modifier for the alt+u + umlaut.

X11

Add .xinitrc to prepare our keyboard layout and start awesome

setxkbmap us mac
exec awesome

Start startx automatically after console login on tty1 (add to ~/.bashrc)

# X11
if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
  startx
fi

tmux

Start tmux everytime automatically (add to ~/.bashrc) - you might want to add this to the root account too.

# tmux
[[ $TERM != "screen" ]] && exec tmux

Default configuration (add to ~/.tmux.conf)

set-window-option -g mode-key vi

Extras

battery state

to check the battery state you don’t need an extra program. Just ask the /sys/ fs.

cat /sys/class/power_supply/BAT0/uevent

As always - thanks for reading. More about the Awesome Window Manager in the next entry ;)