Score:0

How can I play sound when not logged in on Ubuntu?

sl flag

System: Ubuntu LTS 22.03 and 23.04 tested. I only hear sound after i did login into the login manager (gnome), so i cannot play anything from terminal without login into Gnome... I have a Python Systemd Daemon which is working fine, but it cannot play audio because it only sees "DUMMY OUTPUT" as sound devices, see "wp-ctl status" shows SINK: "DUMMY OUTPUT

After i login into gnome, i can hear the daemon playing the files. And wp-ctl shows after login:

Audio
 ├─ Devices:
 │      41. Built-in Audio                      [alsa]
 │      43. Built-in Audio                      [alsa]
 │
 ├─ Sinks:
 │  *   45. Built-in Audio Analog Stereo        [vol: 2.00]
 │
 ├─ Sink endpoints:
 │

I did install ubuntu via server iso then installed ubuntu-desktop. In the LTS ubuntu i have the same problem as with the 23.04 version.

On startup i also setup the volume loud, but that is not the problem:

subprocess.call(['wpctl', 'set-volume', '@DEFAULT_AUDIO_SINK@', '2'])
file = ' /home/backupbox/backupbox/media/startup_completed.mp3'
os.system('play ' + file)

I expect: Play audio mp3 files from my python systemd daemon without logging into gnome.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.