supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* nosh with Debian's sysstat package
       [not found] <20170126110938.754fc04a@kadisius>
@ 2017-01-29 21:40 ` Jonathan de Boyne Pollard
  0 siblings, 0 replies; only message in thread
From: Jonathan de Boyne Pollard @ 2017-01-29 21:40 UTC (permalink / raw)
  To: supervision, Debian users

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 @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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-29 21:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20170126110938.754fc04a@kadisius>
2017-01-29 21:40 ` nosh with Debian's sysstat package Jonathan de Boyne Pollard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).