You are not logged in.
Following wiki I'm trying to enable mpd as user service. Unfortunately:
$systemctl --user status mpd
mpd.service - Music Player Daemon
Loaded: loaded (/home/me/.config/systemd/user/mpd.service; enabled)
Active: inactive (dead)
However it works flawlessly if started manually:
$systemctl --user start mpd
$systemctl --user status mpd
mpd.service - Music Player Daemon
Loaded: loaded (/home/me/.config/systemd/user/mpd.service; enabled)
Active: active (running) since Wed 2013-09-25 19:07:37 BST; 29s ago
Main PID: 4253 (mpd)
CGroup: /user.slice/user-1000.slice/user@1000.service/mpd.service
└─4253 /usr/bin/mpd --no-daemon /home/me/.config/mpd/mpdconf
Sep 25 19:07:37 XXX systemd[224]: Starting Music Player Daemon...
Sep 25 19:07:37 XXX systemd[224]: Started Music Player Daemon.
Enabling multi-user.taget didn't solve the issue. Some additional info:
$ tree /etc/systemd/system
/etc/systemd/system
├── default.target -> /usr/lib/systemd/system/multi-user.target
├── getty.target.wants
│ └── getty@tty1.service -> /usr/lib/systemd/system/getty@.service
├── multi-user.target.wants
│ ├── netctl-auto@wlan0.service -> /usr/lib/systemd/system/netctl-auto@.service
│ └── remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
└── systemd-user-sessions.service.d
└── environment.conf
$ tree ~/.config/systemd/user
.config/systemd/user
├── mpd.service
└── multi-user.target.wants
└── mpd.service -> /home/me/.config/systemd/user/mpd.service
$ cat ~/.config/systemd/user/mpd.service
[Unit]
Description=Music Player Daemon
After=network.target sound.target
[Service]
ExecStart=/usr/bin/mpd --no-daemon /home/me/.config/mpd/mpdconf
[Install]
WantedBy=multi-user.target
How can I go about resolving this issue?
EDIT: Added extra info.
Last edited by vox23 (2013-09-26 00:16:16)
Offline
multi-user.target is for the system instance of systemd (pid 1). Using the same name for a user unit is (probably) not forbidden, but it doesn't make sense. It will also not be started automatically. The unit /usr/lib/systemd/system/multi-user.target is started because default.target is symlinked to that.
There is no default.target among your user units and you don't appear to be starting this strange multi-user.target from a script (.xinitrc for example), so while mpd.service is enabled, there is nothing to initiate a startup job and mpd remains inactive (note that it doesn't say failed, it simply hasn't been started at all).
Offline
(...) you don't appear to be starting this strange multi-user.target from a script
Indeed I'm not - I was simply following wiki entry about automatic login to virtual console, where it says:
To avoid errors related to display-manager.service in dmesg, you should set the default target to multi-user instead of graphical
Your explanation about the default.target makes perfect sense, How would one go about defining such default.target? I'm currently experimenting with wiki entry about systemd managing user session but so far I had no luck with making it work...
Offline
I think you need to read https://wiki.archlinux.org/index.php/Systemd/User
Offline
Yes, changing:
[Install]
WantedBy=multi-user.target
to
[Install]
WantedBy=default.target
works for me, now mpd starts automatically. Thanks to all.
Offline
I think you need to read https://wiki.archlinux.org/index.php/Systemd/User
I did, about a dozen times:
I'm currently experimenting with wiki entry about systemd managing user session but so far I had no luck with making it work...
Here are the exact steps I'm taking:
1. Checking status of user session:
$ systemctl --user status
Failed to issue method call: Process /bin/false exited with status 1
2. The following fix from Arch Linux Wiki solves the issue:
sed -i s/system-auth/system-login/g /etc/pam.d/systemd-user
Now I'll add some environmental variables:
$ cat /etc/systemd/system/user@.service.d/environment.conf
[Service]
Environment=DISPLAY=:0
Environment=XDG_RUNTIME_DIR=/run/user/%I
Environment=SHELL=%s
3. Reboot
4. Check if session is being managed by systemd-logind:
$ loginctl --no-pager show-session $XDG_SESSION_ID | grep Active
Active=yes
5. Install systemd-xorg-launch-helper-git
6. Create some service files:
$ cat .config/systemd/user/wm.target
[Unit]
Description=bspwm
Wants=xorg.target
Wants=mystuff.target
Requires=dbus.socket
AllowIsolate=true
[Install]
Alias=default.target
$ cat .config/systemd/user/mystuff.target
[Unit]
Description=Xinitrc Stuff
Wants=wm.target
[Install]
Alias=defaulf.target
$ cat .config/systemd/user/bspwm.service
[Unit]
Description=bspwm
Before=mystuff.target
After=xorg.target
Requires=xorg.target
[Service]
ExecStart=/home/me/bin/bspwm_start
Restart=always
RestartSec=10
Environment=DISPLAY=:0
[Install]
WantedBy=wm.target
$ cat .config/systemd/user/mpd.service
[Unit]
Description=Music Player Daemon
After=sound.target
[Service]
ExecStart=/usr/bin/mpd --stdout --no-daemon /home/me/.config/mpd/mpdconf
[Install]
WantedBy=mystuff.target
7. Finally link mystuff.target to default.target:
$ systemctl --user enable mystuff.target
ln -s '/home/me/.config/systemd/user/mystuff.target' '/home/me/.config/systemd/user/defaulf.target'
8. Enable services:
$systemctl --user enable bspwm.service
ln -s '/home/me/.config/systemd/user/bspwm.service' '/home/me/.config/systemd/user/wm.target.wants/bspwm.service'
$systemctl --user enable mpd.service
ln -s '/home/me/.config/systemd/user/mpd.service' '/home/me/.config/systemd/user/mystuff.target.wants/mpd.service'
9. Reboot and... it isn't working. Any hints as to why it may be so will be appreciated.
EDIT: Some more info.
$ tree /etc/systed/system
/etc/systemd/system
├── getty.target.wants
│ └── getty@tty1.service -> /usr/lib/systemd/system/getty@.service
├── multi-user.target.wants
│ ├── netctl-auto@wlan0.service -> /usr/lib/systemd/system/netctl-auto@.service
│ ├── ntpd.service -> /usr/lib/systemd/system/ntpd.service
│ └── remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
└── user@.service.d
└── environment.conf
3 directories, 5 files
$ tree .config/systemd/user
.config/systemd/user
├── bspwm.service
├── defaulf.target -> /home/me/.config/systemd/user/mystuff.target
├── mpd.service
├── mystuff.target
├── mystuff.target.wants
│ └── mpd.service -> /home/me/.config/systemd/user/mpd.service
├── sxhkd.service
├── wm.target
└── wm.target.wants
└── bspwm.service -> /home/me/.config/systemd/user/bspwm.service
2 directories, 8 files
$ systemctl --user status bspwm.service
bspwm.service - bspwm
Loaded: loaded (/home/me/.config/systemd/user/bspwm.service; enabled)
Active: inactive (dead)
$ systemctl --user status mpd.service
mpd.service - Music Player Daemon
Loaded: loaded (/home/me/.config/systemd/user/mpd.service; enabled)
Active: inactive (dead)
Last edited by vox23 (2013-09-25 22:55:05)
Offline
Have you tried editing /home/me/.config/systemd/user/mpd.service and changing
[Install]
WantedBy=multi-user.target
to
[Install]
WantedBy=default.target
and reenabling the services? I think that there is no need to create "mystuff.target.wants",
$ tree .config/systemd/user
.config/systemd/user
├── default.target.wants
│ ├── mpdscribble.service -> /home/me/.config/systemd/user/mpdscribble.service
│ └── mpd.service -> /home/me/.config/systemd/user/mpd.service
├── mpdscribble.service
├── mpd.service
In my case works, it starts automatically.
Offline
Have you tried editing /home/me/.config/systemd/user/mpd.service and changing
[Install] WantedBy=multi-user.target
to
[Install] WantedBy=default.target
and reenabling the services?
I was trying to achieve similar setup to the one described in wiki however your suggestions works for mpd. Thanks, marking as solved.
Offline