You are not logged in.
Pages: 1
Topic closed
Hi, I'm using mpd and using a user service to start it.
However, I'm trying to create a service for mpdas (a mpd client for last.fm) and getting some errors:
currently, my mpdas.service is as following:
[Unit]
Description=AudoScrobbler client for MPD
After=mpd.service
[Service]
ExecStart=/usr/bin/mpdas
[Install]
WantedBy=default.targetWhich giving me the following errors:
(14:49:55) [ERROR] You are not root. Not changing user ..
(14:49:55) [INFO] Connected to MPD.
(14:49:56) [INFO] Last.fm handshake successful. SessionID: ...
terminate called after throwing an instance of 'std::ios_base::failure'
what(): basic_filebuf::underflow error reading the file
Aborted
Which are the same errors I get if I run just "mpdas" instead of running it with sudo.
If I use it as a root service (instead of a user service) it fails on startup, but works fine when I restart the server.
So, I'm assuming:
1) mpdas needs root permission
2) if used as a root service, it fails at startup cause the mpd service (enabled as a user service) hasn't started yet
3) if used as a user service, it fails cause it needs root permission
What's the 'correct' way to solve this? (I believe mpdas should be a user service, cause it runs with a config that is just for my user).
Is there a way to make a user service run with root privileges?
I couldn't figure out the best way to configure it.
Last edited by alv-r- (2014-11-29 18:37:56)
Offline
Why should it fails with sudo?
Doesn't it works with fakeroot ?
do it good first, it will be faster than do it twice the saint ![]()
Offline
Why does it need root privileges? Maybe you just need to configure it properly to run under your normal user?
Offline
Why should it fails with sudo?
It works only with sudo. It was failing as a system service because it needs mpd, which I configured as an user service. Then when systemd starts the system services (when booting) there's not mpd instance running and it fails.
Doesn't it works with fakeroot ?
As a noob, I don't know exactly how fakeroot works, I'll take a better look at it, but running it with fakeroot takes rid of the errors I was getting when not running as sudo.
The problem I have now is that it still fails on startup, but there isn't any helpful (or unhelpful) message. It just shows the PID and says it failed.
If I run
systemctl --user start mpdasit works well though. Any ideas of why this happens?
My current unit file looks like this:
[Unit]
Description=AudoScrobbler client for MPD
After=mpd.service
Requires=mpd.service
[Service]
ExecStart=/usr/bin/fakeroot /usr/bin/mpdas
[Install]
WantedBy=default.targetWhy does it need root privileges? Maybe you just need to configure it properly to run under your normal user?
Seeing the options in the man page and the config options for the config file, I don't see any that could do the trick.
I'll send a message to the developer with the error I'm getting (when not running as sudo).
Last edited by alv-r- (2014-11-29 18:36:59)
Offline
I encountered the same problem too.
It does not need root permission. You can run it as daemon user or ordinary user.
However, it expects that MPD server already running and responding. From systemd standpoint this requirement is already fulfilled but MPD has not actually been started or already running but not yet ready to listen. In other words, it starts too early.
The solution might be replacing mpdas service with a script that starts the real mpdas service after certain amount of time.
始まりの荒野を独り もう歩き出してるらしい、僕は灰になるまで僕で有り続けたい
http://about.me/nnhnkn | http://identi.ca/nnhzkn
Offline
Offline
Pages: 1
Topic closed