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

EDIT: This appears to have turned in a sort of canonical set of commands to start diagnosing audio issues.


I am using Ubuntu 20.04 for over a month now. After a reboot, I have no more sound and WiFi. Note that this is different from many other posts, which seem to have had no sound at all, after an upgrade. In this case, sound stopped working only after a reboot.

As for the sound, I seem to not have the appropriate kernel modules for sound, so I guess the most likely solution would come from making the modules available (it seems I have two sound cards). I will try to include below (1) as much info as possible related to the copious posts with similar problems.

I am listing below (2) the posts that I consider most useful at the current point of the fixing work-in-progress.

And I am listing below (3) other posts that I checked when the grass was higher.


(1) Info about my broken system, along with a comparison with what I see in a working system that I managed to put together.

  1. No /proc/asound directory.
    Versus
    $ cat /proc/asound/cards
     0 [PCH            ]: HDA-Intel - HDA Intel PCH
                          HDA Intel PCH at 0x604b108000 irq 159
     1 [NVidia         ]: HDA-Intel - HDA NVidia
                          HDA NVidia at 0xa4000000 irq 17
  1. $ lsmod | grep snd outputs nothing.
    Versus (also compare with this)
    $ lsmod | grep snd_hda_intel
    snd_hda_intel          53248  10
    snd_intel_dspcfg       24576  3 snd_hda_intel,snd_sof_pci,snd_sof_intel_hda_common
    snd_hda_codec         131072  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek,snd_soc_hdac_hda
    snd_hda_core           90112  9 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_hda_codec_realtek,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_sof_intel_hda
    snd_pcm               106496  9 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_sof,snd_sof_intel_hda_common,snd_soc_core,snd_hda_core,snd_pcm_dmaengine
    snd                    90112  33 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_compress,thinkpad_acpi,snd_soc_core,snd_pcm,snd_rawmidi
  1. Kernel modules
    $ dpkg -L linux-modules-$(uname -r) | grep snd
    /lib/modules/5.4.0-40-generic/kernel/sound/core/seq/snd-seq-dummy.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/seq/snd-seq-midi-emul.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/seq/snd-seq-midi-event.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/seq/snd-seq-midi.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/seq/snd-seq-virmidi.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/seq/snd-seq.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-compress.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-hrtimer.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-hwdep.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-pcm-dmaengine.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-pcm.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-rawmidi.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-seq-device.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd-timer.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/core/snd.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/drivers/pcsp/snd-pcsp.ko
    /lib/modules/5.4.0-40-generic/kernel/sound/pci/snd-ens1370.ko

Versus exactly the same

How can I check if any of this is what I need?
How can I check if any of this corresponds to those from Intel listed in item #2 above?
How can I load these modules?

  1. inxi
    $ inxi -SA
    System:    Host: Hydrus1 Kernel: 5.4.0-40-generic x86_64 bits: 64 Desktop: Gnome 3.36.1 Distro: Ubuntu 20.04 LTS (Focal Fossa) 
    Audio:     Device-1: Intel 6 Series/C200 Series Family High Definition Audio driver: N/A 
               Device-2: NVIDIA GF104 High Definition Audio driver: N/A 

Versus (also compare with this)

    $ inxi -SA
    System:    Host: ViaLactea Kernel: 5.4.0-40-generic x86_64 bits: 64 Console: tty 0 Distro: Ubuntu 20.04 LTS (Focal Fossa)
    Audio:     Device-1: Intel Cannon Lake PCH cAVS driver: snd_hda_intel
               Device-2: NVIDIA GP107GL High Definition Audio driver: snd_hda_intel
               Sound Server: ALSA v: k5.4.0-40-generic
  1. lspci

    $ lspci -nnk | grep -A 1 Audio
    00:1b.0 Audio device [0403]: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller [8086:1c20] (rev 04)
        DeviceName:  Onboard Audio
        Subsystem: Dell 6 Series/C200 Series Chipset Family High Definition Audio Controller [1028:04a4]
    00:1c.0 PCI bridge [0604]: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 [8086:1c10] (rev b4)
    --
    01:00.1 Audio device [0403]: NVIDIA Corporation GF104 High Definition Audio Controller [10de:0beb] (rev a1)
        Subsystem: Dell GF104 High Definition Audio Controller [1028:04a4]
    03:00.0 Network controller [0280]: Intel Corporation Centrino Ultimate-N 6300 [8086:422b] (rev 35)
    

Versus

    $ lspci -nnk | grep -n -A 4 Audio
    49:00:1f.3 Audio device [0403]: Intel Corporation Cannon Lake PCH cAVS [8086:a348] (rev 10)
    50-     Subsystem: Lenovo Cannon Lake PCH cAVS [17aa:225f]
    51-     Kernel driver in use: snd_hda_intel
    52-     Kernel modules: snd_hda_intel, snd_sof_pci
    53-00:1f.4 SMBus [0c05]: Intel Corporation Cannon Lake PCH SMBus Controller [8086:a323] (rev 10)
    --
    67:01:00.1 Audio device [0403]: NVIDIA Corporation GP107GL High Definition Audio Controller [10de:0fb9] (rev a1)
    68-     Kernel driver in use: snd_hda_intel
    69-     Kernel modules: snd_hda_intel
    70-70:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS525A PCI Express Card Reader [10ec:525a] (rev 01)
    71-     Subsystem: Lenovo RTS525A PCI Express Card Reader [17aa:225f]
  1. System (Versus exactly the same kernel)

    $ uname -a
    Linux Hydrus1 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    
  2. Test sound

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

