I recently ran sudo apt upgrade
to install a new kernel on Ubuntu and I had no sound hardware detected after the upgrade. But it turns out that the extra drivers package was not pulled in when I requested to install a new kernel. You need to ensure you pick the kernel headers and kernel-modules-extra packages that match the kernel you wish to install.
┌──[jason@192.168.1.2]─[~] └──╼ ╼ $ sudo apt-get install linux-modules-extra-`uname -r` linux-headers-`uname -r` |
The command above should work fine to install the required drivers and the kernel headers, which will allow the compilation of the drivers if required. In my opinion, this should be installed by default. But after you have installed the required drivers unplug and replug your sound hardware if possible or log out and back in again, and it should re-detect your hardware and allow your sound hardware to work just fine.