USING-OPENBSD(7) Miscellaneous Information Manual USING-OPENBSD(7) NAME Using OpenBSD – for real DESCRIPTION Hello from OpenBSD! After wishing one too many times that I had a real BSD on a physical machine, I finally got around to just installing one on my mid-2014 MacBook Pro. I hadn't done it sooner because I didn't realize how easy it would be. It helped that I already had a “Boot Camp” partition with a disused Windows 8 install that I could replace. I roughly followed an old jcs gist along with the OpenBSD Disk Setup guide. I'm once again happy that I bought a printer— they're very useful for instructions to install an operating system on your only usable computer. I set up encrypted softraid and the operating system installed smoothly. Next I had to install rEFInd, since the default Mac boot manager is really not keen on booting much. Installing it requires using the macOS recovery partition these days. But there was a problem with my new boot menu: I was promised a picture of Puffy, and instead I just got some abstract coloured circles! Turns out a bunch of OS icons got removed from rEFInd at some point, and I had to rescue Puffy from the git history. So I could happily boot OpenBSD by selecting Puffy, but I had no networking. I thought the wifi chip might be supported by bwfm(4), but I got unlucky and it's a BCM4360, which everything hates. Based on the jcs gist, I checked the list of hardware supported by the urtwn(4) driver for a wifi dongle to order. Just having a clear list in the driver manual is wonderful. I went with the Edimax EW-7811Un v2, which I could get for around $20. It's nice and tiny, though it has a piercing blue LED (destroy all blue LEDs) which I had to cover with electrical tape. I had to do one other thing before I could get it all working, though. When I had checked the urtwn(4) hardware list, I had been looking at OpenBSD-current, but I had installed OpenBSD 6.8, and support for the v2 hardware I had bought was added after that release. So I downloaded a snapshot bsd.rd along with the urtwn(4) firmware file to a USB drive and upgraded the system. Connecting to wifi with ifconfig(8) is a breeze, by the way, and then you just write the same thing to a hostname.if(5) file to make it automatic. I wanted to use OpenBSD for exactly this reason: simple, consistent, cohesive, well-documented tools. Finally, I got to configuring. The console is configured with wsconsctl(8), and similarly you can put the commands in wsconsctl.conf(5) to have them run at boot. I added display.brightness=50% to tone down the brightness, which is initially 100%, and keyboard.backlight=0% to turn off those annoying lights. wsconsctl.conf(5) is also where you can set trackpad settings if you're not using synaptics(4). I ended up using: mouse1.tp.tapping=1 mouse1.tp.scaling=0.2 mouse1.reverse_scrolling=1 This enables tapping with several fingers to simulate different mouse buttons, makes the cursor move at a reasonable speed and scrolling move in the right direction. I also set up my usual modified QWERTY layout. For X(7) I had enabled xenodm(1), which seems quite nice. It automatically prompts you to add your ssh(1) keys to ssh-agent(1) when you log in. One of the reasons I had not wanted to set up another graphical system is that I thought I would have to make too many choices, and that I would have to choose least bad options rather than actually good options, but OpenBSD already includes reasonable choices. I wanted to use cwm(1), so I started a basic .xsession file: . ~/.profile export LC_CTYPE=en_US.UTF-8 xset r rate 175 m 5/4 0 xmodmap ~/.config/X/modmap xrdb -load ~/.config/X/resources exec cwm -c ~/.config/cwm/cwmrc The xset(1) command sets keyboard repeat rate and mouse acceleration. I spent some time going through cwm(1)'s functions and writing up bindings that would get me something close enough to what I'm used to in macOS. Most importantly, putting everything on the 4 modifier (command key). I also added key bindings on F1 and F2 to adjust the brightness with xbacklight(1), and on F10, F11 and F12 to adjust volume with sndioctl(1). I'm not sure why the F keys just send regular F1, F2, etc. regardless of the Fn key. I don't use F keys for anything else though, so I'm not too concerned. Once again, sndioctl(1) is such an easy straightforward tool: bind-key F10 "sndioctl output.mute=!" bind-key F11 "sndioctl output.level=-0.05" bind-key F12 "sndioctl output.level=+0.05" For aesthetic configuration, I added a new output to my scheme(1) colour scheme tool for X(7)-style RGB and xterm(1) resources. Normally I use the Go Mono font, but since OpenBSD already includes Luxi Mono, which Go Mono is based on, I used that. The most important configuration to make anything readable on a high-DPI display is: Xft.dpi: 144 Xft.antialias: true Xft.hinting: false I'm annoyed that I haven't found where these resources are actually documented. I would hope they'd be in Xft(3) or something, but they're not. Anyway, turning off hinting seems absolutely necessary to prevent text from looking like garbage. It seems that to get a reasonably sized cursor I need to install xcursor-dmz. I'd prefer if there wasn't this one extra package that I needed for a reasonable setup. Tangentially, I've never understood why the black versions of dmz cursors are called “aa” when it seems like that would stand for antialiasing or something. Xcursor.size: 64 Xcursor.theme: dmz-aa For a desktop background, I found a cute bitmap (little picture) of snowflakes already in the system and used colours from my usual scheme: xsetroot -bitmap /usr/X11R6/include/X11/bitmaps/xsnow \ -bg rgb:14/13/0E -fg rgb:7A/49/55 Since I'd rather not install anything I don't have to, I went with the default xterm(1). It seems more than adequate, honestly. I read through its RESOURCES section to configure it how I like. The important settings are XTerm*utf8 and XTerm*metaSendsEscape. Since I'm used to copying and pasting on macOS, I added equivalent “translations”: XTerm*VT100*translations: #override \n\ Super C: copy-selection(CLIPBOARD) \n\ Super V: insert-selection(CLIPBOARD) The next thing I needed was a clock and battery indicator. I actually had my battery die on me while I was doing all this, which reminded me. xclock(1) would be perfect, but then I'd need something else for battery. There are a couple basic battery indicators for X in ports, but they're terribly ugly. I wanted something as simple as xclock(1), but that I could add some other text to. Then I realized I could just use xterm(1) for that. To my xsession I added: xterm -name clock -geometry 14x1-0+0 -sl 0 -e clock & This places a little terminal in the top-right corner of the screen with no scrollback lines, running a script called clock. To have cwm(1) treat it like a “panel” and show it on every desktop, I added this to my cwmrc: ignore clock autogroup 0 clock,XTerm The clock script simply uses date(1) and apm(8) to print the time and battery charge every minute: tput civis sleep=$(( 60 - $(date +'%S' | sed 's/^0//') )) while :; do if [ $(apm -a) -eq 1 ]; then printf '%3s%%' "$(apm -l)" else test $(apm -b) -eq 2 && tput setaf 1 bold printf '%3.3sm' "$(apm -m)" tput sgr0 fi printf ' %s' "$(date +'%a %H:%M')" sleep $sleep sleep=60 done The initial setting of sleep is to align the updates with the minute ticking over. I made the battery output a bit fancier by showing percentage while charging, minutes left while discharging, and highlighting in red when the battery is “critical”. Now is a good time to mention adding ‘apmd_flags=-A’ to /etc/rc.conf.local to enable “automatic performance adjustment”, or not running your battery flat as fast as possible mode. It seems like I can get up to 3 hours of battery life depending on the screen brightness, but this is quite an old battery by now. The other thing I needed was something to tone down that awful, evil blue light from the screen. I asked around and someone told me about sct(1), originally written by tedu. The package also includes a little sctd(1) script that you can add to your .xsession to have it automatically adjust the colour temperature throughout the day. My eyes are no longer being assaulted. While I was doing all this, I of course needed to talk about it on IRC, and it was very nice to be able to install my own IRC client with: doas pkg_add catgirl I don't plan to do general Web Browsing on OpenBSD, and there is definitely no good choice for browser, so I just installed imv(1), mpv(1), youtube-dl(1) and w3m(1). I wrote a script to open images by piping curl(1) into imv(1), videos with mpv(1), and everything else with w3m(1) in a new xterm(1). Annoyingly, mpv(1) seems incapable of exiting without segfaulting. That's quality. One thing I am still missing is automatic brightness adjustment based on ambient light like macOS can do. I can read the sensor with sysctl(8) hw.sensors.asmc0.illuminance0, which is measured in lux. I tried doing something with it in a script, but it seems tricky to map its value to brightness adjustments and to play nice with manual brightness changes, so I'll just keep doing it manually for now. Update: prx sent mail to let me know about ⟨https://github.com/jcs/xdimmer⟩. I should've guessed jcs had written something. And that's my current OpenBSD setup after a week of using it. I'm quite enjoying it, and still being pleasantly surprised by the quality-of-life from OpenBSD tools and documentation. For a small example, I can jump to sections or flag definitions in man(1) using :t. Systems without basic usability like that should be ashamed. I would post a screenshot, but this is text.causal.agency ;) SEE ALSO https://gist.github.com/jcs/5573685 My full configurations are in ⟨https://git.causal.agency/src⟩. AUTHORS june BUGS There's a red LED inside the headphone jack that is always on and I have no idea how to turn off. If anyone knows please send me an email. Causal Agency February 14, 2021 Causal Agency