Ubuntu 18.04 soundcard not detected

I was trying to fix the crackling sounds on my ThinkPad x1 c6 I ran the following command to re-install the alsa audio driver. To do that I ran the following commands.

1) Remove the ALSA packages.

sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils

2) Reinstall the same packages.

sudo apt-get install linux-sound-base alsa-base alsa-utils 

Following that Pavucntrol no longer recognizes the speaker or the headphone output and just shows a Dummy output instead.

So far I have tried the following

  1. Tried running this command.

    sudo apt-get install build-essential linux-headers-`uname -r` alsa-  base alsa-firmware-loaders alsa-oss alsa-source alsa-tools alsa-tools-gui alsa-utils alsamixergui
    

    Followed by a reboot. No effect.

  2. This answer

    https://askubuntu.com/a/863157/191299

    No effect

  3. This command pulseaudio -k && sudo alsa force-reload

    No effect

  4. Tried running these commands

    sudo apt-add-repository ppa:ubuntu-audio-dev/alsa-daily
    sudo apt-get update
    sudo apt-get install linux-image-extra-`uname -r`
    sudo apt-get install --reinstall linux-image-extra-`uname -r`  
    sudo apt-get install oem-audio-hda-daily-dkms
    

    No effect.

  5. This command

    sudo apt-add-repository ppa:ubuntu-audio-dev/alsa-daily
    sudo apt-get install oem-audio-hda-daily-dkms
    

    No effect.

  6. Adding one of the following lines in /etc/modprobe.d/alsa-base.conf

    options snd-hda-intel model=auto
    

    or

    options snd-hda-intel model=thinkpad
    

Some useful outputs are mentioned below

  • ~$ lspci -nnk | grep -A2 Audio
    00:1f.3 Audio device [0403]: Intel Corporation Sunrise Point-LP HD Audio [8086:9d71] (rev 21)
    Subsystem: Lenovo Sunrise Point-LP HD Audio [17aa:225c]
    Kernel modules: snd_hda_intel
    00:1f.4 SMBus [0c05]: Intel Corporation Sunrise Point-LP SMBus [8086:9d23] (rev 21)
    
  • ~$ pacmd list-cards
    0 card(s) available.
    
  • The output from the Ubuntu sound debug instructions

    http://alsa-project.org/db/?f=7e809df97a3b032337389a16303ac1158e3e7581


Solution 1:

Okay I dont know why, but this worked.

I was trying to reproduce the problem.

Instead of uninstalling the sound packages and reinstalling them right away (which caused the problem in the first place) I decided to reboot the system after uninstalling the packages.

sudo apt-get --purge remove linux-sound-base alsa-base alsa-utils

Followed by a reboot. I DID NOT reinstall the packages and just checked the pavucontrol Output tab and the "Dummy Output" was gone.

I am not sure why though. If anyone knows why please comment.

Edit: It also fixed the crackling sounds. I still need to learn a lot on how linux work.