NetBSD On A ThinkPad X200
Introduction
I have been an OpenBSD user for many years, and although I really like
OpenBSD, I always wanted to get more familiar with NetBSD.
I have used NetBSD on and off in the past but I would always find myself
encountering an annoying error, rage quitting and reinstalling OpenBSD.
I decided that I want to truly get to grips with NetBSD as I have always
liked the simplicity of the operating system, and with my ThinkPad X200
not getting any younger, I thought the performance benefits would be
worth it.
Installation
I have used many older versions of NetBSD on my ThinkPad X200 in the
past, but as NetBSD 10.1 recently released, I decided to install the
10.1 release of NetBSD.
The installation of NetBSD 10.1 went smoothly with no issues, I've found
this is usually the case with Net/OpenBSD installations as most the time
they just work. The same cannot be said for Linux in my experience.
After the installation had completed I was left with a fully working
operating system with WiFi, a GUI and most of the tools I need. This
experience might not be universal, but old ThinkPad's are universally
well supported computers by every operating system.
I have always really liked the curses guided installers that are shipped
with Net/OpenBSD (FreeBSD has this too). Back in the day I might of been
obsessed with mastering a Gentoo Linux command line install, but now as
an old boomer, I cannot be bothered dealing with long command line
installs.
Middle Click Scrolling
One annoying but not fatal issue was getting middle click scrolling to
work. The ThinkPad X200 does not have a trackpad (positive), it only has
the trackpoint. By default NetBSD does not support middle click
scrolling, this is very annoying for me as I use it religiously.
I managed to fix this by adding the following lines into my
/etc/X11/xorg.conf.d/mouse.conf
Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Device" "/dev/wsmouse" Option "EmulateWheel" "on" Option "EmulateWheelButton" "2" Option "YAxisMapping" "4 5" Option "ZAxisMapping" "5 4" EndSection Section "ServerFlags" Option "AutoAddDevices" "off" EndSection
Web Browsing
Web browsing was a fairly slow and painful experience out of the box
on NetBSD on the X200.
This probably does not have *too* much to do with NetBSD itself and more
to do with the horribly bloated internet + horribly bloated web browsers
+ old hardware + my horribly slow internet connection.
I have always been a Firefox sort of person, I dont really like the look
and feel of Chromium so initially I installed Firefox. It works but it
is pretty slow.
I discovered another web browser called Arctic-fox which is a fork and
continuation of the Palemoon web browser. I am not really familiar with
the Palemoon or Arctic-fox browsers, but AFAIK they are forks and
continuations of an old version of Firefox.
Arctic-fox works really well on my old ThinkPad X200, although some
bloated websites do not work well or at all and can crash my X11 session
. So for cases like this I do keep standard Firefox around, annoyingly.
Suspend And Resume
I still have not got suspend and resume working properly on my ThinkPad
. Suspend works when I invoke it from a shell zzz
, but it
does not work when I close the lid of the laptop. I am going to look
into powerd and the various powerd scripts for this.
As for resuming, I have not got this working correctly. When I resume
a TTY will show with a cursor blinking, switching between TTYS will
drop me back into the X11 session. The X11 session is unusable though
as the CPU is maxed out and the whole system is extremely slow. I am
really unsure why this is happening, as it never happend on OpenBSD or
Linux on this laptop.
Update: 5th March 2025
I figured out the lid switch events, just by reading the documentation!
But men dont read manuals! The amount of times in the past that I have
run NetBSD on laptops and never realised how to get lid switch events
to work, bruh.
Editing the release and pressed cases in the scripts in
/etc/powerd/scripts/
tells NetBSD what to do when the lid
is altered.
Here is what I have put inside of my /etc/powerd/scripts/lid_switch
file:
#!/bin/sh - # # $NetBSD: lid_switch,v 1.9 2010/12/31 09:33:10 jruoho Exp $ # # Generic script for lid switch events. # # Arguments passed by powerd(8): # # device event case "${2}" in pressed) # If you want to put the system into sleep when the lid # is closed, see the sleep_button -script for examples. # wsconsctl -d -w backlight=0 >/dev/null /sbin/poweroff exit 0 ;; released) wsconsctl -d -w backlight=1 >/dev/null /sbin/sysctl -w hw.acpi.sleep.state=0 exit 0 ;; *) logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1 exit 1 esacThis will shutdown the laptop when I close the lid, it's not ideal but until I can successfully resume from suspend it will have to do.
Playing Video Via MPV
I could not play videos very well on this laptop with NetBSD. YouTube
is bad across operating systems, Invidious was better but yt-dlp + mpv
is always my goto as it works very well on low powered hardware.
On NetBSD MPV would not work, one frame would play and then the X11
session would freeze whilst the audio played. I managed to fix this by
passing the argument -vo=xv
to mpv, I made an alias for it
in ~/bin
. This will make mpv use the xvideo backend.
In all honesty, I have no idea why this works but it does. My best
guess is that the default graphics driver settings in Xorg for
Intel(4) dont like
the default graphics backend that mpv uses.
Update: 20th March 2025
After tweaking my graphics driver settings in
/etc/X11/xorg.conf.d/xorg.conf
mpv would now play videos
without the -vo=xv
argument.
See the section below for more details.
Fixing the Intel graphics driver
Graphics performance was not great initally on the X200, I put up with
it for a while but issues such as the issue with MPV were getting on
my nerves. Other issues included GPU hangs and the screen freezing
temporarly.
I have been playing around with different Xorg configurations for the
Intel(4) driver that NetBSD
provides.
Here is what I have so far in /etc/X11/xorg.conf.d/xorg.conf
:
Section "Device" Identifier "Intel Graphics" #Driver "modesetting" Driver "intel" Option "Accel" "False" Option "AccelMethod" "uxa" Option "DRI" "0" EndSectionThis configuration seems to make the graphics performance better. I am no graphics expert so this really was just trial and error until it made a difference.
I am going to continue to tweak this as video now plays worse with more screen tearing, but freezes do not happen anymore, Firefox also takes longer to load for some reason.
Changing some TTY settings
It is not often that I only use a TTY, but when I do I want it to be
more or less the same as if I was using terminal in a GUI. I tweak the
TTY settings on every computer that I use, Linux, NetBSD, OpenBSD etc.
On NetBSD, the TTY can be configured by editing /etc/wscons.conf
.
Changing keyboard repeat speed
The first thing that I want to edit is the speed of the TTY. By default
the NetBSD TTY is quite slow. We can make it a bit faster by editing the
following values repeat.del1
and repeat.deln
.
Heres what it looks like in my /etc/wscons.conf
:
# Change keyboard repeat speed to faster settings. setvar wskbd repeat.del1 400 setvar wskbd repeat.deln 40Swapping caps lock and escape
The next thing that I want to change about the TTY is escape and caps lock. I swap around the escape key and caps lock, it is so much better for vi / vim usage.
To do this we must first dump the current keyboard map into a file somewhere. We can do this by running the following command:
wsconsctl map > /usr/share/wscons/keymaps/myCustomKeyMap
Now we must swap around the values of
Keycode 1 = Cmd_Debugger Escape
and Keycode 58 = Caps_Lock
. Your exact keycode numbers may
differ to mine, I am using a UK QWERTY layout, if you are using something
else then it may differ. But just look for Escape and Caps_Lock and swap them.
In my
/usr/share/wscons/keymaps/myCustomKeyMap
file it has
the following plus all the other keycodes:
Keycode 1 = Caps_Lock Keycode 58 = Cmd_Debugger EscapeNow we must edit
/etc/wscons.conf
to tell it to load this
keymap on startup. Append the following line:
mapfile /usr/share/wscons/keymaps/myCustomKeyMap
Changing the font
To change the font on the TTY we must define a font variable in
/etc/wscons.conf
. The font must be available in the
/usr/share/wscons/fonts/
directory, so be sure to check
that first. I am going to using the spleen font, this is the default
on modern OpenBSD versions.
Append the following to
/etc/wscons.conf
:
font spleen 12 24 iso /usr/share/wscons/fonts/spleen-12x24.fnt
Now we must make NetBSD load this font on the tty by appending the following lines to
/etc/wscons.conf
:
setvar ttyE0 font spleen setvar ttyE1 font spleen setvar ttyE2 font spleen setvar ttyE3 font spleen