[ home ]
I have used the instructions in this page to install amd64 OpenBSD 6.6 with the xfce4 desktop, graphical login, automatic mounting of USB sticks, with a basic set of applications on a Thinkpad L440 (legacy boot) laptop with 8 Gb RAM and a 200Gb SSD. Some of the links in this page relate to earlier versions of OpenBSD 6.x.
The L440 with 8Gb and an ssd is responsive. Battery life is an hour or two less than with a popular Linux distribution.
Below are some links to other pages about using OpenBSD on laptops.
/etc/installurl
and use in preference to PKG_PATH
I suggest that you print and read this page before proceeding.
Background reading: FAQ 4: The OpenBSD installation guide and useful mail list thread.
The steps below assume that you have successfully installed the base
OpenBSD system from the USB stick installer (install66.fs
).
One thing to remember is that the installer is running from RAM and knows nothing about the USB drive you have plugged in. When you reach the part of the installation dialogue that asks you for the location of the sets (the system files to install) you have to specify [disk] and answer [No] when the script asks if the disk is mounted. The script will then list the available disks and ask you which one has the sets. The list will probably be something like [sd0 sd1] for an installation that is not using drive encryption and sd1 is likely to be your USB stick.
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. The Thinkpad L440 required the wifi drivers, intel firmware and a couple of other files.
# fw_update
Pull the cable out and set up a wifi connection. Most Thinkpads have Intel wifi cards. The L440 uses the iwm0 driver (earlier Thinkpads used the iwn0 driver)
$ su -l # ifconfig -a # shows a list of all the interfaces # ifconfig iwm0 up # ifconfig iwm0 scan # ifconfig iwm0 nwid connection_name wpakey password wpaprotos wpa1,wpa2 # dhclient iwm0 DHCPREQUEST on iwm0 to 255.255.255.255 # lots more output
Warning: You need to use the wpaprotos
option with argument wpa1
to enable connections using
wpa1
. The wpa1
protocol is now considered
insecure.
Background Reading: FAQ
6 Configuring Your Wireless Adapter section of
Wireless Networking, man
hostname.if
My hostname.iwm0
file looks like this...
foo$ cat /etc/hostname.iwm0 # line below connects to my home wifi join myhomewifi wpakey wifi_password wpaprotos wpa1 # line below might connect to an open wifi [needs testing] join Visitors_Library_of_Birmingham # line below requests IP address and DNS details using DHCP dhcp
When experimenting with lines in your hostname.iwm0
file, the commands below can be used to remove existing settings, and
then restart networking without rebooting the machine...
# ifconfig iwm0 down # pkill dhclient # sh /etc/netstart
The kernel will use the auto-join
algorithm to pick a wifi access point to connect to if there is more
than one in range when you start networking. You don't have to use a
hostname.if
file at all if you prefer to explicitly choose
a wifi network to join (e.g a guest network at work instead of the
authenticated one). You can just type in the commands each time you want
to use a different wifi access point, or add some lines to
doas.conf
and use a little script from your user space to
select which access point to use. I find that hostname.if
fits my use case as I use just a few different and widely spaced
locations.
Background reading: OpenBSD FAQ 15.2.
The 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
6.6
To install applications, you need to become root and run
pkg_add
.
$ su -l foo# pkg_add nano # example from 6.5 quirks-3.124 signed on 2019-04-15T12:10:16Z quirks-3.124: ok nano-4.0:libiconv-1.14p3: ok nano-4.0:gettext-0.19.8.1p3: ok nano-4.0: 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
The 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 readme
files
installed to /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.local
to enable apmd and graphical
log-inBackground reading: Comparison
of Desktop Environments, ConsoleKit Github
readme with definitions, xenodm man page and
the package_readme for consolekit2 at
/usr/local/share/doc/pkg-readmes/consolekit2
. Note
that as of OpenBSD 6.5, you
can no longer start an X session using startx as a user, you have to
enable xenodm to start an X session.
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 xenodm
. Xenodm
is an OpenBSD fork of the venerable xdm
.
# 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
within xfce4.
$ cat .xsession exec ck-launch-session startxfce4
From OpenBSD 6.5, you need to add your user to the operator group to be able to shutdown from within xfce4...
# usermod -G operator $USER
...where you replace $USER with the name of your user account.
/etc/login.conf
My Thinkpad L440 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.conf
to allow
user mounting of an external USB stickBackground reading: OpenBSD FAQ sections 10 (doas), 14 (File Systems Intro)
as well as man doas
and man mount
.
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 umount
/dev/sd1i
command before removing the USB stick...
doas umount /dev/sd1i # un-mounts the drive
xfce4-mount-plugin
and an /etc/fstab
entry to allow graphical mount/unmount of a USB thumb driveBackground 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 sd1
.sd0
but you will have installed OpenBSD to a softraid
device numbered sd1
. So your USB stick will be recognised
as sd2
.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.
The 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'.
By default, 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
examples in man fstab
...
/dev/sd1i /home/keith/usb msdos rw,noauto 0 0
Using an fstab
entry like this means that only one vfat
formatted USB thumb drive will be listed and available with mouse
clicks.
Background reading: pages about following the
-stable
branch and the OpenBSD 6.6 Errata
page.
The syspatch
command provides binary updates to the core
system. Running the syspatch
command without arguments on
OpenBSD 6.6 gave...
$ su Password: foo# syspatch Get/Verify syspatch66-001_bpf.tgz 100% |****************| 102 KB 00:02 Installing patch 001_bpf Get/Verify syspatch66-002_ber.tgz 100% |****************| 660 KB 00:10 Installing patch 002_ber Get/Verify syspatch66-003_bgpd.tgz 100% |***************| 181 KB 00:02 Installing patch 003_bgpd Get/Verify syspatch66-004_net8021... 100% |*************| 64839 00:00 Installing patch 004_net80211 Get/Verify syspatch66-005_sysupgr... 100% |*************| 3023 00:00 Installing patch 005_sysupgrade Get/Verify syspatch66-006_ifioctl... 100% |*************| 381 KB 00:06 Installing patch 006_ifioctl ... more lines... Get/Verify syspatch66-016_ripd.tgz 100% |********************| 45685 00:00 Installing patch 016_ripd Relinking to create unique kernel... done; reboot to load the new kernel Errata can be reviewed under /var/syspatch
M:Tier sponsors OpenBSD and has provided binpatches
for
the packages in the stable release for use together with the
openup
script. They recommend using openup
to
upgrade packages that you have installed in addition to the base
system. I have yet to try openup
on OpenBSD 6.6
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:[64] 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
The 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
partitions.
Keith Burnett, 22nd December 2019: Updated for OpenBSD 6.6 release