如何修复 Ubuntu 18.04 上没有声音?

How to fix No sound on Ubuntu 18.04?

1) 我已经使用 Ubuntu 18.04 和 Windows 10 双启动几个月了。今天突然我的声音停止在 Ubunutu 上工作。活动 -> 声音菜单仅显示 "Dummy Output"。不过 Windows 一切都很好。

2) lsmod 的输出是:

rohit@rohitUb18043LTS:~$ lsmod | grep snd_
snd_seq_midi           20480  0
snd_seq_midi_event     16384  1 snd_seq_midi
snd_seq                69632  2 snd_seq_midi,snd_seq_midi_event
snd_rawmidi            36864  1 snd_seq_midi
snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
snd_soc_dmic           16384  0
snd_hda_codec_realtek   118784  0
snd_hda_codec_generic    81920  1 snd_hda_codec_realtek
ledtrig_audio          16384  2 snd_hda_codec_generic,snd_hda_codec_realtek
snd_soc_hdac_hdmi      32768  0
snd_sof_intel_hda_common    73728  1 sof_pci_dev
snd_soc_hdac_hda       24576  1 snd_sof_intel_hda_common
snd_sof_intel_hda      20480  1 snd_sof_intel_hda_common
snd_sof_intel_byt      24576  1 sof_pci_dev
snd_sof_intel_ipc      20480  1 snd_sof_intel_byt
snd_sof                98304  4 snd_sof_intel_hda_common,snd_sof_intel_byt,snd_sof_intel_ipc,sof_pci_dev
snd_sof_xtensa_dsp     16384  1 sof_pci_dev
snd_hda_ext_core       28672  4 snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_sof_intel_hda
snd_soc_acpi_intel_match    32768  2 snd_sof_intel_hda_common,sof_pci_dev
snd_soc_acpi           16384  2 snd_soc_acpi_intel_match,sof_pci_dev
snd_soc_core          237568  5 snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_hdac_hda,snd_soc_dmic
snd_compress           24576  1 snd_soc_core
ac97_bus               16384  1 snd_soc_core
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_hda_codec_hdmi     57344  1
snd_hda_intel          53248  2
snd_intel_nhlt         20480  1 snd_hda_intel
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  10 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_hdmi,snd_soc_hdac_hda,snd_sof_intel_hda
snd_hwdep              20480  1 snd_hda_codec
snd_pcm               102400  10 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hdmi,snd_soc_core,snd_hda_core,snd_pcm_dmaengine
snd_timer              36864  2 snd_seq,snd_pcm
snd                    86016  17 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,snd_soc_core,snd_pcm,snd_rawmidi
rohit@rohitUb18043LTS:~$

3) 我安装了软件更新程序的所有更新,但没有成功。

4) 没有改变使用:sudo alsa force-reload

5) 环顾四周,发现了这个帖子:https://askubuntu.com/questions/1059619/sound-card-shown-as-dummy-output-in-ubuntu-18-04 . User says found the "active profile was off" and links to a solution on this forum (https://forums.linuxmint.com/viewtopic.php?t=268499)。我正在按照 link:

粘贴四个命令的输出
rohit@rohitUb18043LTS:~$ sudo fuser -v /dev/snd/*
[sudo] password for rohit: 
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  gdm        1505 F.... pulseaudio
                     rohit      1878 F.... pulseaudio
rohit@rohitUb18043LTS:~$ pacmd list-cards
1 card(s) available.
    index: 0
    name: <alsa_card.pci-0000_01_00.1>
    driver: <module-alsa-card.c>
    owner module: 7
    properties:
        alsa.card = "0"
        alsa.card_name = "HDA NVidia"
        alsa.long_card_name = "HDA NVidia at 0xb4000000 irq 17"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:01:00.1"
        sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0"
        device.bus = "pci"
        device.vendor.id = "10de"
        device.vendor.name = "NVIDIA Corporation"
        device.product.id = "0fb9"
        device.product.name = "GP107GL High Definition Audio Controller"
        device.string = "0"
        device.description = "GP107GL High Definition Audio Controller"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    profiles:
        output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5400, available: no)
        output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 300, available: no)
        output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 300, available: no)
        off: Off (priority 0, available: unknown)
    active profile: <off>
    ports:
        hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
rohit@rohitUb18043LTS:~$ pacmd list-sinks
1 sink(s) available.
  * index: 0
    name: <auto_null>
    driver: <module-null-sink.c>
    flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: SUSPENDED
    suspend cause: IDLE 
    priority: 1000
    volume: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
            balance 0,00
    base volume: 65536 / 100% / 0,00 dB
    volume steps: 65537
    muted: no
    current latency: 0,00 ms
    max request: 344 KiB
    max rewind: 344 KiB
    monitor source: 0
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 0
    linked by: 0
    configured latency: 0,00 ms; range is 0,50 .. 2000,00 ms
    module: 15
    properties:
        device.description = "Dummy Output"
        device.class = "abstract"
        device.icon_name = "audio-card"
rohit@rohitUb18043LTS:~$ pacmd list-sink-inputs
0 sink input(s) available.
rohit@rohitUb18043LTS:~$

6) 我尝试了建议的命令,但它显示 "No such profile".

rohit@rohitUb18043LTS:~$ pacmd set-card-profile alsa_card.pci-0000_01_00.1 output:analog-stereo+input:analog-stereo
No such profile: output:analog-stereo+input:analog-stereo
rohit@rohitUb18043LTS:~$

请帮忙 - 我该如何继续?

"Dummy Sound" 在 Ubuntu 18.04 上也存在与 NVIDIA 卡类似的问题。这为我解决了:

  1. 以 root 身份编辑 /etc/modprobe.d/alsa-base.conf 并添加 options snd-hda-intel dmic_detect=0
  2. 以 root 身份编辑 /etc/modprobe.d/blacklist.conf 并在文件末尾添加 blacklist snd_soc_skl
  3. 进行这些更改后,重新启动系统。

更多详细信息(和学分):https://www.linuxuprising.com/2018/06/fix-no-sound-dummy-output-issue-in.html

我也遇到了同样的问题,尝试了@maartenor给出的解决方案,没有成功。

最终我通过将 linux 内核升级到最后的 HWE stack 恢复了声音,对我来说它是 4.15.0-106-generic 5.3.0-59-通用.

执行此操作的命令:

$ sudo apt install linux-generic-hwe-18.04

编辑文件 /etc/modprobe.d/alsa-base.conf 并添加以下行:

选项snd-hda-inteldmic_detect=0

选项snd-hda-intel模型=laptop-amic启用=是

第一行是启用扬声器,第二行是启用内置麦克风。

祝你好运!

从 Reddit 得到了这个答案。对我来说就像一个魅力!

Link : https://www.reddit.com/r/linuxmint/comments/fltlrl/no_sound_on_acer_swift_3_with_kernel_53/

以下步骤非常可靠。它不会永久修复暂停后音频丢失的问题,但会立即作为从暂停返回后 运行 的命令。

使用lspci获取声卡位置(0000:00:1f.3)。在我的机器上,

$ lspci
00:1f.0 ISA bridge: Intel Corporation H110 ...
00:1f.2 Memory controller: Intel ...
00:1f.3 Audio device: Intel Corporation 100 Series/C230 Series Chipset ...
00:1f.4 SMBus: Intel Corporation 100 Series/C230 Series Chipset ...

然后,(确保以下目录存在)

$ echo 1 | sudo tee /sys/bus/pci/devices/0000:00:1f.3/remove
$ echo 1 | sudo tee /sys/bus/pci/rescan

我认为音频 driver/hardware 卡住了。所以我们删除了设备驱动程序,并重新扫描 PCI 总线以恢复音频。

试试这个..

  1. 打开终端
  2. sudo apt update && sudo apt install alsamixer
  3. 运行 终端中的 alsamixer。
  4. 按向右箭头直到转到声音选项(如果耳机转到 HEADPHONES 栏)。
  5. 按 M 取消静音。
  6. 按up/down调节音量。
  7. 按 Esc 退出 alsamixer。

我发现上面的答案在我的电脑上不起作用,我偶然解决了这个问题,这是我使用的脚本,与上面的答案大部分相同,但最后,你需要静音然后取消静音 auidio。如果您将脚本放入 sh 文件然后执行它,请在此处需要命令后休眠片刻,使用 sh -c 用于 root

的文件重定向
REST=0.5
#make sure Audio always actived
sudo sh -c 'echo 1 >/sys/bus/pci/rescan'
sleep $REST
DEVICE_ID=$(lspci -D | grep Audio | awk '{print }')
sleep $REST
sudo sh -c 'echo 1 >/sys/bus/pci/devices/0000:00:1f.3/remove'
sleep $REST
sudo sh -c 'echo 1 >/sys/bus/pci/rescan'
sleep $REST
#mute then unmute to restart audio
amixer -D pulse sset Master mute
sleep $REST
amixer -D pulse sset Master unmute