Negate This

A future that could've been

Continuing with my ThinkPad T60 and OpenBSD

Published on by Negate This #Technology #Openbsd #Thinkpad


It’s been a couple of weeks since I’ve set up my ThinkPad T60 to be my sorta daily driver, so I’ve had plenty of time to test things out on it and configure it to my liking. At the same time as I’m learning how to handle this old hardware, I’m learning all about OpenBSD. I definitely still have about a million more things to learn, but in the meantime I’m chronicling the setup of my ThinkPad T60 as resource for myself and others.

In my last post about the ThinkPad T60, I said that I ordered some new RAM and a new T7200 CPU for my laptop. I’ve since received both of these items and upgraded my laptop…well sorta. When I received my laptop, it had 1GB of RAM, which I assumed was from one stick of RAM (even though I opened the laptop up probably 10 times before placing my order), but apparently I had two 512MB RAM sticks in the RAM slot. Whoops, so rather than going with my original plan of having the maximum 3GB of RAM, I’m working with 2.5GB of RAM. So far, though, it’s been enough to get by and I can safely have 6 or so Firefox tabs open. There will definitely be lag, especially if there a couple of Google Docs links open, but nothing too extreme. With the new 64-bit CPU, th first thing I did was to install a 64-bit of version of OpenBSD, which I did with ease and without any errors installing comp68.tgz this time. Hooray! I then pretty much followed the same basic installation steps I outlined in my first post, so definitely check that out.

Luckily, suspend on lid close has worked pretty much out of the box for me, so I didn’t have to do anything to any special configuration. Just in case you do, though, just stick this line in your /etc/sysctl.conf file:

machdep.lidaction=1 

This will make it so that when your laptop lid shuts, OpenBSD automatically suspends. I’ve found that this doesn’t work for me when my laptop is connected to the power adapter, so I’ve made it a habit of just running

$ zzz # Suspends laptop

or

$ ZZZ # Hibernates laptop

so that I know for sure my laptop will be suspended once I close it. Otherwise I may close it while it’s connected to the power adapter instead of disconnecting it from the power adapter first. Luckily, the ThinkPad T60 has a moon-shaped LED indicator that shows when your laptop is suspended. Super cute!

I’ve gotten really used to just tapping my touchad to act as a left-click, but that doesn’t work on a fresh install. For a hot second I thought that the Thinkpad T60 didn’t support tapping, but apparently all you need to do is add this line in your /etc/wsconsctl.conf file:

mouse.tp.tapping=1 # Activates touchpad tapping support

One thing I noticed straight away on this install was that there was no sound being output from my speakers…whoops, looks like I forgot to set up a mixerctl configuration file. That’s as easy as:

1. # cp /etc/examples/mixerctl.conf /etc/

then putting

outputs.master=200

to set the output level of the laptop speakers. 200 is a bit low sometimes, so experiment a bit. 255 seems to be good, but I don’t use the speakers often so I keep them low.

For changing the volume of the machine as a non-root user, you could use sndioctl and possibly map it to some specific buttons or keyboard configuration. I just run it straight from a terminal, as follows:

$ sndioctl output.level=+0.1 # This raises the volume by 10%

or 

$ sndioctl output.level=0.8 # This sets the level to 80%

One odd thing is that on boot, I won’t hear anything output from the speakers. It’s only after I’ve suspended my laptop then woken it up from its slumber that the speakers output sound. I noticed this yesterday so I haven’t had a chance to investigate the causes, but it’s definitely a weird bug.

With some of these basic configuration files out of the way, here are some ways I’ve customized the install’s looks.

I’ve shamelessly stolen crhenr’s dotfiles from GitHub to make my FVWM look very sleek.

I’ve modified the install script as such:

#!/bin/sh

echo -n "Install additional software? [y/n] "
read install

echo -n "Move dotfiles to which user? "
read user

if [[ $install == y ]]; then
    pkg_add wireshark firefox gimp vlc transmission-gtk git vim nnn cmus
fi

echo "[*] Installing necessary software..."
pkg_add feh conky i3lock scrot rofi ImageMagick slim slim-themes

