Re: Removing sysV init files
On Sun, 17 Jan 2016 02:23:02 +0000, Jonathan de Boyne Pollard wrote:
<snip>
> It didn't start because the service unit was wrong.
>
> A quick check of the log revealed that the service was trying to create
> a local-domain socket at |/run/lirc/lircd| . But there was no
> |/run/lirc/| directory on my system to contain that. Your systemd units
> didn't make one; and one doesn't appear by telepathy. (-:
It seems your conversor is slightly wrong: socket units have an implicit
Before=<triggeringservice> dependency added to them. How can it possibly
be that the init-created socket exists at /run/lirc/lircd (because the
socket unit has started), and /run/lirc doesn't?
Moreover, if the program you have in your system is not properly built
because it lacks the fd-receiving code, you can hardly expect the units
that work via a passed-fd works out of the box.
> Stefan
> Lippers-Hollmann's System 5 rc scripts *do* make this directory,
> however. They have this near the start:
>
> [ -d "/run/lirc" ] || mkdir -p "/run/lirc"
>
> The systemd service unit file way of doing the same thing is:
>
> [Service]
> RuntimeDirectory=lirc
>
> So I edited that into your |lircd.service| and had another go. This
> time I was hit by a problem with "quirks mode" conversion (which I don't
> use all that often). Since your |lircd| program doesn't actually rely
> upon any systemd quirks as far as I can see, I simply switched to "ideal
> mode" conversion and converted a third time:
>
> JdeBP /tmp $ convert-systemd-units --no-systemd-quirks
> ./lircd.socket JdeBP /tmp $ sudo system-control start /tmp/lircd
>
> Now I was hit by the fact that you'd hardwired the pathname
> |/usr/sbin/lircd| into your service unit.
The standard practice would be to fix the ExecStart path at configure
time (ie, take into account --prefix or similar).
<snip>
> Both the System 5 rc scripts and the port-supplied NetBSD rc script (in
> |/usr/local/etc/rc.d/lircd|) are parameterized. Your systemd unit files
> are not. In particular, note that the NetBSD rc script has this:
>
> command_args="-d ${lircd_device} ${lircd_config}"
>
> This means that FreeBSD/PC-BSD users can use their conventional
> |/etc/rc.conf.local| system to configure how the lircd daemon is
> invoked, by setting |lircd_device| and |lircd_config| variables.
This is a common friction point when transitioning from rc scripts to
systemd. Because in systemv world, rc scripts are programs and not
configuration files, it becomes handy to add configuration options
elsewhere. However, systemd units are configuration files themselves, so
it becomes less interesting[1] to add configuration options. Instead of
editing the configuration file for the configuration file, edit the first
configuration file directly.
[1] I don't claim it is never useful. For example, if a service is spread
into multiple units it can be useful to have a single place to hold all
the configuration options.
--
Saludos,
Felipe Sateler
Reply to: