Understanding the LVM allocation policy

A colleague of mine asked me how LVM allocates physical extends when resizing volumes. So I decided to do a bit of research.

man 8 lvm has a section called ALLOCATION that describes how LVM allocates space, no matter if creating or resizing logical volumes (LVs). Basically, LVM tries to allocate new physical extends consecutively to any existing physical extends (PEs) if possible. When multiple LVs exist, extending the first one with consecutive PEs will not be possible, as the following PEs are already occupied by the second LV. Therefore, LVM will allocate the PEs following the last LV to the first LV.

Read more

OpenSSL cheat sheet

This is a collection of useful OpenSSL commands I don’t use frequently enough to remember them.

Generate and read CSRs

To generate a certificate signing request, first create a configuration file ( Source ):

[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
utf8 = yes
[req_distinguished_name]
C = DE
ST = Nordrhein-Westfalen
L = Bochum
O = Ruhr-Universität Bochum
CN = einrichtung.ruhr-uni-bochum.de (die Hauptdomain)
[v3_req]
subjectAltName = @alt_names
[alt_names]
DNS.1 = einrichtung.ruhr-uni-bochum.de
DNS.2 = www.einrichtung.ruhr-uni-bochum.de

And create a private key: openssl genrsa -out einrichtung.rub.de.key 4096. Afterwards, generate the CSR from the private key and the configuration file: openssl req -new -out einrichtung.rub.de.csr -key einrichtung.rub.de.key -config csr.conf. View the contents of the CSR using openssl req -in einrichtung.rub.de.csr -noout -text.

Read more

Limit log size of individual systemd units using log namespaces

For verbose services, I like to limit the maximum log file size of the corresponding systemd units independently, to avoid flushing system messages of other, less verbose services from the journal.

In systemd-journald, this is possible using a log namespace. Add the following to the systemd unit definitions that should be moved to the new namespace, e.g. using systemctl edit:

[Service]
LogNamespace=mylognamespace

And create the corresponding log namespace by creating a configuration file /etc/systemd/journald@mylognamespace.conf, e.g. by copying the main configuration file /etc/systemd/journald.conf.

Read more

`Connection refused` when downloading go packages

A common issue I encounter after setting up Arch Linux hosts occurs when installing go packages:

clean.go:8:2: github.com/Jguer/aur@v1.2.3: Get "https://proxy.golang.org/github.com/%21jguer/aur/@v/v1.2.3.zip": dial tcp: lookup proxy.golang.org on [::1]:53: read udp [::1]:41284->[::1]:53: read: connection refused

The error messages say connection refused which may be misleading. In my case, this issue is always related to using systemd-resolved for DNS resolution without setting up the stub-resolv.conf. DNS resolution in other tools like curl works, which makes this issue even harder to detect. But go seems to rely on /etc/resolv.conf, so if that is not set up as a link to /run/systemd/resolve/stub-resolv.conf, the errors above will appear.

Read more

libvirt user networking or: secure setup of libvirt-based server VMs

I know, the introduction says

there is no much point in publishing the 999th blog on Linux / ZigBee / HomeAssistant / whatever

and yet already the first post will be at least somewhat HomeAssistant related. But I think that this is a poorly-covered detail on the internet, so it might be worth a read.

A couple of weeks ago, HomeAssistant deprecated the core and supervised installation methods, requiring a migration to a VM- or container-based setup .

Read more

My First Post

Hello World. Posts seem to work.

Read more