No Hair Blog: Installing OpenBSD on a Laptop
You are here: Home > Blog > Entries > Installing OpenBSD on a Laptop

No Hair Blog

Installing OpenBSD on a Laptop

I've been using an older MacBook to deal with my headless servers. This is running OSX 10.6.8 which is prefectly workable. It can dual boot into Windows 7 (which I use to root and install various firmware on my Android phones). It's fine but I decided I wanted to use a more up-to-date OpenBSD laptop for this task as all the servers are running OpenBSD already and a more modern OS would have (ostensibly) less unpatched exploits. I just happened to have an old Dell Vostro 1500 laying around. This has a Core 2 Duo CPU. It had only 2GB of memory so I bumped it up to 4 GB (cost of 2x2GB PC2-6400 DIMMs was $18 on ebay). I also replaced to incompatible Broadcom wifi card with an Intel wifi card ($30 from parts-people.com). I made a bootable USB flash drive for the most recent OpenBSD snapshot, plugged it in and booted into the installer without problems.

[There are a number of posts on the internet about configuring and using laptops with OpenBSD which can provide details that I gloss over, such as by by Cullum Smith or Peter Hansteen, along with the helpful "how-tos" by Roman Zolotarev. I'm using a Dell which has a few quirks. If you really want to get a more fully compatible machine, consider the Lenovo Thinkpad series.]

The installer worked flawlessly, recognizing the HD and the wifi network interface which I set to dhcp. I let the installer set up the suggested partitions and mount points, the firmware was updated automatically, and I generally just accepted the defaults, including installing the X windows system and enabling xenodm. On reboot, the laptop booted without problems into my new OpenBSD system.

Several specific configuration changes were made to tune the laptop:

The X server was configured to use the Intel DRM driver, which converted the boot message to 80x40 and improved resolution while in the X11 environment. Create the directory /etc/X11/xorg.conf.d/ and the intel.conf file:

# /etc/X11/xorg.conf.d/intel.conf

Section "Device"
   Identifier "drm"
   Driver "Intel"
   Option "TearFree" "true"
EndSection

While you're at it, comment out the xconsole line in /etc/X11/xenodm/Xsetup_0 so the xconsole doesn't clutter up your screen. When you log into X at the xenodm prompt, I wanted to go to cwm which is installed as one of the default window managers in OpenBSD. So, time to create my .xsession:

# .xsession 3/17/19 gsb

# Use UTF
export LANG=en_US.UTF-8

# Use my .kshrc
export ENV=$HOME/.kshrc

# Use Xresources file
xrdb -merge $HOME/.Xresources

# Set background color 
xsetroot -solid '#48D1CC'

# Use xidle to lock display after set period of time
#xidle &

#Don't use UTF-8 with xclock
LANG= xclock -strftime "%a %e %b %Y %H:%M" &

# xbatt in top right corner
xbatt -geometry -2+0 & 

# Disable system beep
xset b off

# blank cursor when unused
# A. using unclutter
# unclutter -root -idle 2 -noevents &
# B. (current) using XTerm*pointerMode
# see .Xresources

# Start cwm
exec cwm

Also the .Xresources:

! Xresources and Xdefaults 3/16/19 gsb

! xterm configuration
! Set xterm to login shell (ksh)
XTerm*loginShell:true
! Set xterm background and font colors
XTerm*background: #0000CD
XTerm*foreground: #F0F8FF
! Set to no bold fonts
XTerm*allowBoldFonts: false
! Increase size of default font in xterm
XTerm*VT100.initialFont: 5
! terminal windows start in upper left
XTerm*geometry		: 120x40+0+0
! blank cursor when inactive
XTerm*pointerMode	: 1

! xclock config
! digital clock in lower right corner
XClock*analog		: false
XClock*twentyfour	: true
XClock*padding		: zero
XClock*geometry		: -2-2
XClock*render		: false
XClock*font		: -misc-fixed-bold-r-normal-*-13-*-*-*-*-*-iso10646-1
XClock*height		: 22 
XClock*background	: dimgray
XClock*foreground	: white
XClock* borderWidth	: 0

And my simple .cwmrc:

# .cwmrc 3/22/19 gsb

# Command menu
command firefox /usr/local/bin/firefox
command gimp /usr/local/bin/gimp

Now, enable apm:

doas rcctl enable apmd
doas rcctl apmd flags -A
doas rcctl start apmd

Now it's basically usable. I installed git and use it to connect to my webserver and edit this blog. I got a compatible USB-to-serial cable (StarTech ICUSB2321F) and I can talk to the headless servers using cu. But mostly, I use tmux, vi or vim, Firefox (although Chromium is a bit faster), and I'm learning gimp.

More later.


Posted by Gordon, No Hair Blog, Apr 5, 2019

© nohair.net and the author

For comments, corrections, and addenda, email: gordon[AT]nohair.net

Blog | Entries | Tags | Home