# Fixing a kernel panic

## grant123

I'm using a Gigabyte Brix 2807 and it works perfectly except for compatibility with a particular USB sound card.  I've read that Arch Linux does work with this sound card so I thought I would try the Arch kernel config on gentoo-sources to see if the sound card problem is a kernel config issue.  I copied the Arch config in and compiled and installed the kernel but it panics right away when it tries to boot.  I've compared the booting config to the non-booting Arch config and I don't see the issue.

Any ideas on narrowing down the cause of the kernel panic?

----------

## alamahant

In kernel config 

```

CONFIG_MODULE_COMPRESS=n

```

and recompile...

Since you will be recompiling a big kernel throw this also in the mix

```

CONFIG_DEBUG_INFO=n

```

It will save you from a 12 gigs kernel tree and a big directory in /lib/modules

----------

## grant123

Thank you.  Recompiling now and will report back.

----------

## grant123

It still panics right away.  Here are the first three lines of output:

x86/cpu: VMX (outside TXT) disabled by BIOS

ehci-pci port 1 reset error

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block

----------

## alamahant

Did you "make install" and update grub?

----------

## grant123

Yep I always 'make && make modules_install' and I copied it over the previous non-booting kernel in /boot so nothing to update in grub this time.

----------

## alamahant

Then iyou should check default-grub and fstab..You can not not boot with a full kernel compiled...

----------

## grant123

Do you mean /etc/default/grub?  That file is essentially empty here.

I haven't touched fstab and it does boot fine with the kernel config I normally use.  /boot is on /dev/sda1.  Is there a kernel config that would change that to something else?

----------

## alamahant

Are you trying to boot from a usb disk?

This looks worrisome

```

ehci-pci port 1 reset error

```

Do you have multiple disks?

Is it uefi?

degault-grub should not be empty.

It should contain at least somethong like "root=<> rootfstype=<>" in linux line.

Do you use an initrd?

Can you post the output of /boot/grub/grub.cfg and fstab?

But if you were booting before but not now with a full .config something strange is going on...

Probably some error in building and installing the kernel...

Did you run 

make clean

make mrproper

before recompiling?

----------

## Buffoon

 *Quote:*   

> Unable to mount root fs on unknown-block ...

 

Vital information is missing here, this is kernel telling you why it cannot boot, (0,0) would mean HDD controller has no driver for instance. This Arch kernel business does not make much sense, why don't you boot from some CD, Arch will do well, and look what driver is loaded for your sound codec chip, and then enable it in your kernel.

----------

## grant123

 *alamahant wrote:*   

> Are you trying to boot from a usb disk?

 

No.

 *alamahant wrote:*   

> This looks worrisome
> 
> ```
> 
> ehci-pci port 1 reset error
> ...

 

A search turned up that this could be due to a BIOS option but it shouldn't interrupt booting.

 *alamahant wrote:*   

> Do you have multiple disks?

 

1 disk only.

 *alamahant wrote:*   

> Is it uefi?

 

No.

 *alamahant wrote:*   

> degault-grub should not be empty.
> 
> It should contain at least somethong like "root=<> rootfstype=<>" in linux line.

 

I think we're talking about different files.  Which file are you referring to specifically?

 *alamahant wrote:*   

> Do you use an initrd?

 

No.

 *alamahant wrote:*   

> Can you post the output of /boot/grub/grub.cfg and fstab?
> 
> But if you were booting before but not now with a full .config something strange is going on...

 

Exactly.

 *alamahant wrote:*   

> Probably some error in building and installing the kernel...
> 
> Did you run 
> 
> make clean
> ...

 

No but I'll try that now.

----------

## grant123

 *Buffoon wrote:*   

>  *Quote:*   Unable to mount root fs on unknown-block ... 
> 
> Vital information is missing here, this is kernel telling you why it cannot boot, (0,0) would mean HDD controller has no driver for instance.

 

Ah it says "Unable to mount root fs on unknown-block(8,2)" which can't be right.  Is that defined in the kernel somewhere?

 *Buffoon wrote:*   

> This Arch kernel business does not make much sense, why don't you boot from some CD, Arch will do well, and look what driver is loaded for your sound codec chip, and then enable it in your kernel.

 

I have the correct driver so hoping the problem is another kernel config option:

https://forums.gentoo.org/viewtopic-t-1134018-highlight-.html

FWIW this is the Arch kernel config I'm using:

https://raw.githubusercontent.com/archlinux/svntogit-packages/packages/linux/trunk/config

----------

## NeddySeagoon

grant123,

unknown-block(8,2) means /dev/sda2

The kernel can see  /dev/sda2 but cannot mount it.

Either the filesystem is not available in the kernel or /dev/sda2 is the wrong thing to try to mount.

Above that unknown-block(8,2) message should be a list of filesystems that the kernel tried.

```
CONFIG_EXT4_FS=m
```

All the filesystems are configured  as modules. You will need a matching initrd to make that work.

----------

## grant123

Ok I'll try building ext4 into the kernel instead of as a module.

----------

## grant123

I got it booting with these kernel config changes:

CONFIG_DEBUG_INFO_BTF (Y -> N)

CONFIG_MODULE_COMPRESS (Y -> N)

CONFIG_EXT2_FS (N -> Y)

CONFIG_EXT4_FS (M -> Y)

But this USB sound card still doesn't work.  It was said to work on Arch a few years ago so I'm surprised:

https://www.raspberrypi.org/forums/viewtopic.php?t=203765#p1267992

https://theartofsound.net/forum/showthread.php?41300-Rasp-Pi-2-M2tech-Hiface-1-Anyone-tried&p=699255#post699255

The maker of the sound card says it works on this Linux-based RaspberryPi OS today (I'm not using a RaspberryPi):

https://www.max2play.com/en/

I'm sure I'm using the correct driver in the kernel (snd_usb_hiface).  Now I'm thinking it very likely isn't a kernel config issue since I tried the Arch config and Arch is said to work.  What other types of differences could be making it work in the Max2Play OS above?

----------

## alamahant

Since yiy are using arch kernel .config you must have something like these

```

