Mopidy working on reboot

Background: I’m running Mopidy on Arch Linux on an Intel NUC box. The box is headless, with the only connection being from the headphone jack to a stereo receiver. Mopidy runs as a user service, and linger is enabled for that user.

Basically, this configuration works fine, once started up. I don’t normally do things directly on the box – I run iris in a web browser on another machine on my network and an mpd client on my phone, I ssh in if necessary.

The problem is after a reboot – mopidy is running, and I can start up some music, but no audio comes out the headphone jack. I find I need to log in on the NUC box directly – i.e., attach a keyboard and a monitor, reboot, and log in at the prompt that appears (nothing more after the log in, which starts up the Cinnamon desktop environment). After that, I can detach the keyboard and monitor and run things the way I normally do.

So, is there a way I can avoid having to log in at the box after a reboot, and just have things work in my usual setup?

Perhaps I should also ask, should I change anything about my setup? For example, run mopidy as a system service? Will that work better for what I’m trying to do? (I went away from running it as a system service initially because of problems/conflicts between system and user things, as mentioned in the documentation and forums, I found that running it as a user service generally was smoother.)

Thanks.

If I remember, this is because your audio server (pulse etc) is spawned by the user session created by your login (and it then lingers afterwards). No login = no audio server startup. This supposed “right way” is a huge pain for headless stuff. I don’t know of a good way to workaround that, it’d be fighting the way it’s all meant to work on a modern systemd distro. Personally I’d go back to running as a system service, it’s a better fit.

But if you do hear of a good way then please let us know so we can finally add a sensible user service section of our systemd service docs.