[systemd-devel] On every 'sysctl enable/disable' Systemd Reload is happening

Dimitri John Ledkov xnox at ubuntu.com
Mon Feb 25 19:22:20 UTC 2019


On Mon, 25 Feb 2019 at 19:05, Mahesh Mylarappa <maheshmylar at gmail.com> wrote:
>
> Hi,
>
> I am working on Linux host which has old 219 systemd build. We are trying to create/enable/start  multiple service instances at same time. Basically we create 15 to 20 unit files in /etc/systemd/system directory and call 'systemctl enable' on each one of them. There is only 30 to 50ms gap between each enable commands and  i could see few of those taking 10s of seconds to complete. If i put log level to debug, i could see that every time a new 'sysctl enable' is fired for new service instance,  there is complete reload happening and queued jobs are cancelled and reissued.
>
> I understand build 219 is very old, but wanted to know if there was a similar issue which was fixed in later builds.
>

What you seem to be looking for is to execute enable command
"client-side" without communicating with systemd, to check if the
units exist and are valid, and simply operate on the [Install] stanzas
requirements on the filesystem alone.

There are a number of checks that are done to switch to client side,
please see https://github.com/systemd/systemd/blob/master/src/systemctl/systemctl.c#L296

I don't know how old those are, but please try

1) systemctl --root=/ enable ...
2) SYSTEMCTL_INSTALL_CLIENT_SIDE=1 systemctl enable ...

I think --root=/ should be supported to switch to client-side/chroot
install mode even in 219. I have never used the undocumented
environmental variable, but maybe it is easier to use that for you, if
it works in v219.

-- 
Regards,

Dimitri.


More information about the systemd-devel mailing list