OpenBSD on Thinkpad T60
Sebastian Skibiński (KuchiKuu)
2020-11-01
- 1) About Thinkpad T60
- 2) Installing OpenBSD
- 3) Installing IceWM
- 3.1) Setting the wallpaper
- 3.2) Tap-to-click
- 3.3) Making Tap-to-click persistent
- 3.4) Configuring doas
- 3.5) Using AntiX theme
- 3.6) Kissing IceWM goodbye
- 4) Installing Xfce4
- 4.1) Previous startup file is irrelevant
- 5) Setting up Wi-Fi
- 6) Firefox and pledge
- 7) Chinese font
1) About Thinkpad T60
Let's start with the specs of my T60
Resolution: 1024x768 (14")
CPU: Intel Core 2 T5600 (2) @ 1.829GH
GPU: Mesa DRI Intel(R) 945GM
Memory: 3046MiB
2) Installing OpenBSD
I have downloaded OpenBSD from https://www.openbsd.net.
Because T60 has a DVD-Rom (Normally, T60 has CD-Rom, but mine has DVD-Rom because the previous owner replaced it) I decided to go old-school and I burned the image on a DVD.
I've put the DVD in the tray, started T60 and used boot selector to boot from the DVD.
Installation went painlessly easy. The only thing I truly changed was the partition scheme. I only have 5 partitions (compared to 8 or 9 created by the automatic partitioning)
Those are:
So normally I would only make 1 partition (/), but I've read somewhere that some partitions are designed to be made read-only later in the future to lower an attack surface on the system.
For example:
After installing all of your programs, you can use fstab to mark "/" and "/usr" as a read-only system, so that no modification can be done to the files.
This is not OpenBSD specific. Every system can be set in such a way. It's just that I read about such a "trick" while installing OpenBSD.
Plugging in Ethernet cable before starting OpenBSD installation made the system detect it later on, and OpenBSD automatically connected to my router via the cable. Nice. (Wi-Fi wasn't as easy, but about that later)
3) Installing IceWM
(If you don't want to read about my failures, skip to the XFCE4 section
So I wanted a lightweight window manager. I've decided to install IceWM. It is used mainly in AntiX Linux.
I already have AntiX installed in a VirtualBox on PC. I really like AntiX default theme so I made a tar file with all the themes in preparation to use them on OpenBSD.
After logging on OpenBSD, I've installed additional programs to make using OpenBSD easier for me.
As root:
pkg_add nano wget icewm firefox mousepad feh vlc neofetch xfce4-terminal
> nano, wget - both programs are GNU.
after the installation, I enabled xenodm in order to login using X server.
As root:
rcctl enable xenodm
Now, I had to tell the X server to start icewm when I login.
echo "exec icewm-session" > .xsession
Restarted, by using "shutdown -r now" as root, then after the system booted, I was greeted by the login screen provided by xenodm. After the login, IceWM started.
> No wallpaper
> Default theme
> Icons broken
3.1) Setting the wallpaper
The wallpaper was easy to set.
I started firefox, searched for some wallpapers on the Internet, found the one, tried to save it and... I couldn't.
No matter what I clicked, I couldn't save the wallpaper (about that later).
I thoght I'm missing some "programs" that handle download's "Save as..." window.
That's the reason I installed wget. So I used wget to download, and feh to set the wallpaper.
feh --bg-scale /home/username/Pictures/wallpaper.jpg
It worked, but it works only for the current session. I've added it to the .xsession file but it didn't work as intended, because the commands were executed instantaneously, and feh had no active X server to set the wallpaper. The IceWM did not have the time to start, because it was stopped by feh error.
So the solution is to create a "startup" file in "~/.icewm" folder.
This file is executed after IceWM is started.
So:
echo "feh --bg-scale /home/username/Pictures/wallpaper.jpg" > ~/.icewm/startup
chmod +x ~/.icewm/startup
(I'm pretty sure +x permission is required, but I'm not 100% sure)
Restarted. Logged in. Wallpaper has been set successfully. Nice.
3.2) Tap-to-click
So the touchpad worked out-of-the-box, but I could only move the pointer around. I had to use physical buttons in order to click.
Enabling touchpad's tap-to-click is fairly easy.
All I had to do is set "mouse.tp.tapping" property to 1 by using wsconsctl.
wsconsctl required root in order to change this. This complicates stuff a bit (about that later).
As root:
wsconsctl mouse.tp.tapping=1
And done. I can now tap-to-click with ease.
3.3) Making Tap-to-click persistent
So the Tap-to-click works only for the current session. If I restart later, this function is gone.
3.4) Configuring doas
I can't just add wsconsctl to the startup file, because it requires root.
I can run a command as root by using doas.
First, I created a /etc/doas.conf config file, because there is none by default.
doas is not as "bloated" as sudo, so the config file is very minimal but powerful.
As root:
echo "permit nopass username cmd wsconsctl" > /etc/doas.conf
- permit - allow (access)
- nopass - without using a password
- username - to a user called username
- cmd wsconsctl - to run a wsconsctl command
Pretty easy. Now, I was able to add wsconsctl to the ~/.icewm/startup file.
echo "doas wsconsctl mouse.tp.tapping=1" >> ~/.icewm/startup
(keep in mind double >> as it is used to append to the file)
Restart. Login. Everything worked.
3.5) Using AntiX theme
The question was: "How can I transfer AntiX themes to my OpenBSD?"
The solution was: nc
So, both systems were connected to the same router. I've used it to make a socket that listens on port 30 for receiving data on OpenBSD
As Root:
nc -l 30 > antix-icewm-themes.tar
On my AntiX VirtualBox, I used nc to send data to the socket on OpenBSD
nc internalipaddressofOpenBSD 30 < themesfile.tar
I believe there was a way to see the progress of it, but with those commands I am not able to see the progress of that transfer. I just waited like 30 seconds and then Ctrl+C'd the nc on AntiX.
I unpacked the tar, copied the folders to /usr/local/share/icewm/themes/ and restarted IceWM.
The theme was there. Easy.
3.6) Kissing IceWM goodbye
And this is where my journey with IceWM ends.
The theme worked, and that's where "worked" ends.
Icons didn't load properly for the installed programs, the config files were a mess, whatever I modified didn't work as planned. Maybe I didn't try hard enough? Oh well..
Sad, because IceWM used less than 100mb of RAM at idle
4) Installing Xfce4
So I've decided to just install Xfce4 and be done with this.
As root:
pkg_add xfce4-session
Done. Now, I had to overwrite .xsession to start Xfce4 instead of IceWm.
echo "exec xfce4-session" > ~/.xsession
Restart. Works.
4.1) Previous startup file is irrelevant
So the ~/.icewm/startup file is irrelevant, because Xfce4 doesn't use this file.
But nothing's lost. I've just copied the commands from this file to Xfce4's "Session and Startup" settings and everything works just fine.
Xfce4 uses 190~220mb of RAM at idle
5) Setting up Wi-Fi
I don't know much about it.
I created some files.
I typed some commands.
Nothing worked.
I left everything as it was, and turned off the laptop. Later when I turned it on, OpenBSD created a Wi-Fi connection with my router that I set in config files. Nice.
So, in order to configure my Wi-Fi, I had to figure out the interface name.
ifconfig
...
wpi0: ....
...
media: IEEE802.11...
...
...
Here it is. First thing to do is to turn it on, if it's off.
As root:
ifconfig wpi0 up
Now, it would be handy to see available Wi-Fis around me.
ifconfig wpi0 scan
...
nwid wifinamehere chan xxx bssid 00:00:00:00:00:00....wpa2,wpa1
...
This is the information that I needed. nwid + the information about security (although I obviously know that my Wi-Fi is secured, the information is there just in case).
Now. I have no idea what kind of mumbo-jumbo I did but I ended up with a new file in /etc/.
I created a file "/etc/hostname.wpi0" that contains the nwid of my wifi and the password.
As root:
echo 'nwid "wifiname" wpakey "wifipassword"' > /etc/hostname.wpi0
I also use dhcp in order to get the ip. This informaiton must be included in the file.
As root:
echo "dhcp" >> /etc/hostname.wpi0
(pay attention to >>)
So at this point I was trying to run "dhclient wpi0" to make a connection but I always got "no link".
This changed after a restart.
Now my laptop automatically connects to a Wi-Fi at boot.
6) Firefox and pledge
So I spent like 2 hours trying to figure out why I can't upload and download any file when using Firefox.
I wanted to upload a screenshoot and I couldn't locate the file. There was no files to select.
People on Telegram group told me that it's because of the pledge, and that I should read the firefox manual.
When I did
less /usr/local/share/doc/pkg-readmes/firefox
I saw at the very beginning, that because of pledge and unveil, only ~/Downloads and /tmp are available to Firefox.
And so I created a "Downloads" folder in my home directory.
With the help of this website:
https://www.reddit.com/r/openbsd/comments/eh25ma/firefox_how_to_select_file_to_upload/
I defaulted Firefox to use /home/username/Downloads folder when the upload window pops up.
about:config -> dom.input.fallbackUploadDir -> /home/username/Downloads
I am pretty happy with how it works, yet there's more to be done if anyone wants.
Check out this website for more information:
http://daemonforums.org/showthread.php?t=11252
7) Chinese font
All Chinese characters were just squares in Firefox.
Obviously, a font is missing.
Without further delay, all the steps that are needed to see Chinese characters are as follows:
As root:
pkg_add zh-wqy-zenhei-ttf
The fonts are there, but the system doesn't know about them.
The path to this font is "/usr/local/share/fonts/wqy" and it must be added to the font path.
I simply made another entry in Xfce4's "Session and Startup" with this command inside:
xset fp+ /usr/local/share/fonts/wqy
(because xset is not persistent)
Restart. Works.
This website was painlfully written using vim.
It was also written on T60 itself. No problems with that what-so-ever.
Sebastian Skibiński (KuchiKuu)
2020-11-01