[ home ]
I have used the instructions in this page to install amd64 OpenBSD 6.4 with the xfce4 desktop, graphical login, automatic mounting of USB sticks, with a basic set of applications on a Thinkpad X220 (legacy boot) laptop with 8 Gb RAM and a 240Gb mechanical hard drive.
Below are some links to other pages about using OpenBSD on laptops.
/etc/installurland use in preference to
I suggest that you print and read this page before proceeding.
Background reading: FAQ 4: The OpenBSD installation guide.
The steps below assume that you have successfully installed the base
OpenBSD system from the USB stick installer (
or the CD-ROM image (
Background reading: OpenBSD FAQ 6.2.1, 6.13.
Jack into your router with a cable and...
# dhclient em0 DHCPDISCOVER on em0 - interval 3 DHCPOFFER from 192.168.0.1 (00:1b:2f:42:41:42) DHCPREQUEST on em0 to 255.255.255.255 DHCPACK from 192.168.0.1 (00:1b:2f:42:41:42) bound to 192.168.0.4 -- renewal in 43200 seconds. #
Then install any non-free firmware that your laptop might need...
Pull the cable out and set up a wifi connection. Most Thinkads have Intel wifi cards...
$ su -l # ifconfig -a # shows a list of all the interfaces # ifconfig iwn0 up # ifconfig iwn0 scan # ifconfig iwn0 nwid connection_name wpakey password wpaprotos wpa1,wpa2 # dhclient iwn0 DHCPREQUEST on iwn0 to 255.255.255.255 # lots more output
Warning: You need to use the
option with argument
wpa1 to enable connections using
wpa1 protocol is now considered
Background Reading: FAQ
6 Configuring Your Wireless Adapter section of
Wireless Networking, man
hostname.iwn0 file looks like this...
foo$ cat /etc/hostname.iwn0 # line below connects to my home wifi (no need for wpaprotos) join myhomewifi wpakey wifi_password # wpaprotos keyword not supported at present # line below connects to central reference library's open wifi join Visitors_Library_of_Birmingham # line below requests IP address and DNS details dhcp
I found that OpenBSD would automatically connect to an
open wifi access point without an entry in the
hostname.iwn0 file. Future releases may
change this behaviour.
At the time of writing, the join feature has limited parsing of lines
hostname.iwn0 file, in particular, the
keyword is not supported, so you can't automatically join a wpa1
When populating your
hostname.iwn0 file, the commands
below can be used to remove existing settings, and then restart
networking without rebooting the machine...
# ifconfig iwn0 down # pkill dhclient # sh /etc/netstart
Background reading: OpenBSD FAQ 15.2.
pkg_add command reads the URL of the package
mirror from the
/etc/installurl file which is set to the
OpenBSD content distribution network by default when installing version
To install applications, you need to become root and run
$ su -l # pkg_add nano quirks-2.114 signed on 2015-08-09T15:30:39Z nano-2.4.2: ok # exit $
Once the command returns, exit root and try editing a text file with nano.
I like the xfce desktop and the packages below will install Firefox, a pdf reader, an image organiser, a music player and an office package.
# pkg_add -v consolekit2 xfce xfce-extras evince firefox shotwell audacious audacious-plugins libreoffice
consolekit2 package is needed to allow the user to
shut down or reboot from within xfce4 without using terminal commands.
pkg_add will stop when it reaches the document reader
Evince and offer you a choice of two versions of the package, each
compiled with different configuratons...
# pkg_add evince quirks-2.114 signed on 2015-08-09T15:30:39Z Ambiguous: choose package for evince a 0: <none> 1: evince-3.16.1p0 2: evince-3.16.1p0-light Your choice: 2
Option 1 will pull in a large number of Gnome libraries. Option 2 has been provided by the packager for those of us who wish to use Evince to read pdf files with a different desktop or window manager.
Some of the more complex packages come with
/usr/local/share/doc/pkg-readmes/. It is best
to read these to complete configuration of the package.
Don't reboot yet. You need to configure the graphical login and set up some daemons. See below...
/etc/rc.conf.localto enable apmd and graphical log-in
Background reading: Comparison
of Desktop Environments, ConsoleKit Github
readme with definitions, xenodm man page and
the package_readme for consolekit2 at
As root add some lines to
/etc/rc.conf.local to enable power management
apmd) so that you can use Fn-F4 to suspend your thinkpad,
and to enable the graphical log-in manager
is an OpenBSD fork of the venerable
# nano /etc/rc.conf.local multicast_host=YES # Some avahi shenanigans apmd_flags="-A" # Laptop power saving xenodm_flags="" # Starts xenodm graphical login pkg_scripts="messagebus" # Enables dbus/ConsoleKit stuff
Then as user add an
.xsession file with
a line that will start consolekit so that you can shutdown &c from
$ cat .xsession exec ck-launch-session startxfce4
My Thinkpad X220 has 8Gb of RAM. Firefox (and Chromium) like lots of
RAM. By default, OpenBSD enforces limits on the largest amount of RAM
that a user level program can use to around 1.5Gb, and if it exceeds
that limit, the OOM killer will terminate the process. Your user will be
part of the
staff group and you can edit
/etc/login.conf to increase the default limit. Mine is set as follows...
# # Staff have fewer restrictions and can login even when nologins are set. # staff:\ :datasize-cur=4096M:\ :datasize-max=infinity:\ :maxproc-max=512:\ :maxproc-cur=256:\ :ignorenologin:\ :requirehome@:\ :tc=default:
Reboot and you'll get the xenodm login greeter. When you log in, Xfce4 will ask you to specify a layout, and then show you the desktop.
/etc/doas.confto allow user mounting of an external USB stick
Background reading: OpenBSD FAQ sections 10 (doas), 14 (File Systems Intro)
as well as
man doas and
You must use
doas and a few lines in
/etc/doas.conf to allow user mounting of USB sticks. My
/etc/doas.conf file looks like this...
$ cat /etc/doas.conf # http://daemonforums.org/showthread.php?t=9774 permit nopass keith as root cmd mount permit nopass keith as root cmd umount
Then you can mount a USB stick like this...
$ mkdir ~/usb # make a directory to mount to $ doas mount /dev/sd1i /home/keith/usb # mounts my USB on ~/usb
The mount command tells me what partitions and disks are mounted...
$ mount /dev/sd0a on / type ffs (local) /dev/sd0k on /home type ffs (local, nodev, nosuid) /dev/sd0d on /tmp type ffs (local, nodev, nosuid) /dev/sd0f on /usr type ffs (local, nodev) /dev/sd0g on /usr/X11R6 type ffs (local, nodev) /dev/sd0h on /usr/local type ffs (local, nodev, wxallowed) /dev/sd0j on /usr/obj type ffs (local, nodev, nosuid) /dev/sd0i on /usr/src type ffs (local, nodev, nosuid) /dev/sd0e on /var type ffs (local, nodev, nosuid) /dev/sd1i on /home/keith/usb type msdos (local, uid=1000, gid=1000)
Once mounted, you can use a graphical file manager like Thunar to
copy and paste files to and from your storage stick. You can't unmount
the USB stick from Thunar, remember to use the
/dev/sd1i command before removing the USB stick...
doas umount /dev/sd1i # un-mounts the drive
/etc/fstabentry to allow graphical mount/unmount of a USB thumb drive
Background reading: xfce4-mount-plugin page on the Xfce Web site.
A note on how disks get numbered: There are two possibilities for a simple installation on a laptop with a single main hard drive...
sd0. Your USB stick will be recognised as
sd0but you will have installed OpenBSD to a softraid device numbered
sd1. So your USB stick will be recognised as
The rest of this section assumes that you have an OpenBSD install on
sd0. Just increase the drive numbers by 1 for an
installation using whole drive encryption.
xfce4-mount package is installed as part of the
xfce4 package set. Add an icon for the plugin to the XFCE4
panel by right-clicking on the panel and selecting
Panel | Add New Items and searching for 'mount'.
xfce4-mount-plugin lists all the devices
including the default local hard drive including all the partitions on
sd0. I can set options to prevent that and to use a custom mount
command. Right click over the xfce4-mount icon and select
Properties | File Systems tab. Add the pattern
/dev/sd0* to the Exclude specified file systems textbox so
the local drive is not listed.
Right-click on the xfce4-mount icon, and selected Preferences | Commands and write the following in the Custom Commands textboxes, after ensuring that the Custom Commands checkbox was ticked...
doas mount %m doas umount %m
Now to ensure that a USB stick is listed in the
xfce4-mount-popup list, you have to add a line for the device to
/etc/fstab. My extra line looks like this (adapted from the
/dev/sd1i /home/keith/usb msdos rw,noauto 0 0
fstab entry like this means that only one vfat
formatted USB thumb drive will be listed and available with mouse
Background reading: pages about following the
-stable branch or following the
-current branch, and the OpenBSD 6.4 Errata
syspatch command provides binary updates to the core
system. Running the
syspatch command without arguments on OpenBSD 6.4 at the time of writing gives
$ su Password: foo# syspatch Get/Verify syspatch64-001_xserver... 100% |*************| 1227 KB 00:04 Installing patch 001_xserver Get/Verify syspatch64-002_syspatc... 100% |*************| 4627 00:00 Installing patch 002_syspatch syspatch updated itself, run it again to install missing patches foo# syspatch foo#
M:Tier sponsors OpenBSD and has provided
the packages in the stable release for use together with the
openup script. They recommend using
upgrade packages that you have installed in addition to the base
system. I have yet to try
openup on OpenBSD 6.4
Background reading: OpenBSD FAQ sections 14.1, 14.2 and 14.3.
In OpenBSD 6.4 I used the commands detailed in the FAQ to create an encrypted softraid device and then install OpenBSD within that device. I omitted the command to over-write the disk with random numbers because of time.
Because I install from a USB stick, the drive numbering is 'off by one' compared to the example commands in the FAQ, so the fixed disk in the laptop is sd0 and the USB stick that I am installing from is sd1. The softraid device I install OpenBSD to is therefore sd2. The commands I actually used in the installer shell session are shown below.
Boot from the installer USB stick and then select
[S]hell to get a command prompt...
# fdisk -iy sd0 # MBR not GPT # disklabel -E sd0 >a a offset: size:[the size of your drive] FS type:[4.2BSD] RAID >w >q No label changes # bioctl -c C -l sd0a softraid0 New pass phrase: re-type passphrase # cd /dev && sh MAKEDEV sd2 # dd if=/dev/zero of=/dev/rsd2c bs=1m count=1 # exit
exit command starts the installer script and you
type in the root password, your user and the user password and so on.
Then you select
sd2 as the disk to install to. You also
have to specify
[disk] as the location of the package sets
and then answer 'no' when asked if the disk is mounted, select
sd1, mount the
a partition. The installer
script should then find the package sets.
When you reboot into the new installation, you will be asked to enter
the pass phrase for the encrypted disk, and then OpenBSD should show the
usual boot dialogue. You will see a message about renumbering the
operating system disk as
sd1, because the USB stick I
installed from has been removed. The
/etc/fstab file shows
UUIDs for each partition, so the boot loader can find the
Keith Burnett, 7th November 2018: Updated for OpenBSD 6.4.