About a year ago, the internal speaker on this machine stopped working. I was able to restart it by opening alsamixer, selecting the sof-soundwire soundcard, and then unmuting the speaker and rt1316-1.
I could then save the alsamixer settings with alsactl --file ~/.config/asound.state store. To restore the settings on startup, I created a file ~/.config/autostart/alsarestore.desktop
Last week I upgraded from Lubuntu 24.04 to Lubuntu 26.04, kernel 7.0.0-38. The autostart file is still there, and listed and ticked in LXQt session settings under global autostart, but it isn’t executed on startup, though I can execute it manually.
I’d be grateful for advice on restoring the alsamixer settings on startup.
Relevant System Information
Dell XPS13 (9320)
Lubuntu 26.04, kernel 7.0.0-38
What I’ve Tried
autostart file which worked under Lubuntu 24.04, kernel 6.8.0-146
You don’t need the autostart entry for this at all - Ubuntu’s alsa-utils package already restores mixer state at the system level. It ships and enables alsa-restore.service (plus alsa-state.service) via sound.target, and its 90-alsa-restore.rules udev rule runs alsactl restore again every time a sound card appears, which also covers cards that only come up late in the boot, like your sof-soundwire one. alsactl reads /var/lib/alsa/asound.state by default, so: unmute Speaker and rt1316-1 in alsamixer as you did before, then save with
sudo alsactl store
(without --file, so the state lands in /var/lib/alsa/asound.state) and reboot once to test. I can’t verify this on your exact hardware, so treat that first reboot as the test of whether the saved state applies cleanly to the sof-soundwire card.
If you’d still like to know why the .desktop entry stopped running: first check whether it runs at all, e.g. temporarily change the Exec line to
and see whether the log file appears after login. If it never appears, the entry isn’t being launched at all. If it appears but the speaker stays muted, the command runs but fails or fires too early - the 5 second sleep may simply be too short now if the card initializes later than it did on 24.04, so trying a longer delay is a quick test. Two small things worth checking in the file itself: the quotes around the bash -c argument must be straight double quotes (in your post they show up as typographic quotes; if the file really contains those, the Exec line won’t parse the way you expect), and a Hidden=true key would disable the entry entirely.
I should mention I haven’t run Lubuntu 26.04 on this hardware myself - the system-level suggestion above comes from the current package contents and the alsa-utils documentation, not from personal experience with your setup.
Thanks for the quick response. Unfortunately no success yet.
I unmuted Speaker and rt1316-1, followed by
sudo alsactl store
and indeed there is a file /var/lib/alsa/asound.state. If I then mute Speaker and rt1316-1, and follow by
sudo alsactl restore
then Speaker and rt1316-1 become unmuted. So that works. But on a reboot, Speaker and rt1316-1 are muted again, though I can unmute them manually as before.
I’ve experimented with the autostart file. First, you mentioned straight double quotes for the bash command, but in your example you used straight single quotes. I’ve tried both. (I don’t know why the example in my original post had typographic quotes – sorry, it was some sort of transcription error.) I’ve also changed the command to alsactl restore, without a file specification.
I’ve confirmed that the log file appears on booting, and I’ve also changed the sleep to 30 seconds, but there’s still no effect.
So in summary: although the state is saved successfully in /var/lib/alsa/asound.state it doesn’t appear to be picked up on boot (whether or not there’s an autostart file).
I’ve been trying to explore why the speaker is muted in alsamixer on boot, and conveniently this laptop has two versions of Lubuntu in sepaate partitions, with shared home folders in a third partition. The main OS is the upgraded 26.04, and the backup OS is 24.04.4, both running kernels 7.0.0-38. There are different versions of alsamixer, too: 1.2.15.2 in the main OS, and 1.2.9 in the backup OS.
The other variable is the location of the specific file asound.state being used, either in the default location /var/lib/alsa/ (on the appropriate OS partition) or in the custom location ~/.config/ (on the home folder partition and shared between the two OSs). The startup file ~/.config/autostart/alsarestore.desktop is again on the home folder partition.
Here are the results. If I boot the backup OS and the startup file uses asound.state from the custom location then the speaker is unmuted after boot. (So this is also how the main OS used to work before the upgrade to 26.04.) In all other cases, either using asound.state from the default location, or booting the upgraded OS, the speaker is muted after boot.
I notice also that, inside alsa.state, control.27 has name ‘Speaker Switch’ and a binary value depending on whether the speaker is muted. Curiously, if I edit and save the startup file alsarestore.desktop, the copy of asound.state in the default location (but not the copy in the custom location) has the value of control.27 set to false on the next boot, so that I can no longer unmute the speaker with sudo alsactl restore but have to unmute by hand.
It all seems very strange. I wonder if anyone can throw some light on what’s going on? Thanks in advance.
I know this doesn’t really answer your question(s), but have you considered figuring out an amixer command that unmutes the speaker, and making it into a little script that runs on login? That would beat having to unmute it in alsamixer on every boot.
It would still be interesting to know why alsactl restore behaves differently with the two versions of alsamixer when invoked from an autostart file. By using something like
bash -c “echo before >> alsa.log && alsactl restore && echo after >> alsa.log”
I can confirm that alsactl never completes with the new version.