NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.3k stars 13.54k forks source link

Audio USB adapter does not work with pulseaudio #93335

Closed Mesabloo closed 4 years ago

Mesabloo commented 4 years ago

Describe the bug Running NixOS 20.03, I haven't been able to make my USB sound card adapter work. Everything seems to be correctly recognized in pavucontrol, but the sound played from the USB adapter is very very slow. It also seems to affect video playback speed on brave.

To Reproduce Steps to reproduce the behavior:

  1. Install NixOS 20.03
  2. add
    sound.enable = true;
    hardware.pulseaudio = {
      enable = true;
      support32Bit = true;
      package = pkgs.pulseaudioFull;
    };

    to your /etc/nixos/configuration.nix

  3. Plug-in a USB sound card (might be relevant to include the reference of my product)

Expected behavior The sound outputted has a normal speed and is audible.

Screenshots Working as expected when the jack is selected in pavucontrol: https://imgur.com/a/h80pTyC Not working as expected when the USB adapter is selected in pavucontrol: https://imgur.com/a/Pst09BC

Additional context On an old NixOS installation (I believe was NixOS 19.03, linux kernel 4.19), the USB sound card adapter worked as expected. I haven't been able to pinpoint exactly when (what version) it stopped working. The adapter has no problem, as it is working on Windows, on my phone, and on my old Manjaro setup (which I overwrote for NixOS) running the 5.4 linux kernel with pulseaudio. I believe this is a NixOS-only problem related to the pulseaudio package. Downgrading the linux kernel to 4.19 (this was the kernel of my old NixOS installation) does not help. Reintroducing the working configuration with channel updates (19.03 -> 20.03) make the bug appear on the previously working configuration. There are no errors regarding pulseaudio in journalctl and dmesg reports a correctly registered USB audio interface.

I include my /etc/nixos/configuration.nix cleaned (without any comments), if it can be of any help. I also include my /etc/nixos/hardware-configuration.nix. My home-manager can be found here if needed (those are the files that go in ~/.config/nixpkgs).

Metadata Result of nix-shell -p nix-info --run "nix-info -m":

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
- pulseaudio
davidak commented 4 years ago

I don't have any issues with USB sound devices.

Screenshot from 2020-07-18 06-01-55

Tested with:

Pulseaudio is enabled by Pantheon desktop using hardware.pulseaudio.enable = mkDefault true;. Maybe test with the default package?


Mesabloo commented 4 years ago

The default package neither worked for me. I tried putting the full package to see whether it would work or not, which turned out not to be the case, unfortunately.

I have been able to reproduce this on a clean NixOS 20.03 install with only KDE and the sound enabled, on my other computer. I also wanted to try directly in the graphical installer, just to see if it works, but haven't done it at the moment.

I don't think the issue comes from the adapter, as it correctly works elsewhere...

EDIT: I also included my /etc/nixos/hardware-configuration.nix in the issue just in case.

wmertens commented 4 years ago

Can you inspect the kernel logs to see if there's anything interesting? journalctl -k

Mesabloo commented 4 years ago

As far as I can see, everything seems ok regarding sound devices.

[...]
Jul 20 08:58:43 subsystem kernel: snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
Jul 20 08:58:43 subsystem kernel: snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[...]
Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC233: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0:    inputs:
Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0:      Mic=0x1b
Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1f.3/sound/card0/input24
Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input25
Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input26
Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input27
Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input28
Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input29
[...]
Jul 20 08:58:43 subsystem kernel: usbcore: registered new interface driver snd-usb-audio
Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.015:84): prog-id=57 op=LOAD
Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.015:85): prog-id=58 op=LOAD
Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.055:86): prog-id=59 op=LOAD
Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.055:87): prog-id=60 op=LOAD
Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.235:88): prog-id=61 op=LOAD
[...]

(here is the full log: https://pastebin.com/6aR6YWGy)


I also had time to test on a USB installer for NixOS 19.03. I can confirm that it works. I haven't yet tested on an installer for NixOS 20.03. UPDATE: Also tested on a USB installer for NixOS 20.03 (the graphical one), and it also works. I'll try to reinstall a basic NixOS 20.03 to see if it still works or not, and try to gather more details about my issue.

wmertens commented 4 years ago

Well, since it works in other distros, I would try comparing the full system log in NixOS and a working distro.

Wait until the system is loaded fully, then start logging, plug in the device and play a sound.

Compare these logs. Also compare versions of everything touching audio.

Wout.

On Mon., Jul. 20, 2020, 11:59 a.m. Mesabloo notifications@github.com wrote:

As far as I can see, everything seems ok regarding sound devices.

[...] Jul 20 08:58:43 subsystem kernel: snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380 Jul 20 08:58:43 subsystem kernel: snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002) [...] Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC233: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0) Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x21/0x0/0x0/0x0/0x0) Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0 Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0: inputs: Jul 20 08:58:43 subsystem kernel: snd_hda_codec_realtek hdaudioC0D0: Mic=0x1b Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH Headphone as /devices/pci0000:00/0000:00:1f.3/sound/card0/input24 Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input25 Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input26 Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input27 Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input28 Jul 20 08:58:43 subsystem kernel: input: HDA Intel PCH HDMI/DP,pcm=10 as /devices/pci0000:00/0000:00:1f.3/sound/card0/input29 [...] Jul 20 08:58:43 subsystem kernel: usbcore: registered new interface driver snd-usb-audio Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.015:84): prog-id=57 op=LOAD Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.015:85): prog-id=58 op=LOAD Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.055:86): prog-id=59 op=LOAD Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.055:87): prog-id=60 op=LOAD Jul 20 08:58:43 subsystem kernel: audit: type=1334 audit(1595228323.235:88): prog-id=61 op=LOAD [...]

(here is the full log: https://pastebin.com/6aR6YWGy)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/NixOS/nixpkgs/issues/93335#issuecomment-660930766, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANNFUOQEW2SMEM67XEXFDR4QIRTANCNFSM4O52P7BQ .

Mesabloo commented 4 years ago

I ended up doing a clean install of two NixOS. One for my main computer, and one for my other computer.

I tried creating new users (instead of the basic mesabloo one I always create) and the audio worked correctly through the USB adapter on the first installation (the other computer). The second installation is done (need to reinstall my entire working environment) and the audio also seems to work flawlessly through the USB adapter.

I'm wondering whether I had some file in my home folder that caused pulseaudio to not work correctly or something, but I absolutely have no clue at this point. I'll reinstall my working environment, switch back to my old account name (praying for it not to be cursed) and see if it still works. If yes, I will close this issue as the problem is not happening anymore. However I don't know why it was happening in the first place.

Mesabloo commented 4 years ago

Everything finished downloading. I had a little bit of trouble with one thing, but it is kinda solved, and unrelated to this issue. On the other hand, my USB adapter correctly picks the audio now. I have yet to test my microphone but I believe it will work just as good.

I still have no clue on what may have caused this issue. Probably some leftover files from my old Linux installations. But I can't seem to understand how those might have influenced the new system that much (I am even more perplex as I tried to move only the config that wasn't working and it made the same problem on another problem). Every is a bit weird, but in the end it works. As said earlier this day, I'm closing this issue because the problem is solved.

Thanks everyone for your time. :smile: