OpenBSD 5.5 notes

Just in case I forget things. The 5.6 CDs are on pre-order so I'll be trying out the upgrade procedure within the month!


I just follow the default options as detailed in the FAQ with one exception, the disklabel stage. Automatic partitioning creates 16 partitions, with /usr mounted on a different partition to e.g. /usr/lib. The /usr partition on my 80G hard drive ended up at 2g, which by the time we have checked out the base and xenocara source trees leaves very little space for further updates when tracking the stable branch. I therefore decided to use a single large partition for root in this second 'serious' install.

I let fdisk write the main OpenBSD partition (usually sd0c) and mbr. Then when disklabel kicks in, I specify a [C]ustom partition layout with just one large partition at sd0a and the swap at sd0b. Disklabel uses a series of single letter commands, a creates a partition which you specify by the partition letter and q saves the partitions and exits. I accept the Offset and the file system type then specify the size for my sd0a and sd0b partitions in gigs. I chose 50g for sd0a and I set the swap at 6g to allow enough space for hibernation to disk on this laptop with 2.5Gb of ram.

The installation completes in a ridiculously short 10 minutes or so. I always specify my default user during the installation, then I just reboot into a command line prompt and log in.

Getting on wifi

This Thinkpad X61s (type 7667-CG7) has an atheros wifi card that does not require proprietary drivers or closed source firmware. The driver is already present in a stock install of OpenBSD. The following commands at the root prompt got me on my domestic WPA2 wifi connection...

# ifconfig ath0 up
# ifconfig ath0 scan
# ifconfig nwid myconnectionname wpakey passphrase
# dhclient ath0
# exit

A quick check that I am actually on the Internet...

