Useful NetBSD commands to get a working DWM installation
These are mostly notes for myself. NetBSD does a lot of things differently compared to Linux or even FreeBSD, and with a smaller user base it’s often harder to find clear answers when something breaks. I don’t want to rediscover this every time, so this is written down here.
At the time I used this setup, the machine was: i5-6600 (4 cores), AMD RX 570, 8 GB RAM, wired Ethernet only. Adjust paths and packages if your setup differs.
I did throw together a script to automate most of this, but it was never properly tested and would probably break more than it fixes. The commands below are the important parts, without pretending this is a one-click solution.
Fixing SSL errors with curl and git
On a fresh NetBSD install, TLS often doesn’t work out of the box because root certificates aren’t installed.
To fix SSL errors with curl and git
$ pkgin in mozilla-rootcerts$ mozilla-rootcerts installReference material
This article was useful as general background when setting up a BSD desktop: https://paedubucher.ch/articles/2020-08-11-freebsd-on-the-desktop.html
Choosing a usable package mirror
Default mirrors can be very slow depending on location. Explicitly setting PKG_PATH improves reliability.
$ PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r | cut -d_ -f1)/All" $ export PKG_PATH $ pkg_add -v pkginAfter installing pkgin, set up the repository list:
$ mkdir -p /usr/pkg/etc/pkgin $ touch /usr/pkg/etc/pkgin/repositories.conf $ vim /usr/pkg/etc/pkgin/repositories.confThe file repositories.conf has the a list of your mirrors. At the end of the file add the following:
- IMPORTANT! Change the number after …/amd64/ to your version of NetBSD. In my case, I am using 9.1, so I will write in 9.1. Also note that amd64 = x86_64. Oh the names.
http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/9.1/All/
- If you are using a different architecture to amd64, visit the website http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/ in your browser and find your actual architecture and use its link that looks like the one above. Then export the same link like this:
$ export PKG_PATH=”http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/9.1/All/
You can then install the pkgin package manager and use it from then onwards, your mirrors should work fine now. Remember to change the number when you upgrade to a new version of NetBSD.
$ pkg_add -v pkgin$ pkgin updatedwm won’t compile
This is expected. DWM targets Linux by default, and BSDs differ in filesystem layout.
$ cd dwm$ makedrw.c:5:10: fatal error: ‘X11/Xlib.h’ file not found
#include <X11/Xlib.h>
If you’ve used dwm on freeBSD or openBSD, you may be used to changing the location of the X11R6 header files to local in the config.mk file. This file, located inside your dwm folder needs these variables changed, but in a way that is different to open and freebsd.
Install freetype2, you will need it:
$ pkgin in freetype2Use this command to find the missing file.
$ find / -type f -name Xlib.hNetBSD
X11INC = /usr/X11R6/include --> X11INC = /usr/X11R7/includeX11LIB = /usr/X11R6/lib --> X11LIB = /usr/X11R7/lib...FREETYPEINC = /usr/X11R7/include/freetype2FreeBSD
X11INC = /usr/X11R6/include --> X11INC = /usr/local/includeX11LIB = /usr/X11R6/lib --> X11LIB = /usr/local/lib...FREETYPEINC = /usr/local/include/freetype2