no sound on headless server unless logged in physically

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
meeotch

no sound on headless server unless logged in physically

Post by meeotch »

I've got a headless media server that's connected to my AV system. I control it via VNC, with the following xstartup file:

Code: Select all

#!/bin/sh

xrdb $HOME/.Xresources
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
dbus-launch --exit-with-session startxfce4
Inside this session, I run Banshee to play music. I've found that I get no sound unless I'm also logged in to the primary X session - that is, physically, at the machine. (Banshee will run, but if I play a track, the play head doesn't move and there's no sound.) At the moment, I have auto-login configured, so that if the power goes out or whatever, I don't have to go into the closet, connect a keyboard and monitor, and log myself in. This is not secure, but it works.

On the one hand, I guess this makes sense as a default behavior... But is there some way to get it working without having the machine logged in? (I should note that my audio output is through a USB audio dongle, as my server doesn't have have audio output on the motherboard.) Aside from the security issue, it's a bit of a pain for other reasons (starting gui programs at login results in an extra copy, can't switch to a different tty at the physical machine without disabling audio, etc.)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
niowluka

Re: no sound on headless server unless logged in physically

Post by niowluka »

I don't know VNC, but the problem probably is down to pulseaudio not running when you're not logged in physically.

Try running 'pulseaudio --start' from within the session.
User avatar
jimallyn
Level 19
Level 19
Posts: 9075
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Re: no sound on headless server unless logged in physically

Post by jimallyn »

“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan
meeotch

Re: no sound on headless server unless logged in physically

Post by meeotch »

I should probably also mention that audio output stops if I switch the physical vt to something other than #8 (the X session). So, for instance if I ctrl-alt-F7 at the machine itself to get the startup console, or F1-F6 for one of the other tty's, or run chvt from a shell, sound will stop. In this state, ps shows that pulseaudio is still running. Switching back to tty8 resumes audio. I've looked for a pulse log in /var/log, but didn't see one. I checked dmesg and the syslog for a message that might indicate how/why the audio was being suspended when the vt changed, but there was nothing.
Locked

Return to “Sound”