You are not logged in.

#1 2013-03-30 18:58:28

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

[Solved] Modifying systemd.service files with foo.bar.d/ directory.

In an effort to ensure that updates to service files go into effect, I have been a frequent user of the ".include" function in systemd.  So for instance, I have the sshd.socket listen on an additional port (I have 22 blocked, but don't really care that it still listens there).  So I have this:

$ cat /etc/systemd/system/sshd.socket
.include /usr/lib/systemd/system/sshd.socket

[Service]
ListenStream=54321

But with systemd 198, there is supposed to be the ability to have an /etc/systemd/system/foo.bar.d/modifcations.conf directory/file and that will have similar functionality.  This new directory structure of modifying service files is supposed to be much more flexible, and thus I would like to make use of it.

So I went ahead and deleted the above ".include" file, and created /etc/systemd/system/sshd.socket.d/.  In that directory, I then created a conf file, which I (creatively) called "listenstream.conf".  It looked like this:

$ cat /etc/systemd/system/sshd.socket.d/listenstream.conf
[Service]
ListenStream=54321

I proceeded to do a daemon-reload and restart the socket.  I tried reenabling it, and restarting.  I tried reenabling, daemon-reloading, and rebooting.  But it didn't work.  Even with systemd-delta, it shows nothing has been modified.

Am I missing something here?


Edit: BTW, I thought that maybe it was a possibility that this was a limitation of the type of unit (ie. a socket), so I tried this with a number of other service files as well.  I just used sshd.socket as an example because it was nice and short.

Last edited by WonderWoofy (2013-03-30 21:48:23)

Offline

#2 2013-03-30 20:09:18

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: [Solved] Modifying systemd.service files with foo.bar.d/ directory.

oh you are gonna hate this one: tongue

[Socket]
ListenStream=54321

and btw, systemd-delta does indeed not show changes made via .d/*.conf files, probably an oversight from upstream.

Offline

#3 2013-03-30 21:12:57

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Modifying systemd.service files with foo.bar.d/ directory.

Damn it!  You are totally f*cking right!


Okay, I don't know what the hell I did wrong on the other try, but I'll have to try it again.

Edit: Okay, so with rtkit-daemon.service, I want to add an additional WantedBy.  I use systemd --user with the normal kernel, but with the ck kernel, it doesn't work because of a difference in cgroup settings with bfs.  So I have a graphical-ck.target.  I did this:

$ cat /etc/systemd/system/rtkit-daemon.service.d/wantedby.conf
[Install]
WantedBy=graphical-ck.target

It continues to link only to graphical.target.wants.  I thought that maybe it would override it, and I would have to put both in rtkit-daemon.service.d, but it simply ignores the whole thing in there.  This works with ".include".

Last edited by WonderWoofy (2013-03-30 21:21:22)

Offline

#4 2013-03-30 21:44:04

65kid
Member
From: Germany
Registered: 2011-01-26
Posts: 663

Re: [Solved] Modifying systemd.service files with foo.bar.d/ directory.

hm, I can confirm that overriding WantedBy doesn't work, seems like a bug to me. I suggest you report it upstream (and while you are at it, mention the systemd-delta issue wink ).

btw, rtkit-daemon.service is auto-activated by dbus on my system, you shouldn't even have to enable it.

Offline

#5 2013-03-30 21:48:07

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Modifying systemd.service files with foo.bar.d/ directory.

Yeah, I was just using that one as one to try out because it would have no negative consequences while experiementing.  Same went for sshd.socket, as this is a laptop, and ssh'ing into ti is pretty rare.

So I just confirmed that the foo.bar.d works with the user-session@.service file from systemd-user-session-units-git.  So I guess you are right that it was simply my unfortunate choice in what I was trying to modify (for rtkit-daemon) and my f*ck up with sshd.socket.

Thanks 65kid.  I am going to write to systemd-devel right now.  I'll mark this as solved.

Offline

#6 2013-03-31 15:19:10

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Modifying systemd.service files with foo.bar.d/ directory.

Just to update this thread with the happenings.  I emailed the systemd mailing list and brought up the two issues above.  But I noticed a thread today on [systemd-devel] that is titled "Add drop-in support for [Install] section".  So it would seem that this is something they are working on.

I didn't really notice that this entire section did not work.  Though besides the "WantedBy=" configuration option, there isn't much else one would put in there.

There is also something about monitoring drop-in configurations, but I haven't really looked into what that actually is, but from the thread title it sounds like they are working to address my systemd-delta concern.

Offline

#7 2013-04-09 04:32:27

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [Solved] Modifying systemd.service files with foo.bar.d/ directory.

So I according to Lennart, the lack of inclusion for the entire [Install] section was certainly an oversight.  But they ultimately decided to leave it out for various reasons.

He also said that the inclusion of drop-in configurations to be displayed by systemd-delta would be added to the TODO list.  But with the announcement of systemd 201, it seems as though this information will already be available with "systemctl status" (another pretty reasaonable place to put it, though I like the idea of it being centralized).

Offline

Board footer

Powered by FluxBB