May 2, 2016

OpenBSD: After install

/etc/login.conf

First, make sure you belong to the class (not group) staff:

# user mod -L staff pau

Then give a bit more of RAM to programs

#
# Staff have fewer restrictions and can login even when nologins are set.
#
staff:\
#:datasize-cur=1536M:\
:datasize-cur=2048M:\
:datasize-max=infinity:\
:maxproc-max=512:\
:maxproc-cur=256:\
:ignorenologin:\
:requirehome@:\
:tc=default:

Allow mic and camera to record

The mic has been disabled from 6.2 (https://www.zdnet.com/article/audio-recording-is-now-disabled-by-default-in-openbsd/).

To get it back, simply run

# echo kern.audio.record=1 >> /etc/sysctl.conf # set at boot

The camera requires the same since 2021,

# echo sysctl kern.video.record=1 >> /etc/sysctl.conf # set at boot

xsession: Secure screen after suspending and avoid problems with full screen videos

Use xdm: Since you do not want to leave a terminal open, do not start X with startx. This would leave open that terminal and launch X on another one. Since you are using xdm, you need a .xsession file instead of a .xinitrc. My .xsession file looks like

xmodmap -e "keycode 22 = BackSpace BackSpace BackSpace BackSpace BackSpace BackSpace"
pkill xidle
xidle -delay 5 -sw -program "/usr/X11R6/bin/xlock -mode blank" -timeout 90 &
qiv -zr $HOME/escriptori/Galicia/*
xset -b
cwm -c /home/pau/fitx_confg/cwm/cwmrc
xcompmgr -c -C -t -18 -l -18 -r 5 -o 0.7 -f -D 5 &

The first line cancels the function Zap of X, which means that nobody can interrupt your X session by pressing CTRL+Alt+Backspace. xidle is necessary to launch the screensaver via xlock. The xcompmgr will add some nice effects to cwm and avoid system freeze when playing full screen videos or pictures (in -current, as of today, 11 June 2023).

Create /etc/apm/suspend and make it executable:

$ cat /etc/apm/suspend
#!/bin/sh
pkill -USR1 xidle

Make sure apm is running everytime after boot. If it is not, while your laptop will suspend, the script suspend will not be executed, and the screen will not be locked. To test if apmd is running, type zzz from the terminal. A message like zzz: cannot connect to apmd: No such file or directory Will tell you that your apmd is NOT running.

To have apmd run after boot, add a flag to rc.conf.local:

$ cat /etc/rc.conf.local
sshd_flags=NO
dbus_enable=YES
apmd_flags="-A -z 15"
xenodm_flags="YES"

Check your battery

The bits in rc.conf.local we described above

apmd_flags="-A -z 15"

will force your laptop to suspend when only 15% of the battery is left. If you prefer to hibernate it, choose Z instead. Check apmd(8).

Customize xdm

You can for instance change the background by adding an image and using qiv. For this, make a directory to store background images, e.g.

/usr/local/share/backgrounds/pau

and add images there. Then

# vim /etc/X11/xenodm/Xsetup_0

And change the console line to

#xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail
/usr/local/bin/qiv -zr /usr/local/share/backgrounds/pau/*

firefox

In

about:config

Set these two options:

gfx.xrender.enabled true
layers.acceleration.force-enabled true