nick.breen.kiwi

Nick Breen's Blog, that's all.

Background

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.

Building a Package From Source

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.

  1. 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
    
  2. Update:

    apt update
    
  3. Build:

    apt -b source collectd
    
  4. 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.

  1. Checkout the sources from source control:

    debcheckout collectd
    
  2. Ensure build dependencies are available:

    apt build-dep collectd
    
  3. Build:

    cd collectd/
    debuild -b -uc -us
    
  4. Install:

    dpkg -i collectd-core_5.12.0-9_arm64.deb