nosh with Debian's sysstat package

From: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups_at_NTLWorld.com>
Date: Sun, 29 Jan 2017 21:40:25 +0000

Someone:

> I haven't installed much else yet on the system but I tried the
> sysstat package which gives me the following error:
>
>
> preset: ERROR: sysstat: No such file or directory
>
>
> I haven't yet investigated this problem. Sysstat seems to be part of
> the Debconf enable/disable system, I'm not quite sure how that
> interacts with nosh.
>

This is a good example for general consumption.

The maintenance script for the package is trying to enable the "sysstat"
service using the "update-rc.d" command. You've installed the shim for
this command from the nosh-debian-shims package, so the maintenance
script is actually ending up trying to preset the "sysstat" service
bundle using "system-control preset". You don't have a "sysstat"
service bundle. Yet.

Ironically, if the systemd support in Debian's "sysstat" were as good as
the author's own, you could just make one. The origin package comes
with a systemd service unit, built by passing this through a macro
processor to turn things like _at_SA_LIB_DIR@ into "/usr/lib/sysstat":

* https://github.com/sysstat/sysstat/blob/master/sysstat.service.in

Debian, however, only builds and packages up a Debian-supplied van
Smoorenburg rc file. It doesn't actually package up the systemd support
that comes from the author. It does provide the /usr/lib/sysstat/sa1
script that is referenced by the systemd service unit, however. So you
could take the sysstat.service.in, manually make a sysstat.service out
of it, and pass that through convert-systemd-units to make a service
bundle that would invoke /usr/lib/sysstat/sa1 .

However, we are heading into systemd House of Horror territory here, as
Debian also provides a "Debianized" version of the sa1 script as
/usr/lib/sysstat/debian-sa1 that does the stuff that Debian's van
Smoorenburg rc script does. So using what's in the box we would have
sysstat.service which sets up settings the systemd way, running the
debian-sa1 script that sets up things the Debian way (reading
/etc/defaults/sysstat), running the sa1 script that sets things up the
RedHat/SuSE way (/etc/sysconfig/sysstat). It's a mess of nested shell
scripts and overlapping configuration mechanisms. And that's
overlooking the surprise secret second service disable mechanism.

The systemd people don't like surprise secret second service disable
mechanisms, and the modern Debian practice is to not have them. The
Debian sysstat package has more than one thing to improve. Moreover
there's no real need for all of these configuration mechanisms,
especially since the underlying command has only two knobs to twiddle in
the first place. So start with a more ideal-world version of what
sysstat should have for systemd: a simple service unit that has 1
configuration mechanism, and cuts out all of the daft middle-men layers
of shell scripting entirely.

1. Take this service unit instead. Call it sysstat.service .
2. Use convert-systemd-units to make a service bundle from it. chown
everything to root if you didn't do this as root.
3. Place that in /var/local/sv/sysstat .
4. install -d -m 0755 /var/local/sv/sysstat/service/env
5. system-control set-service-env sysstat OPTIONS -D

See what happens when you install the package then.

   [Unit]
   Description=Insert a dummy record in sysstat's current daily data
file to indicate that the counters have restarted from 0.

   [Service]
   # The service is "ready" after it has run to completion.
   Type=oneshot
   # This enables controlling service options with rcctl set and rcctl get .
   EnvironmentDirectory=env
   # Two - characters, note. Also, this is specifically targetting
being converted into a nosh service bundle.
   ExecStart=/usr/lib/sysstat/sadc -F -L ${OPTIONS} "${DIR:--}"

   [Install]
   WantedBy=workstation.target
Received on Sun Jan 29 2017 - 21:40:25 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:19 UTC