driskell / log-courier

The Log Courier Suite is a set of lightweight tools created to ship and process log files speedily and securely, with low resource usage, to Elasticsearch or Logstash instances.
Other
419 stars 107 forks source link

Systemd service fails with status=217/USER #322

Closed xose closed 8 years ago

xose commented 8 years ago

OS: Ubuntu Xenial

Starting log-courier as a systemd service fails with status=217/USER

This is due to the default username containing a dash and being set on the service file using an environment variable.

As a workaround the user can be changed to root or any other user without a dash on the /etc/defaults/log-courier file, or set directly on the .service file with User=log-courier

NeckBeardPrince commented 8 years ago

OS: CentOS 7

The work around for me was to delete the Environment="LOG_COURIER_USER=root" line and just set User=root

Defining the user in a Env var and in the Config it's self seems like double work to me.

[Service]
Type=simple
Environment="LOG_COURIER_USER=root"
EnvironmentFile=/etc/sysconfig/log-courier
ExecStartPre=/sbin/log-courier $LOG_COURIER_ARGS -config-test
ExecStart=/sbin/log-courier $LOG_COURIER_ARGS
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
StandardError=syslog
User=$LOG_COURIER_USER
driskell commented 8 years ago

The idea was to allow the user to be changed by the environment file. Somethings not working though clearly. I need to look into it.

MKuzma commented 8 years ago

I can confirm I observed the same behavior on Cent OS 7 making me scratch my head to find out what could cause this. Anyway commenting line User=... helps but LC starts under root even with Environment="LOG_COURIER_USER=log-courier".

driskell commented 8 years ago

Sorry about the issue. I can confirm that User= does not allow variables it seems. So you have to edit User= to contain the actual user.

I'm in process of updating the systemd units so they are config files and can be modified. And removing LOG_COURIER_USER variable since it cannot be used with systemd.

driskell commented 8 years ago

The reason there was the Environment= entry as well as User= referring to it was so there was a default, and the EnvironmentFile= then can pull in a different user if need be.

MKuzma commented 8 years ago

Yes, if we edit the User= it works as it should. If LC ever ran under root user then people don't forget to change the permissions in /var/lib/log-courier, /var/run/log-courier or it will fail to start again.

driskell commented 6 years ago

@shameerariff This isn’t the right repository for your query. I have no idea what traccar is.

shameerariff commented 6 years ago

@shameerariff This isn’t the right repository for your query. I have no idea what traccar is.

Sorry it was wrongly posted. Thank you.

joshuadiezmo commented 4 years ago

I encounter the same problem. just update the User=