You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

169 lines
5.6 KiB

+++
title = 'OpenBSD notes'
date = '2023-11-14T09:31:48+0100'
#lastmod = ''
#showDate = false
showReadingTime = false
showWordCount = false
showPagination = false
#showAuthor = false
showBreadcrumbs = true
feed_exclude = true
# site_exclude = true
draft = true
+++
These are my notes that I want to summarize about the OpenBSD
operating system.
## Get some filesystem information
```console
$ dumpfs /dev/rsd1a
magic 19540119 (FFS2) time Thu Nov 16 21:14:34 2023
[...] (snip; lots of output...)
```
## Python
### ModuleNotFoundError
I recently tried to look at CHIRP, a tool to program (amateur) radios.
But at its start I only got an error:
~~~console
$ chirp
09:29:10: Debug: Adding duplicate image handler for 'Windows bitmap file'
09:29:10: Debug: Adding duplicate animation handler for '1' type
09:29:10: Debug: Adding duplicate animation handler for '2' type
09:29:10: Debug: Adding duplicate image handler for 'Windows bitmap file'
09:29:10: Debug: Adding duplicate animation handler for '1' type
09:29:10: Debug: Adding duplicate animation handler for '2' type
09:29:10: Debug: Adding duplicate image handler for 'Windows bitmap file'
09:29:10: Debug: Adding duplicate animation handler for '1' type
09:29:10: Debug: Adding duplicate animation handler for '2' type
Traceback (most recent call last):
File "/usr/local/bin/chirp", line 8, in <module>
sys.exit(chirpmain())
File "/usr/local/lib/python3.10/site-packages/chirp/wxui/__init__.py", line 36, in chirpmain
from chirp.wxui import main
File "/usr/local/lib/python3.10/site-packages/chirp/wxui/main.py", line 49, in <module>
from chirp.wxui import printing
File "/usr/local/lib/python3.10/site-packages/chirp/wxui/printing.py", line 18, in <module>
import yattag
ModuleNotFoundError: No module named 'yattag'
~~~
Most of these kind of errors look like this and it's quite clear: we need to install
a package called yattag -- more precisely it is a python module.
I do install python modules this way:
~~~console
$ python3 -m pip install --user --upgrade yattag
Collecting yattag
Downloading yattag-1.15.2.tar.gz (28 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: yattag
Building wheel for yattag (pyproject.toml) ... done
Created wheel for yattag: filename=yattag-1.15.2-py3-none-any.whl size=15667 sha256=115df1349df26ea2ad2c0fdbf25c808a79242711fe2d7d44c97a0868a5454dd1
Stored in directory: /home/dominic/.cache/pip/wheels/3f/6e/e5/d526243c27041915f63eacc0804babeb86b6973b0bc1991f06
Successfully built yattag
Installing collected packages: yattag
Successfully installed yattag-1.15.2
~~~
## Git
## Cloudlog
Cloudlog is a webapplication written in PHP that allows ham radio amateurs
to log contacts online. I host my own instance on my server and I finally
looked into why I never got satellites shown in <kbd>SAT Timers</kbd>.
I use php-fpm and it is running as the user `www`. It is kind of jailed and it
cannot read `/etc/ssl/cert.pem` -- so the https connections cannot be verified
and it failes at downloading the satellites infos from other websites.
I solved this by copying `/etc/ssl` to `/var/www/etc/ssl` via rsync, keeping file
permissions intact. I may setup a cronjob for this maybe.
~~~console
$ cd /var/www
$ doas rsync -avhzrp /etc/ssl/ etc/ssl
sending incremental file list
created directory etc/ssl
./
cert.pem
ikeca.cnf
openssl.cnf
x509v3.cnf
private/
sent 155.82K bytes received 133 bytes 311.90K bytes/sec
total size is 344.08K speedup is 2.21
$ doas rcctl restart php80_fpm
php80_fpm(ok)
php80_fpm(ok)
~~~
## Z-Shell
### Where is this alias defined?
I defined an alias `ls` but I forgot where it was.
~~~console
$ PS4='+%x:%I>' zsh -i -x -c '' |& grep ls
~~~
### Renaming multiple directories
~~~console
$ count=1; zmv -n '*' '$f[1,4]/$((count++))-$f[12,-1]'
mv -- 2023-08-05-problems-with-apt-keys-on-my-hotspots 2023/51-problems-with-apt-keys-on-my-hotspots
mv -- 2023-08-26-dmrhost-on-a-raspberrypi4-with-openbsd-or-freebsd 2023/52-dmrhost-on-a-raspberrypi4-with-openbsd-or-freebsd
mv -- 2023-09-16-openbsd-current-built-from-source 2023/53-openbsd-current-built-from-source
~~~
Moves subdirectories into other folder structure with a counting variable.
~~~console
$ count=16; zmv -Q '*(/)' '$((count++))-$f[12,-1]'
mv -- 2021-08-08-win10-grub2-and-uefi 16-win10-grub2-and-uefi
mv -- 2021-08-12-running-n1mm-logger-on-linux 17-running-n1mm-logger-on-linux
mv -- 2021-10-03-winlink-and-vara-on-linux 18-winlink-and-vara-on-linux
mv -- 2021-10-03-wordlist-generation 19-wordlist-generation
mv -- 2021-10-26-processes-accessing-mountpoints 20-processes-accessing-mountpoints
~~~
That was the second part, counting from where we stopped from the previous directory.
There was a draft post left in `2022` which I deleted, now I had to renumber the folders
from `28-*` to `34-` to a number lower by 1.
~~~console
$ for i in {29..34}; do zmv -n -W $i'*' $((--i))'*'; done
mv -- 29-using-nfs-on-a-raspberry-pi 28-using-nfs-on-a-raspberry-pi
mv -- 30-vpn-tunnel-into-hamnet-on-fedora-36 29-vpn-tunnel-into-hamnet-on-fedora-36
mv -- 31-winlink-on-linux-fix-invalid-handle-on-logfiles 30-winlink-on-linux-fix-invalid-handle-on-logfiles
mv -- 32-hamnet-on-the-pfsense 31-hamnet-on-the-pfsense
mv -- 33-changing-network-metrics-on-linux 32-changing-network-metrics-on-linux
mv -- 34-change-git-submodule-url 33-change-git-submodule-url
~~~
So, there is still one post left that is actually a draft post and I'd like to
remove the leading number from that directory.
~~~console
$ zmv -n -W '59-*' '*'
mv -- 59-pat-winlink-on-openbsd pat-winlink-on-openbsd
~~~