How to update OpenWRT while retaining existing configuration and all custom packages

OpenWRT upgrades itself by saving configuration files from known locations (plus manually defined files), overwriting the partition with the latest firmware and then restoring the saved configuration.

This usually works for the configuration itself, however the process doesn’t take care of any custom packages that were previously installed manually (either through LuCI or with opkg). These packages need to be noted down beforehand and then reinstalled.

How to serve custom DHCP configuration with OpenWRT’s dnsmasq

There are times when you need to filter out what some hosts in the network can or cannot do. When you have a router running OpenWRT this can be done at the firewall level.

But if you’re not much into advanced configuration and just want to completely block out some network hosts from reaching the internet (and hence phoning home) then it’s a lot simpler to do this directly from the DHCP and simply leave them without a DNS and gateway configuration.

How to optimize used space in flash storage images

Due to their write-sensitive nature, flash storage (both USB sticks and SD cards) normally don’t get zeroed out when data is deleted, making any images created for backup purposes contain random data in the empty sectors. This makes images take up the full size of the disk/card even if very little is actually used from it and also makes image poorly compressible.

The solution is to zero out the unused space in the image file before compressing it. Linux has all the tools necessary for this task readily built-in. If one is not available, a bootable self-contained system such as SystemRescue can be used instead.

How to filter SSH connections with hosts.allow on Rocky Linux / CentOS 8

The TCP Wrappers suite of programs is no longer included in RHEL 8, meaning the hosts.allow/deny files no longer exist nor work. This makes quick filtering SSH connections per IP address a bit more difficult as it requires configuring the firewall.

Luckily, the tcp_wrappers package is still available in the EPEL repository even for versions 8 so the previous functionality can be restored, albeit with some additional steps.

How to add (experimental) sensors support for IT8665E in CentOS

Due to lacking driver support for newer hardware I have been missing hardware monitoring on my home server for more than 4 years now, having access to only hard disks temperatures.

Now the time has come to upgrade the good ol’ machine to a new hardware configuration – and of course the new hardware is also unsupported in even the latest CentOS kernels.

How to play sounds (or run anything) on startup and shutdown with Raspbian

The Raspberry Pi is very handy for fun projects, and sometimes these projects require running specific events (like playing a sound) on startup or shutdown, or even in both instances – for an interactive machine that reacts to user input and presence, for example.

Sounds on startup and shutdown can also be used as a means of confirming those specific actions taking place – startup is complete and shutdown is taking place (and will complete in a very short while).

How to configure a proxy host in Apache

Proxy virtual hosts are very handy when you need to publicly access a tertiary system on your local network and you only have one IP address to use but there’s a master web server already configured.

If that server is running Apache, adding a proxy vhost to pass outside requests to the correct LAN system is as simple as adding a new virtual host to the configuration.

How to pre-configure Raspberry PI for remote SSH and Wifi

Many Raspberry PI projects are used headless (with no display device attached or if a display device exists, it’s not connected to the default HDMI or analog outputs).
In these instances it’s time consuming to connect the PI to a monitor and keyboard just to configure remote SSH access and wireless connection details (and in rare occasions it may even not be possible).

Luckily, the good folk developing Raspbian implemented shortcuts and workarounds that allow things to be pre-configured even before booting the PI.