marvin.im

A suckless debian installation

Remember my last story about my awesome debian installation? Well it didn’t work out as I wanted it. Awesome itself was somehow to heavy for my taste. So many customization options. Huge lua scripts for all kind of tasks - no matter how simple they where etc etc.

Well I was reading suckless.org a lot lately and liked it more and more.

I like:

  • the idea that they don’t parse configfiles but instead you modify a config.h or the sourcecode and recompile the project
  • keeping there projects small and simple
  • don’t implement to many unnecessary features

All that makes the strength of their projects

Challenges:

Since they think you should recompile the project if you want some custom options/configurations or changes packaging doesn’t make sense for thier software. This is a bit of a problem on debian - since it has such a nice package managment and security concept around it.

I recommend to completly avoid all the suckless software packaged by debian (it’s very outdated anyways) and follow the official suckless recommendations to compile thier software by hand. Good thing - you normally just need the offical source tar files and can easily compile them (except of surf but I’ll show you how to compile it since it’s a bit more tricky to compile webkitgtk+)

In the end you have a nice debian system and a very tiny suckless desktop environment which fits perfectly to your taste.

Let’s Begin

Install Debian stretch on A1181 Macbook

We start with a Apple Macbook 2006 (A1181) - which can be a bit tricky to install since it has a 32bit i686 cpu. If you have a different device skip this step.

I have two of those and found that the offical installation guide found in the official debian wiki was only working with one of those two

This is a way to install debian stretch on it which always works.

Start out with a MacOS X Tiger (10.4) or MacOS X Leopard (10.5). Make sure to backup the following file /System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport it’s the firmware file for the iSight Webcam which later can be installed on linux to get the integrated iSight Webcam to work.

Install rEFInd Bootmanager to boot an debian stretch netinstall i686 USB-Drive. Download the A binary zip file from http://www.rodsbooks.com/refind/getting.html unzip it and run the script sudo ./refind-install inside the unzipped folder.

Now plugin the debian flashdrive - reboot and boot the debian installer. At section [!] Software selection untick everything except standard system utilities and maybe SSH server.

Inside a fresh debian minimal install

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

You might want to install sudo and add your normal user to the sudo group.

apt-get update; apt-get install -y vim tmux xinit git build-essential wget curl

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.

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

alsa audio

apt-get install -y alsa-utils

make sure to use alsamixer to turn the volume up and unmute everything.

Suckless Suite

dwm

# install dependencies
sudo apt-get install -y libx11-dev libxft-dev libxinerama-dev

# dwm
wget https://dl.suckless.org/dwm/dwm-6.1.tar.gz
tar xvf dwm*.tar.gz
cd dwm-*/

# fix for linux
sed -i 's,FREETYPEINC = ${X11INC}/freetype2,#FREETYPEINC = ${X11INC}/freetype2,g' config.mk

Replace #define MODKEY Mod1Mask in config.h with #define MODKEY Mod4Mask to set MODKEY to CMD/Windows Key

sed -i 's/#define MODKEY Mod1Mask/#define MODKEY Mod4Mask/g' config.h

enable mac like copy/pase -> cmd+c and cmd+v

sudo apt-get install -y xclip xvkbd

add the follwing to config.h

static const char *mcopycmd[] = { "sh", "-c", "xclip -selection primary -o | xclip -selection clipboard -i", NULL };
static const char *mpastecmd[] = { "sh", "-c", "xclip -selection clipboard -o | xvkbd -xsendevent -file - 2>/dev/null", NULL };

[...]
        { MODKEY,             XK_c,      spawn,     {.v = mcopycmd } },
        { MODKEY,             XK_v,      spawn,     {.v = mpastecmd } },

Compile and install

make
sudo make install

st - suckless terminal (xterm alternative)

wget https://dl.suckless.org/st/st-0.8.1.tar.gz
tar xvf st*.tar.gz
cd st-*/
make
sudo make install

dmenu

wget https://dl.suckless.org/tools/dmenu-4.8.tar.gz
tar xvf dmenu*.tar.gz
cd dmenu-*/
make
sudo make install

surf

First you need to install webkitgtk+

# install ninja build system
wget https://github.com/ninja-build/ninja/archive/v1.8.2.tar.gz
tar xvf v1.8.2.tar.gz
cd ninja-*/
./configure.py --bootstrap
sudo cp ninja /usr/local/bin/

# install dependencies
wget http://ftp.at.debian.org/debian/pool/main/b/brotli/libbrotli1_1.0.3-1_i386.deb
wget http://ftp.at.debian.org/debian/pool/main/w/woff2/libwoff1_1.0.2-1_i386.deb
wget http://ftp.de.debian.org/debian/pool/main/b/brotli/libbrotli-dev_1.0.3-1_i386.deb
wget http://ftp.de.debian.org/debian/pool/main/w/woff2/libwoff-dev_1.0.2-1_i386.deb

sudo dpkg -i lib*

sudo apt-get install -y libgcr-3-dev


# webkitgtk
wget https://webkitgtk.org/releases/webkitgtk-2.20.0.tar.xz
tar xvf webkitgtk-*.tar.xz
cd webkitgtk-*/
Tools/gtk/install-dependencies
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja
ninja
sudo ninja install

install surf from git

git clone https://git.suckless.org/surf
cd surf/
make
sudo make install

install codecs for youtube and similar sites

sudo apt-get install -y libxvidcore4 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-fluendo-mp3 gstreamer1.0-libav

slstatus

git clone git://git.suckless.org/slstatus
cd slstatus

I use the following configurations config.h

// [...]

static const struct arg args[] = {
        /* function format          argument */
        { cpu_perc, "[CPU %3s%%] ", NULL    },
        { ram_perc, "[RAM %2s%%] ", NULL    },
        { battery_state, "[BAT %s", "BAT0" },
        { battery_perc, "%s%%] ", "BAT0" },
        { run_command, "[VOL %s%%] ", "/bin/sh -c \"amixer get Master | tail -n1 | grep -Po '\\[\\K[^%]*' | head -n1\"" },
        { ipv4, "[wls1 %s] ", "wls1" },
        { datetime, "[ %s ]",       "%F %T" },
};

this shows CPU, RAM, Battery state and percent, audio volume, wifi ip, date and time

compile and install

make
sudo make install

.xinitrc

Add ~/.xinitrc to prepare our keyboard layout and start dwm

setxkbmap us mac

slstatus &
st &

exec dwm

X11 autostart

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

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

Optional Software

iSight Firmware

To use the integrated iSight Webcam of the Macbook A1181 install isight-firmware-tools https://packages.debian.org/de/stretch/isight-firmware-tools.

Copy the file AppleUSBVideoSupport to a place on the Macbook and take a note of it’s absoulute path. The installation of isight-firmware-tools will ask for the path and you need to enter it there.

wget http://ftp.de.debian.org/debian/pool/contrib/i/isight-firmware-tools/isight-firmware-tools_1.6-2+b2_i386.deb
sudo dpkg -i isight-firmware-tools_1.6-2+b2_i386.deb

Now the firmware should be installed and you can remove ~/Desktop/AppleUSBVideoSupport if you want to.

Golang

wget https://dl.google.com/go/go1.10.1.linux-386.tar.gz
cd /opt && sudo tar xvf ~/go1.10.1.linux-386.tar.gz && cd -
mkdir -p $HOME/workspace/go

add to ~/.bashrc

# GOLANG
export GOROOT=/opt/go
export GOPATH=$HOME/workspace/go
mkdir -p $GOPATH
export PATH=${PATH}:${GOROOT}/bin
export PATH=${PATH}:${PATH}/bin

More infos