WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: PulseAudio / ALSA sound muted on each reboot  (Read 301 times)

Offline MikeLockmoore

  • Hero Member
  • *****
  • Posts: 579
  • Good software needn't be big!
PulseAudio / ALSA sound muted on each reboot
« on: March 20, 2025, 07:55:43 PM »
I'm running TC 16 RC.  I have alsa and pulseaudio installed.  I have the same issue others have posted where I need to unmute my speakers each time I reboot.  I have the PAVUcontrol installed, so this is not difficult, but is annoying.

However, I working again on my system tray software 'Flit' which has a sound control.  I'd like to use Flit to manage the sound without the PAVUcontrol if a user has PA installed, or just ALSA if a user only has that.

I don't see anything yet that  PAVUcontrol does when unmuting that is different than what amixer and pactl commands I've tried do form the command line.

I've looked at several posts here in TC (especially this one: https://forum.tinycorelinux.net/index.php/topic,26832.0.html) and even a few outside (like Arch forum), and the recommendations have not solved it for me yet such as 'amixer set Master 100 unmute'.  I believe I've done the essential recommendations in the pulseaudio.tcz info page (dbus is running, etc.).  I'd appreciate any other suggestions!

Code: [Select]
tc@box:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC3232 Analog [ALC3232 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Code: [Select]
tc@box:~$ lsmod | grep snd
snd_hda_codec_hdmi     49152  1
snd_ctl_led            20480  0
snd_hda_codec_realtek   118784  1
snd_hda_scodec_component    12288  1 snd_hda_codec_realtek
snd_hda_codec_generic    57344  1 snd_hda_codec_realtek
snd_hda_intel          28672  4
snd_hda_codec          81920  4 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel
snd_hda_core           49152  5 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_hda_codec
snd_hwdep              12288  1 snd_hda_codec
snd_intel_dspcfg       12288  1 snd_hda_intel
snd_pcm                86016  4 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_core
snd_timer              24576  1 snd_pcm
snd                    65536 18 snd_hda_codec_hdmi,thinkpad_acpi,snd_ctl_led,snd_hda_codec_realtek,snd_hda_codec_generic,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer
soundcore              12288  2 snd_ctl_led,snd


Offline gadget42

  • Hero Member
  • *****
  • Posts: 863
Re: PulseAudio / ALSA sound muted on each reboot
« Reply #1 on: March 20, 2025, 11:26:33 PM »
is the same behaviour observed on different hardware? never underestimate quirky hardware/firmware/software and/or peripherals that misbehave. for example, a one year old color laser printer in sleep/standby mode, connected to the computer via usb, causes the computer to fail to boot(easier to unplug usb to boot, versus any alternative which may/may-not result in success). as always in anything/computing/life/etc YMMV.
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11981
Re: PulseAudio / ALSA sound muted on each reboot
« Reply #2 on: March 20, 2025, 11:46:38 PM »
Hi MikeLockmoore
I took a look in pulseaudio.tcz and it contains this setup file:
Code: [Select]
#!/bin/sh

if [ ! -d /usr/local/etc/pulse ]; then
  mkdir -p /usr/local/etc/pulse
fi

[ -f /usr/local/etc/pulse/client.conf ] || cp -p /usr/local/share/pulseaudio/files/client.conf /usr/local/etc/pulse

[ -f /usr/local/etc/pulse/daemon.conf ] || cp -p /usr/local/share/pulseaudio/files/daemon.conf /usr/local/etc/pulse

[ -f /usr/local/etc/pulse/default.pa ] || cp -p /usr/local/share/pulseaudio/files/default.pa /usr/local/etc/pulse

[ -f /usr/local/etc/pulse/system.pa ] || cp -p /usr/local/share/pulseaudio/files/system.pa /usr/local/etc/pulse

[ -f /etc/udev/rules.d/78-sound-card.rules ] || cp -p /usr/local/share/pulseaudio/files/78-sound-card.rules /etc/udev/rules.d

[ -f /etc/udev/rules.d/90-pulseaudio.rules ] || cp -p /usr/local/share/pulseaudio/files/90-pulseaudio.rules /etc/udev/rules.d

udevadm control --reload-rules
udevadm trigger
The .pa files contain comments about restoring audio levels.

If you add  /usr/local/etc/pulse  to your backup, do your settings get
restored when you reboot?

There are also more .conf files under  /usr/local/share/pulseaudio/alsa-mixer.


Offline MikeLockmoore

  • Hero Member
  • *****
  • Posts: 579
  • Good software needn't be big!
Re: PulseAudio / ALSA sound muted on each reboot
« Reply #3 on: March 21, 2025, 08:21:05 PM »
...

If you add  /usr/local/etc/pulse  to your backup, do your settings get
restored when you reboot?

There are also more .conf files under  /usr/local/share/pulseaudio/alsa-mixer.

Thanks for looking at this.

I tried adding both folders to my .filetool.lst.  Enabled speakers with PAVUcontrol, then rebooted.  Sound (speakers) was muted again.  ::) I re-enabled sound.  I could not see anytimestamps in those folders that change when I re-enabled the sound.

