DEV Community

Cover image for Morning silence and broken drivers
wayofthepie
wayofthepie

Posted on

Morning silence and broken drivers

Silence

I woke up this morning and booted my desktop. No sound! Some digging around and I noticed dmesg spitting out an error. I don't have that message saved but here are the details from the kernel logs.

✦ ➜ journalctl --system --since yesterday | grep "Focusrite Scarlett" -C10
...
Jun 14 06:45:59 sky kernel: usb 1-1.2.3: USB disconnect, device number 8
Jun 14 06:46:00 sky kernel: usb 1-1.2.3: new high-speed USB device number 9 using ehci-pci
Jun 14 06:46:00 sky kernel: usb 1-1.2.3: New USB device found, idVendor=1235, idProduct=8203, bcdDevice= 6.2f
Jun 14 06:46:00 sky kernel: usb 1-1.2.3: New USB device strings: Mfr=1, Product=3, SerialNumber=2
Jun 14 06:46:00 sky kernel: usb 1-1.2.3: Product: Scarlett 6i6 USB
Jun 14 06:46:00 sky kernel: usb 1-1.2.3: Manufacturer: Focusrite
Jun 14 06:46:00 sky kernel: usb 1-1.2.3: SerialNumber: 00009810
Jun 14 06:46:00 sky kernel: usb 1-1.2.3: Focusrite Scarlett Gen 2 Mixer Driver disabled; use options snd_usb_audio device_setup=1 to enable and report any issues to g@b4.v
...
Enter fullscreen mode Exit fullscreen mode

It looks like a driver update in the latest kernel broke my USB audio device, a pretty old Focusrite Scarlett. A quick google of the error brings you to these release notes. This is a fork of the kernel where the Focusrite Scarlett driver development happens. They mention adding one of the following lines to /etc/modprobe.d/scarlett.conf.

options snd_usb_audio device_setup=1,1,1,1
options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1
Enter fullscreen mode Exit fullscreen mode

Great! I'm not sure what vid and pid are. However, if you look back up at the kernel logs there is a line that looks like this:

New USB device found, idVendor=1235, idProduct=8203, bcdDevice= 6.2f
Enter fullscreen mode Exit fullscreen mode

vid is probably the Vendor ID and pid product ID. I had a quick look at the commit for that release and that clarified it. There are a number of constants defined in sound/usb/mixer_quirks.c.

    case USB_ID(0x1235, 0x8203): /* Focusrite Scarlett 6i6 2nd Gen */
    case USB_ID(0x1235, 0x8204): /* Focusrite Scarlett 18i8 2nd Gen */
    case USB_ID(0x1235, 0x8201): /* Focusrite Scarlett 18i20 2nd Gen */
    case USB_ID(0x1235, 0x8212): /* Focusrite Scarlett 4i4 3rd Gen */
    case USB_ID(0x1235, 0x8213): /* Focusrite Scarlett 8i6 3rd Gen */
Enter fullscreen mode Exit fullscreen mode

The kernel logs have idProduct=8203, this matches the constant with the comment for the Focusrite Scarlett 6i6 2nd Gen, which is the device I have. Great, so now we know what vid and pid should be. Add this to /etc/modprobe.d/scarlett.conf.

options snd_usb_audio vid=0x1235 pid=0x8203 device_setup=1
Enter fullscreen mode Exit fullscreen mode

Run sudo systemctl restart systemd-modules-load.service to reload the kernel modules. Check they are loaded:

✦ ➜ modprobe -c | grep snd_usb_audio | grep options
options snd_usb_audio vid=0x1235 pid=0x8203 device_setup=1
Enter fullscreen mode Exit fullscreen mode

Still no sound...

Still silence

Now what? Some more googling around brought me to this forum thread. There is some discussion about the issue there, luckily the author of the driver is also posting! In one of the comments they mention:

Please upgrade to 5.4.1 first; there are known issues with the 6i6 support in 5.4.0 and it won't work very well even after you enable it.

What version of the kernel am I on?

uname -r
5.4.0-37-generic
Enter fullscreen mode Exit fullscreen mode

Ah! A likely suspect. Let's compile a custom kernel, say the latest 5.4.x kernel. It's been a while since I've done this.

➜ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.46.tar.xz

➜ wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.46.tar.sign

➜ unxz linux-5.4.46.tar.xz

# I haven't stored the public keys for linus/greg on this machine yet
➜ gpg --locate-keys torvalds@kernel.org gregkh@kernel.org
gpg: WARNING: unacceptable HTTP redirect from server was cleaned up
gpg: key 38DBBDC86092693E: public key "Greg Kroah-Hartman <gregkh@kernel.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1
gpg: WARNING: unacceptable HTTP redirect from server was cleaned up
gpg: key 79BE3E4300411886: public key "Linus Torvalds <torvalds@kernel.org>" imported
gpg: Total number processed: 1
gpg:               imported: 1
pub   rsa4096 2011-09-23 [SC]
      647F28654894E3BD457199BE38DBBDC86092693E
