[systemd-devel] Can /usr/lib/systemd/user/sockets.target.wants be used to autoenable a socket by a vendor package?

Colin Guthrie gmane at colin.guthr.ie
Mon Sep 19 08:48:36 UTC 2022


Yuri Kanivetsky wrote on 18/09/2022 13:08:

> Also, I've created a simple perl server:
> 
> https://gist.github.com/x-yuri/45f53c16a99337ba0716a988290491bd
> 
> And if I put perl-server.socket and perl-server.service into
> /usr/lib/systemd/user, and symlink perl-server.socket into
> /usr/lib/systemd/user/sockets.target.wants, it autoactivates on boot.
> 
> The confusing thing though is:
> 
> $ systemctl --user is-enabled perl-server.socket
> disabled

Unless your per-server.socket unit has an [Install] section that 
corresponds to the manual symlinks you've made, the is-enabled test will 
fail.

Ultimately the [Install] section is just instructions to "systemctl 
[--user] enable|disable" to create/delete these symlinks for you as needed.

These same hints are used by is-enabled to check whether it is enabled. 
If you don't have the correct [Install] section, it won't know by which 
route it ultimately becomes enabled if you do the links manually.

Hope that helps explain things.

Col


-- 

Colin Guthrie





More information about the systemd-devel mailing list