$ ping
PING ( 56 data bytes
64 bytes from icmp_seq=0 ttl=56 time=24.379 ms
64 bytes from icmp_seq=1 ttl=56 time=23.948 ms
64 bytes from icmp_seq=2 ttl=56 time=183.464 ms
--- ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 23.948/77.263/183.464/75.095 ms

...Ctrl-C stops the ping command from running and produces some stats.

Using pkg_add with a local mirror in.profile

With an Internet connection I can pull some essential packages in from the local mirror, in my case the UK Mirror Service. I add an export line to my .profile file in the home directory, so the result looks like this...

$ cat .profile
# $OpenBSD: dot.profile,v 1.4 2005/02/16 06:56:57 matthieu Exp $
# sh/ksh initialization

export PKG_PATH

...I had to log out and log in again to update the profile. I tested that the $PKG_PATH variable was actually present using

$ echo $PKG_PATH

Then I added some software...

$ su
# pkg_add -v feh nano scrot leafpad mpg123 firefox-esr libreoffice gimp
# exit

...time for coffee but I needed to check the display now and again as you are asked to choose between a couple of alternatives for some of the dependency packages. I think it was GIMP. I just accept the 0 alternative as that is the default and labelled with a meaning it is the one used for an automatic install.

Note that I use just the su command to become root, not su - like on Slackware. The su command does not change the working directory and my $PKG_PATH variable remains available.

startx and the Calm Window Manager

My very minimal .xinitrc file looks like this...

$ cat .xinitrc
feh --bg-center /home/keith/Pictures/puffy-slate.png &

...and that is enough to start the Calm Window Manager when typing startx from within my user account. I had already made a simple 1024 by 768 pixel background using GIMP and one of the 'official' Puffy cartoons on my old tryout install. Ruth thinks the cartoon puffy looks smug, which I'm fine with. The PNG file is only about 25kb.

Using apm for cpu frequency scaling and suspend on lid close

I created the file at /etc/rc.conf.local with the content shown by the cat command below...

$ cat /etc/rc.conf.local 

The -C switch is the one for cool running laptops, the man apm has all the options listed. You can find out about the CPU speed using the sysctl hw.XX commands as follows

$ sysctl hw | grep cpu              
hw.sensors.cpu0.temp0=59.00 degC
$ sysctl hw.cpuspeed              

Suspend and hibernate work after turning on apmd. Suspend uses the zzz alias from a terminal and ZZZ invokes hibernate to disk. Hibernate takes a long time - it looks as if the whole ram image is being written to the swap. My first trial install with default partitions had a 2.9Gb swap partition, and hibernate did not resume properly. 6Gb for swap is overkill but then I'm not putting a lot of data on this laptop, and I don't want to do experimental installs to find the minimum swap level for hibernation to just work.

I could set suspend on lid close by adding uncommenting a line in /etc/sysctl.conf as follows...

$ cat /etc/sysctl.conf | grep lid
machdep.lidsuspend=1            # laptop lid closes cause a suspend

Some of the other lines in that file look interesting.

You can see how much power is left in the battery using the appropriate sysctl hw.sensors values...

$ sysctl hw.sensors.acpibat0 
hw.sensors.acpibat0.volt0=14.40 VDC (voltage)
hw.sensors.acpibat0.volt1=15.47 VDC (current voltage)
hw.sensors.acpibat0.power0=15.80 W (rate)
hw.sensors.acpibat0.watthour0=111.31 Wh (last full capacity)
hw.sensors.acpibat0.watthour1=5.57 Wh (warning capacity)
hw.sensors.acpibat0.watthour2=0.20 Wh (low capacity)
hw.sensors.acpibat0.watthour3=98.46 Wh (remaining capacity), OK
hw.sensors.acpibat0.raw0=1 (battery discharging), OK

This laptop can get as low as 11 or 12 watts power use on Linux with powertop options set to 'good'. I suspect I can duplicate powertop by setting sysctl settings, and Google has mentioned a powertop port (source code to compile).

Minimal music

I just use mpg123 to play classical music from the Isabella Stewart Gardner Museum Music Library, and some more modern compilations from the music for programming site.

To pause mpg123, just use Ctrl-Z and to resume, just issue the fg command. The volume up and down keys just work on the Thinkpad under cwm. In case they don't, the command line is...

$ mixerctl | grep output
$ mixerctl outputs.master=200,200
outputs.master: 176,176 -> 200,200

Printing and scanning

Familiar territory...but strange.

$ su
# pkg_add -v cups xsane cups-pdf xpdf splix

...except for a choice of xsane with default of no package? Not seen that before, so I chose option 1.

cups-1.7.1p0: ok
Ambiguous: choose package for xsane
 a       0: 
         1: xsane-0.999
         2: xsane-0.999-gimp
Your choice: 1
Ambiguous: choose dependency for xsane-0.999: 
 a       0: sane-backends-1.0.24
         1: sane-backends-1.0.24-snmp

Xsane needs to be run from a root prompt to recognise my Canon LiDE 20 scanner. We've had that before in earlier Ubuntu's and it was to do with permissions and accessing the USB connection. Scans are fine.

Printing is proving to be harder to set up. CUPS has to be run as a daemon and specified in /etc/rc.local like this...

$ cat /etc/rc.local
#       $OpenBSD: rc.local,v 1.44 2011/04/22 06:08:14 ajacoutot Exp $

# Site-specific startup actions, daemons, and other things which
# can be done AFTER your system goes into securemode.  For actions
# which should be done BEFORE your system has gone into securemode
# please see /etc/rc.securelevel.

# Add your local startup actions here.

if [ -x /usr/local/sbin/cupsd ]; 
then echo -n ' cupsd'; 
/usr/local/sbin/cupsd &

echo '.'

Accessing http://localhost:631 only works when network not configured on ath0, so I imagine that is a network thing. When accessing the admin page on CUPS, no printers are found with the usb printer plugged in. The relevant lines in dmesg are...

ulpt0 at uhub4 port 1 configuration 1 interface 0 "Samsung Electronics Co., Ltd. ML-1640 Series" rev 1.10/1.00 addr 2
ulpt0: using bi-directional mode

Investigations continue...

Funny stuff

The xterm window has stopped taking text input twice now under cwm. I just killed it (SM-? xkill and click on the window) but I'm wondering why it happens.

Following -stable

On the trial install, I checked out the -stable source code for src, sys, ports and xenocara using the suggestions in the FAQ and I was able to build a kernel, an updated base system and an updated X system in about three hours. I ended up with about 50Mb of space left on the /usr partition. I tarred up the source trees before reinstalling and my next adventure is to 'pre-load' those trees back and recompile. I want to see printing work first though.

Keith Burnett, 4th October 2014