uid           [ unknown] Greg Kroah-Hartman <gregkh@kernel.org>
sub   rsa4096 2011-09-23 [E]

pub   rsa2048 2011-09-20 [SC]
      ABAF11C65A2970B130ABE3C479BE3E4300411886
uid           [ unknown] Linus Torvalds <torvalds@kernel.org>
sub   rsa2048 2011-09-20 [E]

# Verify the signature, can ignore the warning I just haven't trusted
➜ gpg --verify linux-5.4.46.tar.sign
gpg: assuming signed data in 'linux-5.4.46.tar'
gpg: Signature made Wed 10 Jun 2020 19:25:28 IST
gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
gpg: Good signature from "Greg Kroah-Hartman <gregkh@kernel.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 647F 2865 4894 E3BD 4571  99BE 38DB BDC8 6092 693E

# I haven't trusted the key so I got a warning, to do so
➜ gpg --tofu-policy good 647F28654894E3BD457199BE38DBBDC86092693E
gpg: Setting TOFU trust policy for new binding <key: 647F28654894E3BD457199BE38DBBDC86092693E, user id: Greg Kroah-Hartman <gregkh@kernel.org>> to good.

➜ gpg --trust-model tofu --verify linux-5.4.46.tar.sign
gpg: assuming signed data in 'linux-5.4.46.tar'
gpg: Signature made Wed 10 Jun 2020 19:25:28 IST
gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
gpg: Good signature from "Greg Kroah-Hartman <gregkh@kernel.org>" [full]
gpg: gregkh@kernel.org: Verified 1 signatures in the past 0 seconds.  Encrypted
     0 messages.

➜ tar xf linux-5.4.46.tar
➜ cd linux-5.4.46/

# Copy the current kernels configcp /boot/config-$(uname -r) .config

# Once menuconfig loads just save and exit, no need to change anything
➜ make menuconfig

# This can take a while...time make -j12
  HOSTCC  scripts/basic/fixdep
  DESCEND  objtool
...

# Install the modulessudo make modules_install
...

# Install the kernelsudo make install
...
Enter fullscreen mode Exit fullscreen mode

make install should setup the boot config needed in grub, I just need to reboot now. Reboot... and nothing!

Silence and broken graphics

This time dmesg is giving a different error.

[  159.097340] usb 1-1.1: Product: Scarlett 6i6 USB
[  159.097343] usb 1-1.1: Manufacturer: Focusrite
[  159.097344] usb 1-1.1: SerialNumber: 00009810
[  164.318711] usb 1-1.1: Scarlett Gen 2 USB response result cmd 0 was -110
Enter fullscreen mode Exit fullscreen mode

On top of that, I broke the nvidia drivers 😄 these need to be compiled for the kernel you are on. This is my lovely 1440p display:

Alt Text

Purge them and flip back to noveau for now:

sudo apt-get remove --purge nvidia-*
➜ reboot
➜ lshw -c video
  *-display
       description: VGA compatible controller
       product: GP102 [GeForce GTX 1080 Ti]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: vga_controller bus_master cap_list rom
       configuration: driver=nouveau latency=0 # running noveau drivers now
       resources: irq:73 memory:fa000000-faffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:c0000-dffff
Enter fullscreen mode Exit fullscreen mode

Much better:
Alt Text

Back to the dmesg error - Scarlett Gen 2 USB response result cmd 0 was -110. Looking at alsamixer this shows it is not recognizing the device properly.
Alt Text

I wonder if it is the USB port I'm using... It is! Using a different port:

Alt Text

I get the expected "Front left", "Front center" sound output when running speaker-test -t wav -c 6. This is weird, as other devices work fine on that port and it was previously working there too. Something else to investigate another time I guess.

Conclusion

In the end there were a number of issues. This is the first time a driver issue has caused me trouble on linux in years. But my hardware is getting old, it's probably time to upgrade a few things. Also:

  • Don't try to debug and fix an issue when you have just woken up and have had no caffeine injected into your system yet.
  • All computers are broken.

Latest comments (1)

Collapse
 
wayofthepie profile image
wayofthepie

Not long after writing this I stumbled on this page people.canonical.com/~kernel/info/.... It maps ubuntu kernel versions to actual kernel versions. It turns out the kernel version I was using was 5.4.41! See this image, the ubuntu kernel version was 5.4.0-37.

Ubuntu kernel version map for ubuntu 20.04

I reverted to this kernel and all is well! So this was likely caused by an issue in the bad USB port, which means it is possibly another driver at fault. I might investigate this if I have time, it's interesting.