alsa-project / alsa-utils

The Advanced Linux Sound Architecture (ALSA) - utilities
GNU General Public License v2.0
197 stars 136 forks source link

alsactl restore udev rule failing #175

Open rnhmjoj opened 1 year ago

rnhmjoj commented 1 year ago

It seems the udev rule to restore card settings is always failing during the boot:

$ journalctl -u systemd-udevd -b -o cat --grep alsa
controlC2: Process '/sbin/alsactl restore 2' failed with exit code 99.
controlC2: Process '/sbin/alsactl restore 2' failed with exit code 99.
controlC1: Process '/sbin/alsactl restore 1' failed with exit code 99.
controlC0: Process '/sbin/alsactl restore 0' failed with exit code 99.

I checked and made sure the file system is mounted and /var/lib/asound.state is ok by the time the rule runs. I guess the issue could be the hardware is not yet fully initialised.

Somehow the settings of card 0 (HDA Intel PCH) are restored anyway, but not those of card 1 (HDA ATI HDMI). Manually running alsactl restore 2 later works, albeit partially (some softvol controls are never recovered).

rnhmjoj commented 3 months ago

ping @perexg

rnhmjoj commented 3 months ago

The exit code 99 seems to be coming from this line: https://github.com/alsa-project/alsa-utils/blob/ca82cf8ed63c10b5bd018624e29d07c765d3e5ff/alsactl/init/00main#L24 IIUC it means the device couldn't be identified, or the hardware-specific initialisation failed.

Since I can later issue the command manually and the settings are restored, it really looks like the rule is firing too early before the card is fully ready.

paletteguy commented 3 months ago

Some embedded audio cards do not support UCM hence the error. Adding --no-ucm to udev rule 90-alsa-restore.rules removes the warning.

rnhmjoj commented 3 months ago

I don't think that's the issue: the settings are not being restored on boot, but they do if I manually run the same command later.

paletteguy commented 3 months ago

The 90-alsa-restore.rules /lib/udev/rules.d is called during boot to restore settings.

I had the same warning / problem in a project and adding --no-ucm removed the error from the logs and ALSA controls got restored correctly.