alsactl restore fails after Generic / Generic_1 IDs swap between HDMI and ALC897
A message that is not in the archive (sent off-list or not yet received): [email protected]
alsa-project/alsa-utils issue #338 was opened from flowersauce:
## Summary
Two HDA controllers exchanged the ALSA IDs Generic and Generic_1 between observed boots. The existing state file still associated those IDs with the previous hardware. On the later boot, alsactl restore returned 99 and reported missing controls; the analog card's saved Auto-Mute Mode = Disabled was not restored.
This has a similar symptom and hardware combination to closed issue #263. That discussion suggested checking whether the Generic IDs refer to the same hardware after reboot. Here the observed ID-to-hardware mapping did change.
## Environment
- Arch Linux; Gigabyte X870 GAMING X WIFI7 motherboard
- linux-zen package: 7.2.14.zen1-1
- alsa-utils: 1.2.16-1; alsa-lib: 1.2.16.1-1
- PipeWire: 1.6.10; WirePlumber: 0.5.18
- Both affected controllers use snd_hda_intel
- PCI 0000:77:00.1: AMD HDMI controller, ATI R6xx HDMI codec
- PCI 0000:77:00.6: AMD analog controller, Realtek ALC897 codec
- A separate discrete GPU HDMI controller has the ID HDMI
- Rear line-out speakers and front-panel headphones both connected
## Observations
The following mappings were recorded from /proc/asound/cards in two sessions:
| Controller / codec | ALSA index | November 2 | November 8 | | --- | --- | --- | --- | | 0000:77:00.1 / ATI R6xx HDMI | 2 | Generic | Generic_1 | | 0000:77:00.6 / Realtek ALC897 | 3 | Generic_1 | Generic |
The indexes stayed the same, while the IDs swapped.
Before the local mitigation, /var/lib/alsa/asound.state still contained:
- HDMI controls under state.Generic
- Analog controls under state.Generic_1, including Auto-Mute Mode = Disabled
On the November 8 boot, the stock alsa-restore.service ran /usr/bin/alsactl restore. Its process result was status=99, with many messages such as:
```text /usr/bin/alsactl: set_control:1373: failed to obtain info for control #20 (No such file or directory) ```
The actual Auto-Mute setting on the analog card was Enabled.
The user-visible effect was that rear speakers stayed silent when front headphones were plugged in, even after selecting the line-out port in the desktop sound settings. Unplugging headphones allowed the speakers to play.
The PipeWire sink was already on analog-output-lineout, with both jack ports reported as available. Codec pin 0x14 (rear line-out) had Pin-ctls: 0x00. After disabling Auto-Mute, it changed to Pin-ctls: 0x40: OUT.
## Expected behavior / question
Is there a supported way for restoration to detect or avoid applying a saved card section to different hardware when discovery-dependent IDs change? Or does the underlying default-ID assignment need to be addressed in the kernel sound subsystem?
The observed mapping change and mismatched saved state strongly suggest an explanation for the restore failure, but the original failure has not been reproduced under controlled boot conditions. There is no evidence identifying a particular package update as the cause.
## Local mitigation and tests
Used the documented [udev card ID method](https://www.alsa-project.org/wiki/Changing_card_IDs_with_udev) to give each affected controller a unique ID:
```udev
ACTION=="add", SUBSYSTEM=="sound", KERNEL=="card[0-9]*", KERNELS=="0000:77:00.6", ATTR{id}="Mainboard"
ACTION=="add", SUBSYSTEM=="sound", KERNEL=="card[0-9]*", KERNELS=="0000:77:00.1", ATTR{id}="RadeonHDMI"
```Installed as /etc/udev/rules.d/60-stable-hda-ids.rules, before the stock 90-alsa-restore.rules. For live testing, the IDs were also assigned through sysfs without reloading the active driver. Set Auto-Mute to Disabled and generated a clean state file using alsactl store.
Tests performed:
- Temporarily enabled Auto-Mute, then ran alsactl --no-init-fallback restore Mainboard: exit 0 and Auto-Mute returned to Disabled.
- Ran alsactl --no-init-fallback restore for all cards: exit 0.
- Selected headphones: Headphone switch on, Front switch off.
- Selected line-out: Front switch on, Headphone switch off.
- Auto-Mute remained Disabled during both port changes.
A temporary user service that forced Auto-Mute off at login was removed after these tests, so it is not needed for the live restore test.
**Limitations:** The complete boot path with the new udev rules has not yet been tested by rebooting. Physical audibility after the final configuration change has not yet been confirmed by the user. Pre-mitigation state and the boot restore log have been preserved locally.
Please let me know which additional targeted diagnostics would help, or whether this report should be directed to the kernel tracker.
Issue URL : https://github.com/alsa-project/alsa-utils/issues/338
Repository URL: https://github.com/alsa-project/alsa-utils