Versus

    $ aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: PCH [HDA Intel PCH], device 0: ALC285 Analog [ALC285 Analog]
      Subdevices: 0/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    ...
  1. lshw
        $ lshw -C multimedia
        WARNING: you should run this program as super-user.
          *-multimedia UNCLAIMED    
               description: Audio device
               product: GF104 High Definition Audio Controller
               vendor: NVIDIA Corporation
               physical id: 0.1
               bus info: pci@0000:01:00.1
               version: a1
               width: 32 bits
               clock: 33MHz
               capabilities: bus_master cap_list
               configuration: latency=0
               resources: memory:e0080000-e0083fff
          *-multimedia UNCLAIMED
               description: Audio device
               product: 6 Series/C200 Series Chipset Family High Definition Audio Controller
               vendor: Intel Corporation
               physical id: 1b
               bus info: pci@0000:00:1b.0
               version: 04
               width: 64 bits
               clock: 33MHz
               capabilities: bus_master cap_list
               configuration: latency=0
               resources: memory:e1e50000-e1e53fff
        WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

Here it is quoted (note the driver)

    $ sudo lshw -C multimedia
      *-multimedia              
           description: Audio device
           product: GP104 High Definition Audio Controller
           vendor: NVIDIA Corporation
           physical id: 0.1
           bus info: pci@0000:01:00.1
           version: a1
           width: 32 bits
           clock: 33MHz
           capabilities: pm msi pciexpress bus_master cap_list
           configuration: driver=snd_hda_intel latency=0
           resources: irq:17 memory:f7080000-f7083fff
  1. alsa packages

    $ dpkg -l | grep alsa
    ii  alsa-base                                     1.0.25+dfsg-0ubuntu5                all          ALSA driver configuration files
    ii  alsa-tools-gui                                1.1.7-1ubuntu1                      amd64        GUI based ALSA utilities for specific hardware
    ii  alsa-topology-conf                            1.2.2-1                             all          ALSA topology configuration files
    ii  alsa-ucm-conf                                 1.2.2-1ubuntu0.1                    all          ALSA Use Case Manager configuration files
    ii  alsa-utils                                    1.2.2-1ubuntu1                      amd64        Utilities for configuring and using ALSA
    ii  gstreamer1.0-alsa:amd64                       1.16.2-4                            amd64        GStreamer plugin for ALSA
    ii  libsox-fmt-alsa:amd64                         14.4.2+git20190427-2                amd64        SoX alsa format I/O library
    
  2. No sound either if I plug earphones.

  3. I have no timidity-daemon to remove.

  4. Attempt reload

    $ sudo alsa force-reload
    [sudo] password for user1: 
    Unloading ALSA sound driver modules: (none loaded).
    Loading ALSA sound driver modules: (none to reload).
    
  5. modprobe

    $ grep intel /etc/modprobe.d/alsa-base.conf 
    options snd-intel8x0m index=-2
    

(2) Related and possibly useful posts

Unable to get sound working. Ubuntu Server 14.04.3

https://forums.linuxmint.com/viewtopic.php?t=221745

https://ubuntuforums.org/showthread.php?t=1684576

How to load "snd-hda-intel" at startup


(3) Other related posts

https://www.alsa-project.org/wiki/Matrix:Module-hda-intel

https://askubuntu.com/a/1244118/226614 . Recent post, accepted answer. Suggests using a ppa for fixing. I am not sure this can get things worse...

https://askubuntu.com/a/1249071/226614 . Recent post. Suggests using sudo setfacl -m u:user1:rw /dev/snd/* Tried this, didn't help.

https://askubuntu.com/a/847954/226614 . Old post, accepted answer. Suggests installing alsa-firmware-loaders and alsa-base. I am not sure this still applies...

How to install missing firmware for an Creative Labs Audigy2 soundcard? . Also old post. Also suggests UNCLAIMED device is due to firmware issues. Why would the problem appear after a reboot?

No sound on upgrade (18.04 -> 20.04) only have "dummy output"

Dummy output after standby since upgrading to Ubuntu 20.04

Internal speaker (Audio) is not working in Ubuntu 20.04 LTS after upgrading from Ubuntu 18.04 LTS

Ubuntu 20.04 - No sound

Soundcard not detected by pulseaudio (but by alsa)

How to install missing firmware for an Creative Labs Audigy2 soundcard?

https://itsfoss.com/fix-sound-ubuntu-1304-quick-tip/


Solution 1:

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.

Solution 2:

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)

Solution 3:

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