Audio Control not Working

I ran into a problem where the audio control doesn’t work upon logging in under the KDE Plasma edition, although I had the same problem with an old 8" windows tablet running Xubuntu so I suspect it’s not limited to the KDE edition. Anyway I found that the solution is to start PulseAudio with the command pulseaudio --start. That command usually fails the first several times, but eventually PulseAudio starts and audio can be controlled again.

I figured I’d post the solution here so anyone with the same problem can find it. I wrote a simple shell script to make it a little easier:

for ((i=0; i<31; i++))
do
    pulse=$(pulseaudio --start)
    if [[ $? == 0 ]]; then
        break
    fi
done

Just save it to pulsestart.sh and run with:
sh pulsestart.sh.

I used a for loop rather than a while loop to prevent the possibility of an infinite loop in the event PulseAudio never starts. 31 is just a number I pulled out of my rear, usually only takes 3-8 attempts.

The script has 3 errors in https://www.shellcheck.net/

Have you tried any diagnostic commands to check for errors/misconfiguration ?

systemctl --user -l --no-pager status pulseaudio.socket pulseaudio.service

I suspect the socket and service may have failed due to repeated commands to restart pulseaudio directly
PulseAudio should only need to be restarted one time

systemctl --user restart pulseaudio

Checking PulseAudio configuration:

pacmd dump

may have null response if PulseAudio has failed to start
but it might show PulseAudio has failed to load some modules required for use of DE audio controls

sudo dmesg | grep snd

to check there are no underlying problems in ALSA with hardware devices or drivers

I suggest you delete all user preferences saved for PulseAudio. Multiple start requests may have created multiple entries in user database

rm ~/.config/pulse/*

and reboot system so PulseAudio can create new configuration files

If you have made any changes to system configuration files in /etc/pulse/ you should consider reinstalling PulseAudio to revert system configuration to default

pamac reinstall pulseaudio

Thanks for taking the time to check my script on shellcheck:

shellcheck myscript
 
Line 1:
for ((i=0; i<31; i++))
^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
 
Line 3:
        pulse=$(pulseaudio --start)
        ^-- SC2034 (warning): pulse appears unused. Verify use (or export if used externally).
 
Line 4:
        if [[ $? == 0 ]]; then
              ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

Anyway thanks for the suggestions, I’ll check them out when I have a chance to get behind my computer. After my initial install of Manjaro, using the latest live iso, the audio control worked fine, but stopped working after I ran updates the first time. I didn’t try my aforementioned solution until after booting with no audio control several times.

When the audio control isn’t functioning the audio still plays at full volume, but, obviously, the volume cannot be changed or muted via the tray icon or keyboard commands.

I also have a problem where the battery monitor doesn’t always display, even when set to Always Display. Most of the time when logging in it’ll show up, and it’s always displayed on the login screen, but occaisionally the monitor is missing from the tray after logging in and requires a reboot, sometimes a couple, to get it back.

It’s not really bothersome as I can still check the battery level with the upower -d command which correctly lists the battery stats flawlessly and the screen brightness can still be controlled via keyboard commands.

Anyway thanks again for taking the time to check up on this. Manjaro is great so far, I’m coming from KDE Neon which is also a good distribution if you don’t mind the bugginess of in-development KDE Plasma.

When the audio control isn’t functioning the audio still plays at full volume

I would suspect from this that PulseAudio is probably working OK and problem is only within plasma-pa panel control for audio

I suggest you install PulseAudio Volume Control (pavucontrol)

pamac instal pavucontrol-qt

If PulseAudio is working normally, audio controls should be visible in pavucontrol

I had a chance to sit down with this and restarting Pulseaudio via systemctl failed. Checking status of the service and socket returns that pulseaudio.service failed with result ‘signal’ and pulseaudio.socket failed with result ‘service-start-limit-hit.’

I went ahead and cleared out the pulseaudio cache folder then rebooted and had the same result. I also reinstalled pulseaudio and rebooted with the same result. Starting pulseaudio with pulseaudio --start several times still works.

If I start pulseaudio with my script then try to restart the service through systemctl the status result for the service changes from ‘signal’ to ‘exit-code.’ If I pulseaudio --kill then try to restart the service through systemctl the status result for the service returns to ‘signal.’

I haven’t edited any pulseaudio configuration files.

Apparently the ‘start-limit-hit’ exit code from pulseaudio.socket is referring to the number of times a service is allowed to try and restart if it fails. The pulseaudio.service file doesn’t have the restart limits set so it’s using the default of 5 restarts over 10 seconds. I edited /lib/systemd/user/pulseaudio.service and added the following lines:

StartLimitIntervalSec=30
StartLimitBurst=15

So now the service will try restarting 15 times over 30 seconds when it fails. The audio controls are now working upon start up and logging in. Rebooted multiple times to confirm the audio controls are working on each login.

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