Sound card not detected on Ubuntu 18.04
This answer fixes the sound but breaks the brightness control.
I am leaving it here for documentation purposes and hopefully will be able to review it later when I found a better fix.
Please consider this followup answer!
[Edit: March 2020] There's a kernel regression (in Linux 5.3.0-41 and probably newer versions running on Ubuntu 19.10) which causes a new "dummy output" issue on Ubuntu 19.10.
[...]
There's a regression (thanks JustNiz for notifying me) in the 5.3.0-41 and -42 kernel that causes a new "dummy output" issue on Ubuntu 19.10 and 18.04. The explanations for this bug are available in this bug report, so I won't go into details, and I'll directly tell you how to fix it.
[[Edit] It appears this may also happen for some Ubuntu 20.04 users.
Source: linuxuprising
sudo gedit /etc/modprobe.d/alsa-base.conf
Add the following line to the end of this file:
options snd-hda-intel dmic_detect=0
Save and close the file and reboot your system. You should have the audio back.
Source: itsfoss
I had already tried that before without success. It has now worked the second time after I not only did the above but also followed Adam's advice to run pulseaudio --start
after rebooting.
Note that this may take a few seconds until the sound starts working.
Because it could have been that only Adam's advice was important, I removed the line options snd-hda-intel dmic_detect=0
again and rebooted. It stopped working again. So I edited it in again and rebooted another time. And this time the sound worked without needing to run pulseaudio --start
.
I don't understand that, but this seems to be the fix. If it turns out that I need to run pulseaudio --start
every time at startup, I will just add that command to my .profile
or .bashrc
. Although after rebooting a few times to test this, I'm pretty sure you don't actually need the pulseaudio --start
- just wait some time after the boot. Approximately a minute.
Regarding the "possibly related" part of my question
My screen brightness controls have disappeared as well. They were broken once before, and I fixed that by adding acpi_backlight=video to the GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub and updating grub and rebooting. But that fix is still in place and still it is broken again.
Directly after I noticed that the volume keys are now working and making a sound, I pressed a brightness key. And they no longer work. I will try the fix that was linked to in one of my quoted articles in this answer and edit my answer once I know whether it worked.
Regarding the delay after boot until the sound works: Perhaps this has to do with it.
$ dmesg[ 44.945151] Bluetooth: RFCOMM ver 1.11
[ 45.576833] rfkill: input handler disabled
[ 84.861079] snd_hda_intel 0000:00:1f.3: couldn't bind with audio component
[ 84.885411] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC285: line_outs=2 (0x14/0x17/0x0/0x0/0x0) type:speaker
[ 84.885414] snd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 84.885416] snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[ 84.885418] snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0
[ 84.885419] snd_hda_codec_realtek hdaudioC0D0: inputs:
[ 84.885421] snd_hda_codec_realtek hdaudioC0D0: Mic=0x19
[ 84.933958] snd_hda_codec_hdmi hdaudioC0D2: No i915 binding for Intel HDMI/DP codec
[ 84.934160] hdaudio hdaudioC0D2: Unable to bind the codec
[ 84.934845] input: HDA Intel PCH Headset Jack as /devices/pci0000:00/0000:00:1f.3/sound/card0/input25
[ 84.934904] input: HDA Intel PCH Mic as /devices/pci0000:00/0000:00:1f.3/sound/card0/input26
[ 84.934952] input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1f.3/sound/card0/input27
My first attempt was this answer which fixed the sound but breaks the brightness controls.
I later noticed weird behaviour in combination with my different grub bootloader menus and started to write a new question. While writing that question, I performed more testing until it became more of a blog post than a question, since it also contains several answers to implicit questions.
You will find it below the horizontal line.
TL;DR
Removing nomodeset
and acpi_backlight=video
did the trick for me. Sound and Brightness Controls now work - possibly at the expense of hibernation.
Many open source drivers have removed support for non-kernel mode setting, so in those cases when you use nomodeset you will end up falling back to the very basic VESA un-accelerated driver. This is very much a performance and feature hit. Source QA
Long Writeup of Testing this
This is a new perspective on the question originally posed as Sound card not detected on Ubuntu 18.04. It has become wildly more weird. But for you to understand my utter confusion, you'll need some pretext:
I have three partitions with ubuntu 18.04 on each. In the end, I will get rid of two of them, but they are EXT 4
, ZFS unencrypted
, ZFS encrypted
. Each has a different background so that I know to which I am logged in.
I also have grub installed at two places. Probably because I did not set a separate boot partition for the EXT4 system. So I have /dev/nvme0n1p8/boot
but also /dev/nvme0n1p5 (boot partition)
. Both contain a kernel and initrd 5.3.0-51-generic
. The p5
contains also 5.3.0-53-generic
and the p8/boot
contains also 53.0-28-generic
and some old 4-15-0-101-generic
. However, I'm not even sure these boot partitions matter much.
In order to distinguish the two grubs, I have added a theme to the one on p5
.
When I start the laptop, it boots to the grub GUI on p5
. It has some problems with correctly listing multiple zfs partitions so I made a custom entry, but that shouldn't matter here either.
To open the grub GUI on p8
, I press Esc to get to the grub terminal and there I enter
set prefix=(hd0,gpt8)
When I boot from grub on p5
, the brightness keys and the sound are broken.
When I boot from grub on p8
, they work flawlessly.
I've made sure to use the same kernel and system in both instances. In fact, I have tried several times in the hopes that it may be due to some kernel boot argument.
The problem is not bound to one of the three ubuntu installations. I can boot any of them so that the sound works and so that it does not, depending on the grub I'm using.
The problem is not bound to one kernel version. I can boot from both 51
and 53
into any partition and the sound works or does not, depending on the grub I'm using.
The problem is not due to different kernel images of the same version. I can boot from the p8
grub with the kernel 53
located on the p5
partition and the sound will work.
Testing
Let us only consider only the simple ext4 partition for now. The encrypted zfs partition behaves the same though (and the unencrypted zfs partition I haven't checked).
First of all, I have tried several combinations of boot arguments, but I think the following three tests should be enough for this question.
- The first column ("entry") is either
old
for the ext4-menuentry with grub onp8
ornew1
for the ext4-menuentry with grub onp5
. - The
kernel partition
was set to8
by editing the menuentry to containset root=(hd0,gpt8)
right before the line starting withlinux
and prefixing the path to the kernel and to the initrd with/boot
.
Analogously, thekernel partition
was set to5
by insertingset root=(hd0,gpt5)
and removing the prefix/boot
from the kernel and initrd paths. - Any column between (exclusive)
]kernel version, sound works?[
is about the presence of the respective kernel boot argument. Those are arguments that were set in at least one of the grub menuentries, but as you can see in the table, the behaviour remained the same without those.
I have also tested whether the presence of quiet splash
has any effect, but it also does not seem to have any.
To be absolutely certain that the boot arguments don't have any impact, I tried booting from the grub terminal directly.
set prefix=(hd0,gpt8)/boot/grub
set root=(hd0,gpt5)
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
boot
Sound and brightness keys work in this way.
set prefix=(hd0,gpt5)/grub
set root=(hd0,gpt5)
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
boot
Sound and brightness keys do also work in this way! (unexpected at this point)
set prefix=(hd0,gpt8)/boot/grub
normal
# select menuentry and press E to edit it so that it looks as follows:
setparams 'Ubuntu'
set root=(hd0,gpt5)
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
# CTRL+X to boot that
Sound and brightness keys do also work in this way. (expected since started from grub on p8
).
set prefix=(hd0,gpt5)/grub
normal
# select menuentry and press E to edit it so that it looks as follows:
setparams 'Ubuntu'
set root=(hd0,gpt5)
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
# CTRL+X to boot that
Sound and brightness keys still work in this way! (unexpected!).
Now if I instead don't open the grub terminal and directly go editing the entry, the same behaviour. So there is not some magic involved with the normal
command.
Also, not writing the set root=(hd0,gpt5)
seems to be fine.
When I run the entry as it was generated in the grub GUI on p5
, the brightness and sound do not work. So I shall now try and build that entry from the ground up. (Prepare for lots of typing)
setparams 'Ubuntu'
recordfail
load_video
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
Sound and brightness keys still work.
setparams 'Ubuntu'
recordfail
load_video
insmod gzio
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
Sound and brightness keys still work.
setparams 'Ubuntu'
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
Boots into emergency mode with "Failed to mount /boot/efi" (wrong fs type, bad option, bad superblock on /dev/nvme0n1p2 ...)
So I remove the gfxmode $linux_gfx_mode
again and continue:
setparams 'Ubuntu'
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
Sound and brightness keys still work.
setparams 'Ubuntu'
recordfail
load_video
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
else
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
fi
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
Sound and brightness keys still work.
setparams 'Ubuntu'
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
else
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
fi
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8
initrd /initrd.img-5.3.0-53-generic
I have inserted the gfxmode $linux_gfx_mode
again and it still boots well and the Sound and Brightness Keys still work.
setparams 'Ubuntu'
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
else
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
fi
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8 ro nomodeset
initrd /initrd.img-5.3.0-53-generic
And the screen brightness and Sound no longer work!
Again, without nomodeset
:
setparams 'Ubuntu'
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
else
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
fi
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8 ro
initrd /initrd.img-5.3.0-53-generic
The Sound and Brightness keys still work.
setparams 'Ubuntu'
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
else
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
fi
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8 ro acpi_backlight=video
initrd /initrd.img-5.3.0-53-generic
Sound and Brightness keys still work.
Worth noting that I only had acpi_backlight=video
there in the first place because the brightness keys were not working. And I had nomodeset
(which currently seems to be the culprit) there because it fixes hibernation. Maybe nomodeset
broke my brightness keys and sound, which I then tried to fix using acpi_backlight=video
?
So including nomodeset
again:
setparams 'Ubuntu'
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
else
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
fi
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8 ro nomodeset acpi_backlight=video
initrd /initrd.img-5.3.0-53-generic
The sound and brightness are now not working, so it is unclear to me why the brightness fix with acpi_backlight=video
worked for me last time. I applied it May 9 and the nomodeset
was already in March... perhaps I removed and re-added that some time and didn't realize the effects it had on the brightness keys.
I would prefer having one problem over having two problems, so here's again removing nomodeset acpi_backlight=video
and adding the final argument:
setparams 'Ubuntu'
recordfail
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
else
search --no-floppy --fs-uuid --set=root 81e29369-ff69-4424-858c-3489283588d7
fi
linux /vmlinuz-5.3.0-53-generic root=/dev/nvme0n1p8 ro resume=UUID=1ba104f0-35be-42f7-bf71-65e43f6fbcc3
initrd /initrd.img-5.3.0-53-generic
As expected, sound and brightness work again. I have not tested hibernation now. I assume it will either work due to the recent bios and firmware update by lenovo, or still not work in the same way as in my question about it. But that will be a different problem for a different day.
Now for the question that remains: why did it seem like it worked in the old bootloader?
Well... turns out that in most of my tests did not modify "nomodeset". But in one that you can see in the table higher above, the sound did not work with the p5
bootloader, kernel 51 from p8
, without acpi_backlight
and without nomodeset
.
I can no longer reproduce that. Perhaps I made a mistake while taking notes.