You are not logged in.

#1 2015-02-01 14:21:15

onslow77
Member
Registered: 2014-09-21
Posts: 279

How to start a systemd with certain configuration options?

Hello,

I do not understand what wiki page at arch that can help me to understand how I can start a daemon with certain configuration options. I know I can start with

 # systemctl enable unit 

, but for example, if I whanted to start "xboxdrv" with the option [--mimic-xpad-wireless --silent], or any other custom options I might need. I presume it can be done simple by dropping a .conf file somewhere, but I do not follow what wiki page that adress this - if it at all is possible?

Regards
Martin


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

#2 2015-02-01 14:29:56

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,763
Website

Re: How to start a systemd with certain configuration options?

Either add it to your ~/.xinitrc
https://wiki.archlinux.org/index.php/Xinitrc

Or use a display manager and this method to start the application by itself:
https://wiki.archlinux.org/index.php/Di … ow_manager

Or use ~/.xprofile to autostart it with a display manager:
https://wiki.archlinux.org/index.php/Xprofile

Offline

#3 2015-02-01 14:36:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,574
Website

Re: How to start a systemd with certain configuration options?

I second all of the above - but if you really want to use a systemd service, just copy the service file into /etc/systemd/system, modify the Exec line to add the flags you want, then enable your own editted service file.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2015-02-01 15:35:43

onslow77
Member
Registered: 2014-09-21
Posts: 279

Re: How to start a systemd with certain configuration options?

Hello,

Suggested .xinitrc solution
Do you meen that in my .xinitrc file I should add (for xboxdrv):

 exec xboxdrv --mimic-xpad-wireless --silent 

Suggested systemd solution
Do you meen that after I activaded the xboxdrv at boot with "systemctl" I edit the "xboxdrv.service" file that is created and change this line:

 ExecStart = /usr/bin/xboxdrv -D -c /etc/default/xboxdrv --detach-kernel-driver 

to this

 ExecStart = /usr/bin/xboxdrv -D -c /etc/default/xboxdrv --mimic-xpad-wireless --silent 

Is there not a general .conf file location that you can add additional configuration files for systemd to be read when a deamon is activated?

Advantage over systemd
Both of you seemed to prefer not to use the systemd solution, what is the advantages over systemd with the other suggested solutions?

Regards
Martin


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

#5 2015-02-01 15:46:23

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,763
Website

Re: How to start a systemd with certain configuration options?

onslow77 wrote:

Suggested .xinitrc solution
Do you meen that in my .xinitrc file I should add (for xboxdrv):

 exec xboxdrv --mimic-xpad-wireless --silent 

Please read the pages I have linked (all of them).

Re: systemd
I didn't suggest it 'cos I didn't know how to do that tongue

You should read the relevant ArchWiki pages (and the upstream documentation) and decide which better suits your needs.

Offline

#6 2015-02-01 15:48:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,574
Website

Re: How to start a systemd with certain configuration options?

That line in the xinitrc cannot have the "exec", otherwise your winow manager will not run.  According to the wiki, xboxdrv may need to be run as root, so putting it in xinitrc would not work (unless you used sudo and configured sudoers to run it without a password - not recommended).

The exec start line looks right, but no you should not edit the file that is created when you enable the service: no file is created, a symlink is created to a service file in /usr/lib/systemd/...

You should not edit those system-wide service files.  Any edits you make will be overwritten at every update.  This is why I gave the instructions I did.  To add one preliminary step: do not enable (or disable) the current xboxdrv service.  Then as suggested in my previous post copy the service file to /etc/systemd/system (or anywhere else really, your ~ could work), then edit that copy, then enable that modified copy.

Please see the wiki on using systemd.  I am referring to the "replacement unit files" approach - but it seems the drop-in snipet approach would be even better.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2015-02-01 16:09:32

onslow77
Member
Registered: 2014-09-21
Posts: 279

Re: How to start a systemd with certain configuration options?

Trilby wrote:

Please see the wiki on using systemd.  I am referring to the "replacement unit files" approach - but it seems the drop-in snipet approach would be even better.

Thank you, looks like the drop in option is the one i am looking for.

Also, thank you "Head_on_a_Stick" for suggested sollutions.

Sometimes as a new user it can be hard to grasp what part of the wiki that is refering to what you whant to do. Even if it is right in front of you smile

Regards
Martin

Last edited by onslow77 (2015-02-01 16:12:03)


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

#8 2015-02-01 18:15:18

onslow77
Member
Registered: 2014-09-21
Posts: 279

Re: How to start a systemd with certain configuration options?

Hello,

I followed the drop in option now in https://wiki.archlinux.org/index.php/Sy … n_snippets

I tried to copy the whole xboxdrv.service and replace the ExecStart, and also only with ExecStart, like this:

[Service]
ExecStart=
ExecStart= ExecStart = /usr/bin/xboxdrv -D -c /etc/default/xboxdrv --mimic-xpad-wireless --silent 

The drop in examples above is in: /etc/systemd/system/xboxdrv.service.d/override.conf

Reatarting
I then made sure the new .conf file was loaded by:

# systemctl daemon-reload
# systemctl restart xboxdrv
# system status xboxdrv

Result
In both cases, the service fails to restart and I recive this error

 xboxdrv.service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing. 

Anyone know how I can start "xboxdrv" with my custom options "--mimic-xpad-wireless --silent" using this drop in function for systemd?

Regards
Martin

Last edited by onslow77 (2015-02-01 18:27:31)


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

#9 2015-02-01 18:36:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,574
Website

Re: How to start a systemd with certain configuration options?

There is a typo on the second line where you repeat "ExecStart=" twice.  If that is in the file too, that is likely the problem.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2015-02-01 18:47:06

onslow77
Member
Registered: 2014-09-21
Posts: 279

Re: How to start a systemd with certain configuration options?

Trilby wrote:

There is a typo on the second line where you repeat "ExecStart=" twice.  If that is in the file too, that is likely the problem.

Hello,

It is not a typo, from the systemd wiki it says "Note how ExecStart must be cleared before being re-assigned " They show an example with one empty ExacStart (to clear it) and then a new ExecStart where you assign the new command.

I give it a try thou with just one to see if that works.

Regards
Martin


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

#11 2015-02-01 18:50:17

onslow77
Member
Registered: 2014-09-21
Posts: 279

Re: How to start a systemd with certain configuration options?

ooh, now I see, I wrote:

 ExecStart= ExecStart = /usr/bin/xboxdrv -D -c /etc/default/xboxdrv --mimic-xpad-wireless --silent 

Yes, maybe I did put that in, I try again.

Regards
Martin


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

#12 2015-02-01 19:08:48

onslow77
Member
Registered: 2014-09-21
Posts: 279

Re: How to start a systemd with certain configuration options?

Hello,

Yes, I did put in ExecStart twice just as in my example. So when I did:

[Service]
ExecStart=
ExecStart = /usr/bin/xboxdrv -D -c /etc/default/xboxdrv --mimic-xpad-wireless --silent

It reloaded correctly.

Problem still persist thou

If I manully start xboxdrv with:

 # xboxdrv --mimic-xpad-wireless --silent 

I get the game "XCOM Enemy within" to recognize my controller, which it does not if I have "xboxdrv" started with only:

 # systemctl enable xboxdrv 

That is why I try to implement the manual option "--mimic-xpad..." with the systemd drop in function. Anyone know what I have missed to make this work?

Regards
Martin

Last edited by onslow77 (2015-02-01 19:36:31)


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

#13 2015-02-01 19:49:57

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,574
Website

Re: How to start a systemd with certain configuration options?

I can't find anything in the documentation explicitly specifying it, but I've never seen unit files with spaces around the "=" as you have used.  Try removing them.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#14 2015-02-01 20:19:36

onslow77
Member
Registered: 2014-09-21
Posts: 279

Re: How to start a systemd with certain configuration options?

Trilby wrote:

I can't find anything in the documentation explicitly specifying it, but I've never seen unit files with spaces around the "=" as you have used.  Try removing them.

Hello,

This unfortantly made no difference, and it still does not work. When running

 systemctl status xboxdrv 

it clearly states (see below) that I am using the override.conf file, and no errors are given, so why it does not work, I do not know.

● xboxdrv.service - Gamepad management daemon
   Loaded: loaded (/usr/lib/systemd/system/xboxdrv.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/xboxdrv.service.d
           └─override.conf
   Active: active (running) since Sun 2015-02-01 21:09:22 CET; 8s ago
 Main PID: 2432 (xboxdrv)
   CGroup: /system.slice/xboxdrv.service
           └─2432 /usr/bin/xboxdrv -D -c /etc/default/xboxdrv --mimic-xpad-wireless --silent

Regards
Martin

Last edited by onslow77 (2015-02-02 11:15:49)


It is advised to follow the How to post guide when posting on the Arch forum. If one consciously jumps over these elementary steps like reading the wiki and providing necessary information about the problem, one can be regarded as a Help Vampire.

Offline

Board footer

Powered by FluxBB