Sound in lightdm / before login into xfce

Hi everybody,

I want to access sound without logging in, i.e. from the lightdm login screen. (The idea is to run spotifyd in the background, connect via phone to it, play some music).

I have a fresh manjaro install with xfce, if that matters.

When I login to xfce sound works fine, e.g. youtube or from terminal (“speaker-test -t sine -p 1”).
When I reboot, without login into my account via lightdm, but when I then ssh into the machine and login, I see that I have no soundcard.

[monkee@manjaro-TV ~]$ aplay -l
aplay: device_list:279: no soundcards found...

I guess the question is: How can I load my sound drivers/card right after boot in lightdm, without login into xfce. Other suggestions are also welcome, I am just guessing that this might solve this issue.

One additional info: The speakers are connected via USB if that matters.

Any help is much appreciated.

Thanks
monkee

The use of the sound card is challenging.

Linux - generally speaking - is a multi user system - but a sound card is not a multi user device.

Imagine the conflicts if several users would use the sound card to play different files at the same time.

I am thinking you may be able to use pactl to enable the card and direct the sound to the usb-connected speakers.

I have seen a lot of topics on audio but I am not an audio user - in fact I prefer silence - it is easier to think and ponder on complex topics in silence.

One of the easier method would be something like plex or another media focused application where you can remotely control the system with a phone.

This is exactly the idea: As written above, spotifyd is running in the background started via a systemd service.

In regards to pactl. I am not sure how this is supposed to help me since no sound device is loaded. Can you point me in a direction here, please?

BR

The sound card will always be there - it doesn’t disappear :slight_smile: - it can be inactive.

If one is not familiar with pactl - one could look at the man page

man pactl

If you prefer a web browser the same can be read on https://man.archlinux.org

As I recall - e.g. plex is a gui interface which uses auto login with a predefined username.

Technically you can do the same with lightdm. Look up the greeter settings tool.

If user is logged in, speaker-test would usually play audio via software sound server PulseAudio or PipeWire (default output in aplay -L)

To play audio direct to an ALSA device (sydefault output(s) in aplay -L), ALSA device must be specified using option -D or --device, for example, To play audio to card 0, subdevice 0:

speaker-test -D hw:0,0 -t sine -p 1” 

If no soundcards are found when logged in via SSH ALSA cannot load audio drivers to play audio.
there would also be no audio controls in alsamixer. If a software audio server was running and could not detect audio devices it would create a Dummy Output

There might be an issue with SSH permissions for audio devices in /dev/snd/
But I have never used SSH for networking audio

pactl info would show if PulseAudio/PipeWire was running and default-sink for audio playback
to check if either are using audio devices

sudo fuser --all --verbose /dev/snd/*

Manjaro is configured for one user account with a software audio server running in user-space

systemctl --user status pulseaudio pipewire-pulse

PulseAudio can be reconfigured to run as a systemwide daemon, but it is not recommended for most use-cases
What is wrong with system mode? – PulseAudio

PulseAudio and PipeWire support Bluetooth wireless connections by default
Support for network audio protocols can be configured by user
ArchWiki - PulseAudio - Networked Audio
Pipewire Wiki - Network

nikgnomic: This actually helped a lot. Thanks!

How I finally solved it:
I had to add my user to audio group.

sudo usermod -G audio -a “user account”

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.