Missing /dev/snd/hwC0D0 sound device prevents container from starting

When I connect my laptop to a docking station, I get the following error when attempting to start any container:

Error: Common start logic: Failed to start device ‘/dev/snd/hwC0D0’: The required device path doesn’t exist and the major and minor settings are not specified

I’m no expert on how the sound works, but it appears that the sound card changes when connected to the dock so the dock becomes card 0 and the laptop card 1. I did a lot of searching and I believe it’s normal that /dev/snd/hwC0D0 does not exist when it’s an HDMI connection, but LXD seems to require it. The file /dev/snd/hwC1D0 does exist.
Is there any way to get around this problem? Even blacklisting the device or disabling sound if necessary? The sound on the host works fine, including the sound on the laptop and the sound through the HDMI connection.

I have figured out my own problem.
I had /dev/snd/hwC0D0 mapped in my x11.profile to get sound working in one of my containers. I expected those mappings to show when I did a lxc config show ... but it doesn’t so I didn’t realize it at first. I later checked my profile and found it.

But the way I worked around the problem was to change the order of the sound cards by creating the file /etc/modprobe.d/sound.confwith the following contents:

options snd_hda_intel index=0
options snd_usb_audio index=1

That keeps the default sound card (0) the same whether I am on the dock or not, so the file /dev/snd/hwC0D0 exists in both cases and I can keep the mapping in the profile.

2 Likes