echo "[*] Copying dotfiles..."
cp .fvwmrc /home/$user/.fvwmrc
cp .conkyrc /home/$user/.conkyrc
cp .vimrc /home/$user/.vimrc
cp .Xdefaults /home/$user/.Xdefaults
mv .config /home/$user/

- echo "conky &" > /home/$user/.xinitrc
- echo "exec fvwm" >> /home/$user/.xinitrc
+ echo "conky &" > /home/$user/.xsession
+ echo "exec fvwm" >> /home/$user/.xsession

chown -R $user /home/$user

cp -R ./openbsd-dark /usr/local/share/slim/themes/
cat <<EOT >> /etc/rc.local
if [ -x /usr/local/bin/slim ]; then
    echo -n ' slim'; ( sleep 5; /usr/local/bin/slim -nodaemon ) &
fi

EOT
echo "[*] Change the variable current_theme in /etc/slim.conf to openbsd-dark"
echo "[*] Done."

I found that my .xinitrc file wasn’t actually doing anything, and that putting the same lines into .xsession had the desired effect. (EDIT: This is because I use xenodm rather than startx). I also went ahead and followed the script’s instructions to change the current_theme variable in /etc/slim.conf to openbsd-dark.

Make sure to modify the *ShutdownVerifyCommand as follows:

*ShutdownVerifyCommand        exec /usr/bin/doas /sbin/halt -p

Otherwise, this button in the menu won’t actually shut the laptop down.

Wala! Now my OpenBSD install looks beautiful and functions well enough for basic use.

Since I’m on OpenBSD, most of the programs I use on a daily basis aren’t natively avaialable on it. One of these programs is Telegram, which I use to communicate daily with my girlfriend. Telegram has a web client, but Firefox on this machine struggles enough as-is, so I wanted a command line solution. Luckily I found this Reddit post detailing how you can build tdlib and the command line telegram client tg for OpenBSD. I followed the instructions and it worked perfectly, it just took forever to build. Now I have a very fast, extremely usable Telegram client with VIM keybindings on OpenBSD.

I’m also present on Matrix, but there are no Matrix clients available on OpenBSD. (EDIT: I’m an idiot. Apparently gomuks is available in both packages and ports. OOF). Luckily, weechat is available on OpenBSD and it has a weechat-matrix plugin that lets it connect to the Matrix network as a Matrix client! Perfect, and there are even installation instructions here

I followed these instructions and everything seemed just fine, up until the very last step where you build weechat-matrix with

$ make install

Instead, you should use

$ gmake install

which got rid of all of the errors I had and worked just fine. Just follow the rest of the instructions in that tutorial you should be able to open Weechat and connect to the Matrix network.

If you have been in any encrypted channels and want to be able to see the encrypted history, you’ll need to somehow export your E2E Room Keys. This is fairly trivial in Element, but other clients may very. Once you export your keys and encrypt them with a passphrase, move them over to your OpenBSD machine then import them into Weechat using:

/olm import /path/to/keys <passphrase>

It should take a little bit to load them in, but you should be good once it’s done. You may need to verify yourself and people in channels you’re present in. You can verify everyone using:

/olm verify * *

or specific people using:

/olm verify @test:test.org *

That should give you a working Matrix client on OpenBSD.

While the GUI side of things may look and function just fine now, I’ve found that I mostly deal with text. In class, I write notes in Markdown files using vim and spend the rest of the time reading, either physical books, PDFs, eBooks, plain-text websites, etc. So to preserve my limited RAM and battery, I mostly stick to the TTY and use tmux combined with vim for writing notes, lynx for browsing the web, epy for reading ePUB files, pdftotext from the poppler-utils package to convert PDFs into text files and read them with less, and bombadillo to browse geminispace. I've also modified my .tmux.conf` to look like this:

set -g status-right-length 100
set -g status-right "%d.%b.%Y %l:%M %p | #(apm -l)%"

The first line sets the length of the right side of the tmux status bar to 100, while the second line sets the right side of the status bar to display the date, current time, and current battery percentage. For example:

[0] 0:ksh  1:ksh		16.Apr.2021  5:03 PM | 50%

This is all the configuration I’ve done so far, but it’s given me a usable system, especially considering that this is a 15-year-old laptop. If anyone has any other suggestions on ways to configure my system, throw them at me please!