Then I saw something on the Arch wiki that I tried:

$ amixer -c 0 sset "Auto-Mute Mode" Disabled
$ sudo alsactl store
and added usr/local/etc/alsa to .filetool.sh.  and rebooted.  That did not work either.   :-\

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11981
Re: PulseAudio / ALSA sound muted on each reboot
« Reply #4 on: March 21, 2025, 09:38:41 PM »
Hi MikeLockmoore
You left out the part where you added:
Code: [Select]
alsactl restoreto /opt/bootlocal.sh.

Offline MikeLockmoore

  • Hero Member
  • *****
  • Posts: 579
  • Good software needn't be big!
Re: PulseAudio / ALSA sound muted on each reboot
« Reply #5 on: March 21, 2025, 11:21:30 PM »
Hi MikeLockmoore
You left out the part where you added:
Code: [Select]
alsactl restoreto /opt/bootlocal.sh.

Good point!

While I was away, I found a good article (https://kelar.org/~bandali/blog/pacify.html) about how pulse audio saves to different files in ~/.config/pulse based on the machine-id (/etc/machine-id), but /etc/machine-id is getting reassigned with a random id with each reboot, so the old settings are not seen, and .config/pulse accretes more and more redundant setting files.  To compensate, the author was able to make a little script to re-name the pulse audio setting files to the new machine-id, but that seems kinda ridiculous.  There is supposed to be a way to disable the machine-id randomization in Debian, but TC does not seem to have that same setting (in Debian its under /etc/default, but that does not exist in TC).   I found that article on a Devuan forum (https://dev1galaxy.org/viewtopic.php?id=4002) which has some related PA discussions.

Anyway, I've decided to punt PA from my system for now.  I found that there is a TCE called 'apulse' that provides enough PA functionality using ALSA to let FireFox have sound, which was my primary motivation to use PA anyway.  ALSA was not remembering my "unmuted" setting either (probably due to not doing 'alsactl restore' as you pointed out), so I just put a 'amixer set Master 100 unmute' in my bootlocal.sh, which worked, but I'll try the 'alsactl restore' instead, as it is a bit more user-friendly (esp. if some other app like Flit does not manage the master sound level for you on startup). 

Note for anyone else wanting to use apulse with firefox: 
1) Modify the .wmx/Applications/firefox/firefox script to say 'exec apulse firefox' where it normally says 'exec firefox'
2) Likewise, do the same thing for the /usr/local/share/applications/firefox.desktop file, except put 'Exec=apulse firefox" in place of "Exec=firefox"
... however, to do this, you probably need to copy the file first from the extension tcloop file:
sudo cp -f /tmp/tcloop/firefox/usr/local/share/applications/firefox.desktop /usr/local/share/applications/firefox.desktop
and put usr/local/share/applications/firefox.desktop into your /opt/.filetool.lst.  (with no leading / in front of opt)

Thanks for the help as you have many times!  Hopefully my digging here is useful to someone  I really don't like the way that PulseAudio is basing the names of its ~/.config files on the machine-id.  Maybe there's a simple way to override this behavior in PulseAudio without messing with /etc/machine-id itself.







Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11981
Re: PulseAudio / ALSA sound muted on each reboot
« Reply #6 on: March 22, 2025, 01:38:09 AM »
Hi MikeLockmoore
... 2) Likewise, do the same thing for the /usr/local/share/applications/firefox.desktop file, except put 'Exec=apulse firefox" in place of "Exec=firefox" ...
If you do number 2, you don't need to do number 1.
.wmx/Applications/firefox/firefox gets its setting from firefox.desktop too.

Offline gadget42

  • Hero Member
  • *****
  • Posts: 863
Re: PulseAudio / ALSA sound muted on each reboot
« Reply #7 on: March 23, 2025, 05:10:19 AM »
@MikeLockmoore, thanks for your research! especially finding the multi-year devuan forum thread! is it/this solved to your satisfaction now?
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11981
Re: PulseAudio / ALSA sound muted on each reboot
« Reply #8 on: March 23, 2025, 12:33:38 PM »
Hi MikeLockmoore
I did some more digging. According to this:
https://www.freedesktop.org/software/systemd/man/latest/machine-id.html

Basically, machine-id typically gets created when the machine first gets set
up in  /var/lib/dbus/machine-id  and doesn't get changed after that.

Since  /var  is not persistent, the system creates a new machine-id each time
the machine restarts.

I added  var/lib/dbus/machine-id  to my backup and the machine-id now remains
constant. No new entries show up in  ~/.config/pulse/  or  in ~/.dbus/session-bus/.
Only the timestamps on the existing entries change.