Only "Dummy output" (sound) in Ubuntu 20.04 after reboot - Broken driver / module

EDIT: Avoid missing kernel linux-modules-extra-XX-generic when updating kernel may help avoiding the problem in the future, in some cases. (I actually ran into this same problem later again after a new automatic update, and then identified the missing package).


Summary: I managed to

  1. Learn which files my system was missing. This was my main hurdle, solved with the help of this comment, now posted as an answer. The rest was easy.
  2. Learn which package holds them.
  3. Install it.

After trying many things, I have solved the problem. It was essential to have, in addition to my broken system S1, a similar working system S2 available. I was very lucky to have this, and I guess it might have taken me tons of extra time otherwise.

Detailing the list of steps above:

  1. In S1:

     $ modprobe --show-depends snd_hda_intel
     modprobe: FATAL: Module snd_hda_intel not found in directory /lib/modules/5.4.0-40-generic
    

    In S2:

     $ modprobe --show-depends snd_hda_intel
     insmod /lib/modules/5.4.0-40-generic/kernel/sound/soundcore.ko
     install /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; }
     insmod /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-timer.ko
     install /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; }
     insmod /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-hwdep.ko
     insmod /lib/modules/5.4.0-40-generic/kernel/sound/hda/snd-hda-core.ko
     insmod /lib/modules/5.4.0-40-generic/kernel/sound/pci/hda/snd-hda-codec.ko
     insmod /lib/modules/5.4.0-40-generic/kernel/sound/hda/snd-intel-dspcfg.ko
     insmod /lib/modules/5.4.0-40-generic/kernel/sound/pci/hda/snd-hda-intel.ko
    

    I had the first three .ko files in my S1, but not the last four.

  2. So I checked the owner package in S2 for the last four files.

     $ dpkg -S /lib/modules/5.4.0-40-generic/kernel/sound/hda/snd-hda-core.ko
     linux-modules-extra-5.4.0-40-generic: /lib/modules/5.4.0-40-generic/kernel/sound/hda/snd-hda-core.ko
    

    which was the same for the other three files missing in S1. I checked and this package was not installed in S1.

  3. I apt-get'd the package, rebooted, and now everything seems to be back to normal.

My guess is that the package was present during the time sound worked, and for some strange reason it got uninstalled (or removed, or...) from the dkpg database, or...?

Notes:

  1. I had also kernel 5.4.0-39 in S1, and sound didn't work in this kernel either, prior to the fixing which worked. It turned out that linux-modules-extra-5.4.0-39-generic was not installed either.

  2. On (Compiled) Kernel Drivers vs. (Loadable) Kernel Drivers / Modules: see this.


Try to check if all dependencies are correct:

modprobe --show-depends snd_hda_intel 

And check if the kernel module exists:

find /lib/modules/$(uname -r)/kernel/sound -name snd-hda-intel.ko

BTW the right forum for alsa/sound problems would be alsa forum (alsa-project.org/wiki/Main_Page).

BTW: There exists a beautiful script that uploads all necessary info for debugging sound problems --> wiki.ubuntu.com/Audio/AlsaInfo; you can also install it with sudo apt install alsa-utils. Run the script alsa-info, which will help you to print all necessary info for future problems with a minimum of effort.

As the kernel itself is missing you have to install it e.g. via this package:

sudo apt install linux-modules-extra-$(uname -r)-generic

Had the same issue, I just did:

sudo killall timidity

Then the sound came back.

But after reboot, there is no sound again.

Then I figured out the proper way of disabling timidity:

sudo systemctl stop timidity.service
sudo systemctl disable timidity.service