CONFIG_SND_USB=y

CONFIG_SND_USB_AUDIO=m

CONFIG_SND_USB_AUDIO_USE_MEDIA_CONTROLLER=y

CONFIG_SND_USB_UA101=m

CONFIG_SND_USB_USX2Y=m

CONFIG_SND_USB_CAIAQ=m

CONFIG_SND_USB_CAIAQ_INPUT=y

CONFIG_SND_USB_US122L=m

CONFIG_SND_USB_6FIRE=m

CONFIG_SND_USB_HIFACE=m

CONFIG_SND_USB_LINE6=m

CONFIG_SND_USB_POD=m

CONFIG_SND_USB_PODHD=m

CONFIG_SND_USB_TONEPORT=m

CONFIG_SND_USB_VARIAX=m

```

no?

but since no initrd then maybe turn the appropriate ones to  "y"

EDIT:not needed in built since not required for booting.My bad.sorry......

 :Smile: 

----------

## grant123

I've just switched all of those to y and will report back once it's compiled.

I will say that it does seem to pick up the correct driver and everything seems fine except no sound.  I'm supposed to unmute it before it will work but alsamixer reports no controls which I'm guessing is the root of the problem.  The only indication that there's a problem besides no sound is "config 0 descriptor??" in dmesg.

# dmesg

...

usb 1-2: new high-speed USB device number 14 using xhci_hcd

usb 1-2: device descriptor read/64, error -71

usb 1-2: New USB device found, idVendor=249c, idProduct=9006, bcdDevice= 0.01

usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0

usb 1-2: Product: Computer Audio Design

usb 1-2: Manufacturer: Computer Audio Design

usb 1-2: config 0 descriptor??

# lsusb

...

Bus 001 Device 012: ID 249c:9006 M2Tech s.r.l. Computer Audio Design

...

# cat /proc/asound/cards

...

1 [CAD ]: snd-usb-hiface - CAD

CAD at usb-0000:00:14.0-2

The weird thing is it works in Linux-based OSes like max2play.com.  Not sure how to narrow that down.

----------

## alamahant

Maybe for testing purposes try with pulseaudio and pavucontrol.

----------

## NeddySeagoon

grant123,

The kernel should auto load the module when it spots that the device is connected.

Unplug the device. Wait 10 sec then plug it in.

Does hiface appear in lsmod?

Look at the end of dmesg. It should tell all about what happened when the device was connected. Post that here.

-- edit --

```
/usr/src/linux $ grep -R 9006 ./
```

includes

```
./sound/usb/hiface/chip.c:      USB_DEVICE(0x249c, 0x9006)
```

in the output, so the kernel knows about your device.

The kernel says ...

```
config SND_USB_HIFACE

        tristate "M2Tech hiFace USB-SPDIF driver"

        select SND_PCM

        help

          Select this option to include support for M2Tech hiFace USB-SPDIF

          interface.

          This driver supports the original M2Tech hiFace and some other

          compatible devices. The supported products are:

            * M2Tech Young

            * M2Tech hiFace

            * M2Tech North Star

            * M2Tech W4S Young

            * M2Tech Corrson

            * M2Tech AUDIA

            * M2Tech SL Audio

            * M2Tech Empirical

            * M2Tech Rockna

            * M2Tech Pathos

            * M2Tech Metronome

            * M2Tech CAD

            * M2Tech Audio Esclusive

            * M2Tech Rotel

            * M2Tech Eeaudio

            * The Chord Company CHORD

            * AVA Group A/S Vitus

          To compile this driver as a module, choose M here: the module

          will be called snd-usb-hiface.

```

If it all works, you will have an extra sound card in /proc/asound/devices which will not be the default sound card, so alsa will need some canfiguration so that everything just works.

----------

## alamahant

Actually the above configs can be as modules.Not necessary to build them into the kernel,since you do not need them for booting.So please forgive my mistake.

----------

## grant123

Here's what I get:

```
# dmesg

...

[  147.871135] usb 2-4: USB disconnect, device number 3

[  159.932918] usb 2-4: new high-speed USB device number 4 using xhci_hcd

[  160.073694] usb 2-4: New USB device found, idVendor=249c, idProduct=9006, bcdDevice= 0.01

[  160.073714] usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0

[  160.073726] usb 2-4: Product: Computer Audio Design

[  160.073738] usb 2-4: Manufacturer: Computer Audio Design

[  160.074232] usb 2-4: config 0 descriptor??
```

```
# lsmod | grep hiface

snd_usb_hiface         28672  0

snd_pcm               147456  2 snd_usb_hiface,snd_hdmi_lpe_audio

snd                   114688  4 snd_usb_hiface,snd_timer,snd_hdmi_lpe_audio,snd_pcm
```

```
# cat /proc/asound/devices

  2: [ 0- 0]: digital audio playback

  3: [ 0- 1]: digital audio playback

  4: [ 0]   : control

  5: [ 1- 0]: digital audio playback

  6: [ 1]   : control

 33:        : timer
```

I've changed mpd from device "hw:0,0" to "hw:1,0" but the behavior is the same as with my regular (non-Arch) kernel config which only includes support for the single USB sound card.  mpd thinks it's playing and the progress bar proceeds across the screen as if it were playing but there is no sound as if it were muted.

----------

## grant123

Time for giving up?

----------

## NeddySeagoon

grant123,

I don't know what that means.  

If it works in linux anywhere it can be made to work in Gentoo to. We just don't know how yet

Some things to try. Sound devices are usually USB1 or USB2. USB2 to USB1 backward compatibility is a mess, it was added in a limited way as an afterthought, so its hardware dependend. USB3 backward compatibility wan designed in from the outset but its not 100% either.

Connect your device, and any other devices that you want to connect at the same time. Wait 10 sec for the USB to settle.

Now put 

```
lsusb -vvv
```

onto a pastebin. You need to run lsusb there as root or some information will not appear.

Also pastebin your entire kernel .config file.

----------

## grant123

After changing the above kernel options to Y from M the behavior is a little different.  Now nothing happens when I click the play button for mpd instead of it thinking it's playing.  Changing the default sound card in /etc/asound.conf as follows also causes youtube.com to hang when it tries to play something:

```
pcm.!default {

       type hw

       card 1

       device 0

}
```

I'm going to remove support for the PCI sound card from the kernel so that the USB sound card is the only one detected to avoid confusion.  In the meantime here is the info requested:

lsusb:

https://pastebin.ubuntu.com/p/2ncs8TJ7Vh/

.config:

https://pastebin.ubuntu.com/p/7mCVkDrWyK/

Let me know if anything else would be helpful.

----------

## grant123

The USB sound card is the only one detected by the system now but still no sound from mpd or youtube via "hw:0,0".

----------

## NeddySeagoon

grant123,

I downloaded your lsusb to a file called grant123.

```
$ grep Bus grant123 | sort

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 002: ID 060b:0540 Solid Year DeltaCo TB-106U Keyboard

Bus 002 Device 003: ID 249c:9006 M2Tech s.r.l. Computer Audio Design

Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
```

You have three USB buses. 2 USB2 and one USB3 but USB3 can pretend to be USB2, too, so it could be the other way round.

```
 $ grep -e Bus -e MaxPow grant123 

Bus 002 Device 003: ID 249c:9006 M2Tech s.r.l. Computer Audio Design

    MaxPower              100mA

  (Bus Powered)

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    MaxPower                0mA

Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

    MaxPower                0mA

Bus 002 Device 002: ID 060b:0540 Solid Year DeltaCo TB-106U Keyboard

      (Bus Powered)

    MaxPower              100mA

  (Bus Powered)

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

    MaxPower                0mA
```

Your bus power loading is within limits too. USB bus power overload can case some odd behaviour.

The kernel looks good too.

----------

## grant123

It sounds like everything checks out.  Are there some files I should try moving from the max2play OS to Gentoo?

----------

## NeddySeagoon

grant123,

What appears in the max2play OS dmesg and in its 

```
lsusb -vvv
```

Does  max2play OS have some kernel patches that Gentoo does not?

If max2play OS has a /proc/config.gz, ungzip it and put it onto a pastbin. We may learn something from comparing kernels.

We could put the max2play OS kernel under your Gentoo install. That may help determine if its a kernel or userland issue.

 *https://www.max2play.com/en/max2play-image/ wrote:*   

> 
> 
> Max2Play for the Raspberry Pi based on the official Raspbian Debian image.

 

Ah, I know that kernel as I use the 64 bit version on Pi4. As that's arm or arm64 the code won't go very well on amd64.

----------

