Morning silence and broken drivers
Tags: linux, ubuntu
Published: 2020-06-14 11:36:25

---
title: Morning silence and broken drivers
published: true
description: Waking up to a driver issue.
tags: linux, ubuntu
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/b3e61yjjh6mdshgiw88e.png
---

# 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.

```bash
✦ ➜ 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
...
```

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](https://github.com/geoffreybennett/scarlett-gen2/releases). 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`.

```plaintext
options snd_usb_audio device_setup=1,1,1,1
options snd_usb_audio vid=0x1235 pid=0x8212 device_setup=1
```

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:

```plaintext
New USB device found, idVendor=1235, idProduct=8203, bcdDevice= 6.2f
```
`vid` is probably the Vendor ID and `pid` product ID. I had a quick look at the [commit for that release](https://github.com/geoffreybennett/scarlett-gen2/commit/63693795498192ca1142aca4a829a1276a1c76b9) and that clarified it. There are a number of constants defined in [sound/usb/mixer_quirks.c](https://github.com/geoffreybennett/scarlett-gen2/blob/63693795498192ca1142aca4a829a1276a1c76b9/sound/usb/mixer_quirks.c).

```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 */
```
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`.
```plaintext
options snd_usb_audio vid=0x1235 pid=0x8203 device_setup=1
```

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

```bash
✦ ➜ modprobe -c | grep snd_usb_audio | grep options
options snd_usb_audio vid=0x1235 pid=0x8203 device_setup=1
```
Still no sound... 

# Still silence
Now what?  Some more googling around brought me to [this forum thread](https://linuxmusicians.com/viewtopic.php?f=6&t=19975&start=30). 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?

```bash 
➜ uname -r
5.4.0-37-generic
```
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. 

```bash
➜ 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 config
➜ cp /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 modules
➜ sudo make modules_install
...

# Install the kernel
➜ sudo make install
...
```
`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. 
```bash
[  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
```

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/mzd7y6lef23xtyd1vm1j.png)


Purge them and flip back to noveau for now:

```bash
➜ 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
```

Much better:
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/irt9crchbspnlkf8ig96.png)

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](https://dev-to-uploads.s3.amazonaws.com/i/3th7jjskezo7qs17qvs8.png) 

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

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cx6rye29y7ejo2c6vvl4.png)

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.