You are not logged in.

#1 2012-12-12 08:12:40

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

[Solved] equivalent of /etc/conf.d in systemd

I have recently switched to systemd. With the old rc.d services it was possible to pass command line options to the daemon via the /etc/conf.d files. For example I want to keep dhcpcd to alterring /etc/resolv.conf or to pass correct options to the gpm service. What is the proper way to do that under systemd? The olny way I have found is to edit /usr/lib/systemd/system/dhcpcd.service or /usr/lib/systemd/system/gpm.service , but then these files will be overwritten after an upgrade.

Last edited by olive (2012-12-13 09:04:47)

Offline

#2 2012-12-12 09:18:43

satanselbow
Member
Registered: 2011-06-15
Posts: 538

Re: [Solved] equivalent of /etc/conf.d in systemd

Offline

#3 2012-12-12 20:24:12

archwade
Member
Registered: 2010-01-26
Posts: 14

Re: [Solved] equivalent of /etc/conf.d in systemd

Is there a way to make a specific .service file accept options specified in a conf.d file?  This seems like a nicer way to do things.

For example, if I just want to change the root directory for the tftp-hpa server, I can copy/modify the .service file to change the arguments, but then if the actual service file changes in an update (new dependencies or whatever), I won't get the benefit of these updates.

Is there some way to use /etc/conf.d/tftp to specify the TFTPD_ARGS and have these arguments used by systemd?

Offline

#4 2012-12-12 21:27:14

bohoomil
Member
Registered: 2010-09-04
Posts: 2,376
Website

Re: [Solved] equivalent of /etc/conf.d in systemd

I'm baffled: my /etc/conf.d is there alive and active, and so is systemd in a working condition. Why do you think you cannot use /etc/conf.d with systemd?

Last edited by bohoomil (2012-12-12 21:28:10)


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#5 2012-12-12 21:38:48

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [Solved] equivalent of /etc/conf.d in systemd

I know there was an issue where a certain initscript explicitly sourced a file in conf.d and the equivalent systemd service file didn't.  But that's the only case I've heard of.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#6 2012-12-13 00:24:37

archwade
Member
Registered: 2010-01-26
Posts: 14

Re: [Solved] equivalent of /etc/conf.d in systemd

bohoomil wrote:

I'm baffled: my /etc/conf.d is there alive and active, and so is systemd in a working condition. Why do you think you cannot use /etc/conf.d with systemd?

At least in the case of tftp-hpa, because it has no effect smile

/usr/lib/systemd/system/tftpd.service

[Service]
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/

And changing TFTPD_ARGS in /etc/conf.d/tftpd has no effect on this command line.

Offline

#7 2012-12-13 00:25:55

archwade
Member
Registered: 2010-01-26
Posts: 14

Re: [Solved] equivalent of /etc/conf.d in systemd

archwade wrote:

At least in the case of tftp-hpa, because it has no effect smile

So is this a package bug for tftp-hpa?

Offline

#8 2012-12-13 00:33:32

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

Re: [Solved] equivalent of /etc/conf.d in systemd

I believe the recommended way to change options for a service with systemd is to make the changes to the file in question after copying it to /etc/systemd/system.  You could actually have it source a conf.d file and use those args by using EnvironmentFile= and then adding the necessary arguments to the end of the ExecStart= line.  So in your case it would be

...
EnvironmentFile=/etc/conf.d/tftp
...
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/ $TFTPD_ARGS
...

No one is stopping you from using an environment file, but I think that the method systemd provides allows for the reduced need of said files.

Offline

#9 2012-12-13 01:09:04

archwade
Member
Registered: 2010-01-26
Posts: 14

Re: [Solved] equivalent of /etc/conf.d in systemd

WonderWoofy wrote:

I believe the recommended way to change options for a service with systemd is to make the changes to the file in question after copying it to /etc/systemd/system.  You could actually have it source a conf.d file and use those args by using EnvironmentFile= and then adding the necessary arguments to the end of the ExecStart= line.  So in your case it would be

...
EnvironmentFile=/etc/conf.d/tftp
...
ExecStart=/usr/sbin/in.tftpd -s /srv/tftp/ $TFTPD_ARGS
...

No one is stopping you from using an environment file, but I think that the method systemd provides allows for the reduced need of said files.


Thanks for the reply.  This makes sense, but then it still goes back to my original issue with copying & changing the service file: this will mask future updates to the service file (and no pacnew file to highlight that the file has changed, either).

I think at this point the .service file in the tftp-hpa should be changed as mentioned, or /etc/conf.d/tftp should be removed from the package.  Does that make sense?  At this point, after installing the package, modifying the provided /etc/conf.d/tftp file has no effect.

Offline

#10 2012-12-13 01:10:45

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

Re: [Solved] equivalent of /etc/conf.d in systemd

/etc/conf.d files should be removed as the rc.d files are removed, and this should take place over the next couple of weeks.

Offline

#11 2012-12-13 01:18:25

archwade
Member
Registered: 2010-01-26
Posts: 14

Re: [Solved] equivalent of /etc/conf.d in systemd

Great, that makes sense.  Thanks.

This can probably be marked [solved] since I believe OP's question has also been answered.

Last edited by archwade (2012-12-13 01:19:34)

Offline

#12 2012-12-13 02:42:41

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: [Solved] equivalent of /etc/conf.d in systemd

The OP should mark it as [solved] if that's the case.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB