# USB ports don't work

## BlueManCZ

I have a motherboard Gigabyte Z170-D3H with a fresh Gentoo Linux installed (self-compiled kernel 4.9.6-gentoo-r1) and few USB devices connected (Flashdrive, Keyboard and Mouse). But USB ports don't work.

When I type lsblk, there is only my system disk sda.

lspci | grep USB returns:

```
00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
```

lsusb returns:

```
libusb: debug [libusb_init] created default context

libusb: debug [libusb_init] libusb v1.0.19.10903

libusb: error [op_init] could not find usbfs

unable to initialize libusb: -99
```

dmesg | grep 'USB\|usb' returns:

```
[    0.293570] ACPI: bus type USB registered

[    0.293665] usbcore: registered new interface driver usbfs

[    0.293756] usbcore: registered new interface driver hub

[    0.293850] usbcore: registered new device driver usb

[    0.987392] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

[    0.987449] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

[    0.987487] uhci_hcd: USB Universal Host Controller Interface driver

[    0.987548] usbcore: registered new interface driver usblp

[    0.987592] usbcore: registered new interface driver usb-storage

[    0.992362] usbcore: registered new interface driver usbhid

[    0.992376] usbhid: USB HID core driver

```

And usb-devices returns nothing.

----------

## khayyam

BlueManCZ ...

I don't see XHCI in dmesg so it's probably not enabled, what does the following show:

```
% if [[ -f /proc/config.gz ]]; then zgrep XHCI /proc/config.gz || grep XHCI /usr/src/linux-$(uname -r)/.config ; fi
```

HTH & best ... khay

----------

## BlueManCZ

Thanks for reply khayyam.

It doesn't show anything, because file /proc/config.gz doesn't exist.

EDIT #1

This command:

```
grep XHCI /usr/src/linux-$(uname -r)/.config
```

shows:

```
CONFIG_USB_XHCI_HCD=y

CONFIG_USB_XHCI_PCI=y

CONFIG_USB_XHCI_PLATFORM=y
```

----------

## khayyam

 *BlueManCZ wrote:*   

> It doesn't show anything, because file /proc/config.gz doesn't exist.

 

BlueManCZ ... yes, I should have used an 'else' rather than an '||' (or)

```
# if [[ -f /proc/config.gz ]]; then zgrep XHCI /proc/config.gz ; else grep XHCI /usr/src/linux-$(uname -r)/.config ; fi
```

 *BlueManCZ wrote:*   

> 
> 
> ```
> CONFIG_USB_XHCI_HCD=y
> 
> ...

 

OK, it doesn't show in the above dmesg, which I would expect it would, try greping explictly for xhci

```
# dmesg | grep -i xhci
```

best ... khay

----------

## BlueManCZ

khayyam

dmesg | grep -i xhci shows nothing.

I exported entire dmesg log to .txt file so you can use search engine in your browser.

Here is it: dmesg_log.txt

----------

## Syl20

If you can load the xhci modules manually after booting (via the modprobe command), perhaps you just need to add them into your /etc/conf.d/modules file.

----------

## Goverp

I note the date of the kernel in the dmesg output is 2nd Mar, but this thread started 11 Mar.  So perhaps a kernel updated for XHCI didn't get copied to /boot?

----------

## BlueManCZ

 *Syl20 wrote:*   

> If you can load the xhci modules manually after booting (via the modprobe command), perhaps you just need to add them into your /etc/conf.d/modules file.

 

When I try to load module manually with modprobe xhci_pci, it returns:

```
modprobe: ERROR: could not insert 'xhci_pci': Exec format error
```

 *Goverp wrote:*   

> I note the date of the kernel in the dmesg output is 2nd Mar, but this thread started 11 Mar. So perhaps a kernel updated for XHCI didn't get copied to /boot?

 

That's a good point! But why is there old date? Today I compiled new kernel according to this manual, ls -al /boot shows:

```
-rw-r--r--  1 root root  147803 Mar 13 17:27 config-4.9.6-gentoo-r1

drwxr-xr-x  2 root root    1024 Mar 13 17:27 grub

drwx------  2 root root   12288 Mar  2 11:09 lost+found

-rw-r--r--  1 root root 3211001 Mar 13 17:27 System.map-4.9.6-gentoo-r1

-rw-r--r--  1 root root 5303088 Mar 13 17:27 vmlinuz-4.9.6-gentoo-r1
```

But first lines in dmesg are:

```
[    0.000000] Linux version 4.9.6-gentoo-r1 (root@livecd) (gcc version 4.9.4 (Gentoo 4.9.4 p1.0, pie-0.6.4) ) #1 SMP Thu Mar 2 12:43:04 -00 2017

[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.9.6-gentoo-r1 root=/dev/sda4 ro
```

But ls -al /var/log/dmesg returns:

```
-rw-r----- 1 root root 51587 Mar 13 17:28 /var/log/dmesg
```

----------

## NeddySeagoon

BlueManCZ,

You forgot to mount the /boot partition before you installed the kernel.  It wan installed to the /boot directory on the root partition.

Grub won't find it there.

When /boot is not mounted, ls /boot should return nothing.

With /boot mounted, your kernels and /boot/grub will be there.

----------

