My OpenBSD Adventure Part 2

< prev home next >
approximate reading time: 7 minutes
created by pur on 2022/03/22 - last changed on 2022/09/09

First Part of the Adventure
this article was already written from the OpenBSD box :)

Two problems have solved themself since the last time: graphics/Xserver work out of the box and tmux is available. I think the graphics problem was solved when I started the machine without any unneeded extras:

qemu-system-x86_64 -drive file=obsdbox.img 

This would only start a single thread (1cpu) machine with minimal memory, but it worked!

I'm not sure why I couldn't install tmux the other time maybe it was just my unfamiliarity with the system. So when I typed tmux out of muscle memory and tmux started on my OpenBSD box I was positively surprised.

Some basic things I want to manage to do are:

  1. install a graphical browser to view this blog
  2. change default terminal from xterm to something more usable
  3. default window manager from fvwm to something more usable
  4. power down the box from the command line

My main resource for these is the afterboot(8) man page.

Installing a graphical browser

Installing a graphical browser was matter of one command:

doas pkg_add firefox surf

1. Changing xterm to st

I aimed to install the suckless terminal since I didn't feel very comfortable with the package manger yet (mainly I don't know how to search for installable packages) and I installed st on my machine some time ago and it works very smooth. The first thing I did, was to install lynx (a command line browser) in order to download the installation instructions:

doas pkg_add lynx git
git clone https://git.suckless.org/st
make 

But I got a compilation error. ld: error: unable to find library -lrt which is addressed by removing -lrt from config.mk and running make again. Then, I moved the executable to an globally reachable location. On Linux I would have put it in/usr/local/bin, but this location is already used for non essential packages installed by the package manager pkg_add. I wanted to separate manually compiled packages from packages installed with a package manager, so I went for /opt/local/bin:

doas mkdir -p /opt/local/bin
doas mv st /opt/local/bin/

Losing Myself in the Package Manager Documentation

So, how do I make it the default terminal? As I don't want to use fvwm anyways, I will proceed to installing a new window manager and then proceeding. Currently, I'm using i3, so let's see how to install it: I had a look at Packages section of the afterboot(8) manual page and this refers to pkg_add(1), port(7) and packages(7). After reading pkg_add(1), I want to read syslog(3), installurl(t),pkgpath(7), pkg_info(1), stty(1), dpb(1) and maybe pkg_create(1).

I had sneak peak at all my packages installed with pkg_add using pkg_info -mz and to my surprise tmux was not among them. So, I used which tmux to locate the executable (/usr/bin/tmux in contrast to /bin/csh and /usr/local/bin/git). I presume thus, that tmux was installed along with the base installation.

Changing My Shell

After some time on the terminal I wanted to change the prompt because it didn't show the current working directory. I noticed that configuration of the Korn shell ksh isn't as easy as creting a config file at $HOME/.kshrc, so I just changed my default shell to bash, which I'm already familiary with and does a lot of things out of the box:

doas pkg_add bash 
doas usermod -s $(which bash) pur
userinfo pur
echo 'export PS1="\u@\h:\w$ "' > $HOME/.bashrc

Changing Window Manager

Before installing a new window manager I wanted to look at preinstalled window managers:

Pre-installed Window Managers

When logged in, the default window manager is fvwm (F Virtual Window Manager). When I press the left button and move the cursor to (Re)Start, I get the following options: - Restart Fvwm - Start cvm - Start wm2 - Start twm - Start ctwm - Start flwm - Start mwm - Start openbox - Start tvtwm

But none is in the PATH except twm which fvwm is based on so I decided just to install i3: But how do I find out which packages are available? In the pkg_add manual page I found that the mirror URL is stored at /etc/installurl. There probably is a better way, but I had a look at available packages lynx $(cat /etc/installurl) and then navigate to 7.0/packages/amd64. There, I saw that i3 is available and also i3-gaps is available, but only after I had already installed i3. So this is how i proceeded:

doas pkg_add i3
doas pkg_delete i3
doas pkg_add i3-gaps

Now I only have to find a way to start i3 ideally by default

Read the Third Part of the Adventure