No sound card in a headless vnc session

482 views
Skip to first unread message

Igor Milhit

unread,
Feb 16, 2022, 4:35:26 PM2/16/22
to TigerVNC User Discussion/Support
My usecase is as follow:

1. I have a music server in my LAN.
2. Speakers are connected to this machine.
3. I connect myself to the server through a headless VNC session, from my desktop.
4. I play music through a GUI application in that VNC session, and the sound of the server is playing through it's speakers.

I did this for many years, without problems. But recently, I had to reinstall the machine from scratch and did it with archlinux. And with this new setting, in the vnc session (gnome), I don't see any sound card (in the gnome control center, or in alsamixer), except a "dummy output" and get no sound in the speakers.

But using other applications, not through this headless vnc session, the machine can play sounds. I did it with airsonic in jukebox mode, and with mopidy, a music server.

I don't see it as a bug, but I suspect it's related to the "headless" session (like it is a "virtual" session, so no physical sound card is needed, or something like this). If I connect an actual display in hdmi on the server and log in a gnome session, there's no problem at all.

I tried to look for somethink related to pulseaudio or alsa on the web, especially in a vnc context, but couldn't find anything that could help me. So, I'm here, hoping that somebody could help me, even if it's just indicating some trail to follow to better understand the issue.

Thanks in advance.


Pierre Ossman

unread,
Feb 18, 2022, 6:34:36 AM2/18/22
to Igor Milhit, TigerVNC User Discussion/Support
On 2/16/22 17:35, 'Igor Milhit' via TigerVNC User Discussion/Support wrote:
>
> I don't see it as a bug, but I suspect it's related to the "headless"
> session (like it is a "virtual" session, so no physical sound card is
> needed, or something like this). If I connect an actual display in hdmi on
> the server and log in a gnome session, there's no problem at all.
>

That is correct. Only local sessions are given access to local hardware.
Everything else is locked out. This is managed by systemd by changing
the file access rights on stuff in /dev. E.g. I'm currently logged on as
the user "ossman", which sets up the audio device nodes as such:

$ getfacl /dev/snd/hwC0D0
getfacl: Removing leading '/' from absolute path names
# file: dev/snd/hwC0D0
# owner: root
# group: audio
user::rw-
user:ossman:rw-
group::rw-
mask::rw-
other::---

You can see that the user "ossman" has been explicitly added there. If I
log out that will be removed.

You can also see that the group "audio" also has access. If you want a
user to have constant access to the sound card then add you user to that
group. Then you'll have access in all circumstances.

(This is on Fedora. Your groups might be called something different.)

Regards
--
Pierre Ossman Software Development
Cendio AB https://cendio.com
Teknikringen 8 https://twitter.com/ThinLinc
583 30 Linköping https://facebook.com/ThinLinc
Phone: +46-13-214600

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

Igor Milhit

unread,
Feb 18, 2022, 8:46:03 AM2/18/22
to TigerVNC User Discussion/Support
> You can also see that the group "audio" also has access. If you want a
> user to have constant access to the sound card then add you user to that
> group. Then you'll have access in all circumstances.


Thank you a lot for your precise and usefull answer! I had already added my user
to the audio group, but I think I needed also to restart system. Now I can see the
sound card from the headless vnc session.

Best regards,

iGor
Reply all
Reply to author
Forward
0 new messages