.t/dely_

Alpine i3 Desktop on RPI

For Rasberry Pi 3 and later you'll want to get the aarch64 .tar.gz release: armv7 is supported for the RPI 3 but starting X while using kms will result in a black screen and unresponsive keyboard, and while the default driver and fkms will work they have atrocious video performance. My RPI 3 had some odd behaviour where setting a Pango font in i3 would cause the text in the status bar and window title to become invisible, but emojis would show up fine. For RPI 4 there is no such issue.

Install Alpine Linux either in sys or diskless mode. If you are following the sys mode installation guide choose the "Update boot partition (keep alpine-rpi* image layout)" path as the other instructions are incorrect. Proceed after you have finished installation and rebooted into your system.

We start by configuring the RPI by creating /media/mmcblk0p1/usercfg.txt:

# Disable rainbow screen: good for seeing that config is read disable_splash=1 # My HDMI screen fits better with this disable_overscan=1 # I use ethernet, and I don't care about bluetooth dtoverlay=disable-wifi dtoverlay=disable-bt # Enable audio dtparam=audio=on # Fix RPI 4 not booting without HDMI hdmi_force_hotplug=1 # Enable DRM VC4 V3D driver, disable HDMI audio dtoverlay=vc4-kms-v3d,no-audio # Don't have the firmware create an initial video= setting in cmdline.txt. # Use the kernel's default instead. disable_fw_kms_setup=1 # Run as fast as firmware / board allows arm_boost=1

We will get the base packages required for a graphical environment using Alpines setup-xorg-base script.

setup-xorg-base

Add your non-root account to the audio and video groups if it's not already a member.

adduser myuser video adduser myuser audio

Next we'll install graphics drivers and dbus-x11.

apk add xf86-video-fbdev apk add dbus-x11

In addition to i3 we will be using i3status for the status bar, rofi for launching applications, and feh to display picture as wallpaper. Our display manager will be lightdm using lightdm-gtk-greeter.

apk add i3wm i3status rofi feh lightdm lightdm-gtk-greeter

Without elogind or any pam module for XDG we'll set up our XDG_RUNTIME_DIR in .profile.

cat <<EOF > ~myuser/.profile if [ -z "\$XDG_RUNTIME_DIR" ]; then XDG_RUNTIME_DIR="/tmp/\$(id -u)-runtime-dir" mkdir -pm 0700 "\$XDG_RUNTIME_DIR" export XDG_RUNTIME_DIR fi EOF

A few fonts can be useful.

apk add font-terminus font-inconsolata font-dejavu font-noto \ font-noto-cjk font-noto-extra font-liberation font-hack \ font-hack-nerd font-noto-emoji

Pipewire for audio.

apk add polkit rtkit pipewire pipewire-pulse

Your non-root account must be in the rtkit group to take advantage of rtkit.

adduser myuser rtkit

To start pipewire automatically we will start it through .profile as openrc has no user services.

cat <<EOF >> ~myuser/.profile if [ -z \$(pgrep -x pipewire) ]; then /usr/bin/pipewire >~/pipewire.log 2>&1 & fi EOF

Wireplumber and pipewire-pulse can be started automatically through pipewire itself:

mkdir /etc/pipewire/pipewire.conf.d cat <<EOF > /etc/pipewire/pipewire.conf.d/exec.conf context.exec = [ { path = "/usr/bin/wireplumber" args = "" } { path = "/usr/bin/pipewire" args = "-c pipewire-pulse.conf" } ] EOF

Automatically start our services on boot.

rc-update add dbus rc-update add lightdm rc-update add rtkit rc-update add polkit

If you want access to the thermal sensor to add to i3status bar you'll need lm-sensors. The sensor is /sys/devices/virtual/thermal/thermal_zone0/hwmon0/temp1_input.

apk add lm-sensors

To get a dbus session going on login we'll modify /etc/init/lightdm.conf like so:

exec dbus-run-session -- /usr/bin/lightdm

We're gonna need a terminal emulator to use in our graphical environment. Urxvt looks utterly atrocious by default, but it cleans up OK and it's light.

apk add rxvt-unicode

Since I'll be using the RPI to play videos and music I want to mount an SMB share on boot. This will require adding a record to fstab and adding the netmount service to the default runlevel. You don't want netmount at the boot runlevel as this may cause attempted mounting of shares before networking is properly initialized.

echo "//<ip-address>/<share> /mnt/media cifs ro,guest 0 0" >> /etc/fstab rc-update add netmount

If you're on a diskless install you'll now want to lbu commit.