My OpenBSD cheatsheet.

Installation

From an USB flash drive

Get the image:

curl -o /tmp/install68.img https://cdn.openbsd.org/pub/OpenBSD/6.8/amd64/install68.img

Write the image on the flash drive:

sudo dd if=/tmp/install68.img of=/dev/sdc bs=4M

Reboot and do the install

sudo reboot

Installation

Full Disk Encryption

TODO

Installation

Nothing to say, just arswers the questions

Postinstall tasks

doas

Configure doas:

$ cat /etc/doas.conf
# $OpenBSD: doas.conf,v 1.1 2016/09/03 11:58:32 pirofti Exp $
# Configuration sample file for doas(1).
# See doas.conf(5) for syntax and examples.

# Non-exhaustive list of variables needed to build release(8) and ports(7)
#permit nopass setenv { \
#    FTPMODE PKG_CACHE PKG_PATH SM_PATH SSH_AUTH_SOCK \
#    DESTDIR DISTDIR FETCH_CMD FLAVOR GROUP MAKE MAKECONF \
#    MULTI_PACKAGES NOMAN OKAY_FILES OWNER PKG_DBDIR \
#    PKG_DESTDIR PKG_TMPDIR PORTSDIR RELEASEDIR SHARED_ONLY \
#    SUBPACKAGE WRKOBJDIR SUDO_PORT_V1 } :wsrc

# Allow wheel by default
permit persist keepenv :wheel

Add the main user to the wheel group:

$ user mod -G wheel killruana

Useful packages

doas pkg_add curl git htop tree weechat

chezmoi

doas pkg_add go
mkdir projects
cd projects
git clone --depth 1 https://github.com/twpayne/chezmoi.git
cd chezmoi
go run . init https://git.slaanesh.org/killruana/dotfiles.git
go run . apply

Neovim

doas pkg_add neovim
mkdir -p \
    "$HOME/.local/share/dein/repos/github.com/Shougo/dein.vim"
git clone --depth=1 \
    https://github.com/Shougo/dein.vim \
    "$HOME/.local/share/dein/repos/github.com/Shougo/dein.vim"
    

System maintenance

Upgrading to current

doas sysupgrade -s

Keeping current up to date

doas sysupgrade -s

And after the reboot:

doas pkg_add

Network

Wifi

$ cat /etc/hostname.ral0         
join myssid1 wpakey dapassword
join publicwifi
dhcp

Interface bonding

$ cat /etc/hostname.re0
up
$ /etc/hostname.ral0         
join myssid1 wpakey dapassword
join publicwifi
up
$ cat /etc/hostname.trunk0                                                                                                        
trunkproto failover trunkport re0
trunkport ral0
dhcp

Power management

For having suspend (zzz) and hibernation (ZZZ), enable the APM daemon:

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

X

Disable xconsole

Comment the xconsole line in the file /etc/X11/xenodm/Xsetup_0.

Enable tap as click

Add mouse.tp.tapping=1 to the file /etc/wsconctl.conf.

i3 desktop

doas pkg_add firefox i3-gaps i3lock i3status scrot thunderbird

Build the system from sources

Preparation

For avoiding the use of the root account, we add yourself to some systems groups:

doas user mod -G wsrc,wobj killruana

Reconnect then:

cd /usr
doas mkdir -p xenocara ports
doas chgrp wsrc xenocara ports
doas chmod 775 xenocara ports

Get the sources

From tarball (prefered way)

Get and extract the sources:

cd /tmp
curl --remote-name-all 'https://ftp.fr.openbsd.org/pub/OpenBSD/6.8/{src,sys,xenocara,ports}.tar.gz'
cd /usr/src
tar xzf /tmp/src.tar.gz
tar xzf /tmp/sys.tar.gz
cd /usr/xenocara
tar xzf /tmp/xenocara.tar.gz
cd /usr
tar xzf /tmp/ports.tar.gz

From git

Clone the repos:

cd /usr
git clone --depth 1 https://github.com/openbsd/src.git
git clone --depth 1 https://github.com/openbsd/xenocara.git
git clone --depth 1 https://github.com/openbsd/ports.git

Update the sources

With cvs (prefered way)

cd /usr/src
cvs -qd anoncvs@anoncvs.fr.openbsd.org:/cvs up -Pd -A
cd /usr/xenocara
cvs -qd anoncvs@anoncvs.fr.openbsd.org:/cvs up -Pd -A
cd /usr/ports
cvs -qd anoncvs@anoncvs.fr.openbsd.org:/cvs up -Pd -A

With git

cd /usr/src
git pull origin master
cd /usr/xenocara
git pull origin master
cd /usr/ports
git pull origin master

Build the system

Build and install the kernel:

cd /sys/arch/$(machine)/compile/GENERIC.MP
make obj 
make config
make "-j$(( $(sysctl -n hw.ncpu) * 2 ))"
doas make install
doas reboot 

Build the new base system:

cd /usr/src 
make obj 
doas make build "-j$(( $(sysctl -n hw.ncpu) * 2 ))"
doas sysmerge
cd /dev 
doas ./MAKEDEV all

Build xenocara:

cd /usr/xenocara
make bootstrap 
make obj 
doas make build "-j$(( $(sysctl -n hw.ncpu) * 2 ))"

Ports

TODO