I needed to use collectd
with its NUT plugin on RaspberryPi OS, this
particular release did not have collectd’s NUT plugin available.
The next release of Raspberry Pi OS does include the NUT plugin as does (apparently) proposed updates; but how to use those versions of the package?
[APT Pinning][https://help.ubuntu.com/community/PinningHowto] to the rescue, but it does recommend not using pinning.
Instead it recommends you build the package from source: in this case the proposed updates source version enables the NUT plugin again, so we’ll avoid any kind of multi-release nonsense and just build the package ourselves.
Because we’re building the distribution’s packages we could build them in /usr/src.
apt source
will just download and extract the sources to the current directory.
So cd
to where-ever you want to do this.
Enable sources: uncomment deb-src
lines for your release in /etc/apt/sources.list
:
deb http://deb.debian.org/debian bullseye main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free
Update:
apt update
Build:
apt -b source collectd
Install:
dpkg -i collectd-core_5.12.0-7_arm64.deb
Easy!
Except, this built collectd-5.12.0-7, it does not contain the NUT plugin.
dpkg --contents collectd-core_5.12.0-7_arm64.deb | grep usr/lib/collectd/nut.so
However a newer (distribution) version is available: 5.12.0-9 which does include the NUT plugin. Let’s build that one instead.
Checkout the sources from source control:
debcheckout collectd
Ensure build dependencies are available:
apt build-dep collectd
Build:
cd collectd/
debuild -b -uc -us
Install:
dpkg -i collectd-core_5.12.0-9_arm64.deb