No found sound card after first boot

I have searched the existing open and closed issues

Raspberry Pi Zero W

Required Information

G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=0
G_DIETPI_VERSION_RC=2
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’

  • Distro version | bookworm 1
  • Kernel version | Linux DietPi 6.1.21+ #1642 Mon Apr 3 17:19:14 BST 2023 armv6l GNU/Linux
  • Architecture | armhf
  • SBC model | RPi Zero W (armv6l)
  • Power supply used | USB
  • SD card used | 2Gb

My RPi Zero is connected to the Samsung sound bar J-Series via an HDMI connector.
It also gets power from the same soundbar with a USB port.

So when I turn it on (the soundbar) the RPi gets powered up and boots up.
But RPi doesn’t see any sound adapters.

# aplay -l aplay: device_list:274: no soundcards found...

If I connect to the RPi via ssh and reboot it, It starts to see the HDMI audio adapter.
So, I think that at the first boot of the RPi, the HDMI port is not ready yet.

How can I restart the audio subsystem after a normal boot?

PS
I tried rmmod and then modprobe all mods with “snd”…

@MichaIng can you have a look pls.

Instead of a reboot, does it work to detach and re-attach the HDMI cable? Probably the sound bar is somehow not read yet, when both start together, and the RPi stores the state of the HDMI device to be no sound device. I am not sure how this is initialised, but probably via udev trigger.

… just checked the alsa-utils package, and indeed, aside of a systemd service which restores the ALSA mixer state at boot, there is a udev rule which does the same on a per-device level, once a sound device is added/detected. Just not sure whether/when a HDMI device declares itself as sound device, whether there is a hotplug-like detection for audio capability as well etc.

Does this work as alternative to reboot (and re-attaching the HDMI cable)?

alsactl -E HOME=/run/alsa -E XDG_RUNTIME_DIR=/run/alsa/runtime restore

It doesn’t help