# usb devices only recognized at boot

## alander

Hi

I have a problem with a freshly installed Gentoo system, usb devices is only recognized during boot. When I insert a usb stick or usb keyboard after the boot process, it is not recognized by the system, not a single line in dmesg. However if it is inserted before boot it is recognized and perfectly usable. If I then pull the plug it is not possible to reinsert the device and get it working again.

My system is almost straigt from the handbook, and I have tried with kernels 2.6.38-r6, 2.6.39-r3 and 3.0.3 without any difference. Everything is compiled into the kernel, no modules. The output from lspci shows the uhci and echi controllers, dmesg without any usb inserted seems ok, and dmesg with a stick inserted at boot seems good as well.

I have also tried to compile the kernel without any acpi support, but it doesn't help either.

Help needed!

----------

## DawgG

you probably have no support for hotplug in your kernel; check with

```
zcat /proc/config.gz | grep -iE 'hot|plug'
```

it should show  sth. like

```
CONFIG_HOTPLUG=y

CONFIG_TICK_ONESHOT=y

# CONFIG_MEMORY_HOTPLUG is not set

# CONFIG_HOTPLUG_CPU is not set

CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y

# CONFIG_HOTPLUG_PCI is not set

CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"

# CONFIG_USB_STORAGE_JUMPSHOT is not set
```

the first line is the most important (obviously you don't need memory hotplug etc.)

if not, enable it and recompile.

GOOD LUCK!

----------

## alander

Thanks for your reply! However, it seems like I have hotplug support enabled. Running grep -iE 'hot|plug' gives:

```
CONFIG_HOTPLUG=y

CONFIG_TICK_ONESHOT=y

CONFIG_HOTPLUG_CPU=y

CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y

CONFIG_ACPI_HOTPLUG_CPU=y

# CONFIG_HOTPLUG_PCI_PCIE is not set

CONFIG_HOTPLUG_PCI=y

# CONFIG_HOTPLUG_PCI_FAKE is not set

# CONFIG_HOTPLUG_PCI_COMPAQ is not set

CONFIG_HOTPLUG_PCI_IBM=y

# CONFIG_HOTPLUG_PCI_ACPI is not set

# CONFIG_HOTPLUG_PCI_CPCI is not set

# CONFIG_HOTPLUG_PCI_SHPC is not set

CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"

# CONFIG_USB_STORAGE_JUMPSHOT is not set

```

Any more ideas?

----------

## alander

I just thought about another clue, when I try to use the Gentoo minimal install cd, the usb keyboard works fine to enter the kernel options but then dies. I have 3 identical computers from ibm and they all behave the same way. In win xp it works just fine, and ubuntu has no problems either.

This is driving me crazy...

----------

## alander

Ok, some more info:

I tried compiling ehci and uhci as modules, and when only load uhci everything works just fine, the memory is recognized by udev and mounting works ok. As soon as I try having ehci loaded, with or without uhci, the problem is the same as earlier. Does this imply there is a bug in the ehci source code?

----------

## Thistled

I always build ehci and uhci into the kernel and they are there from boot, so to speak. If you are building them as modules, then that might also explain your problem.

It might be worthwhile having a look at udev.

I am using udev-164-r2 and all is fine, and I am sure it can't be a bug with the uhci or ehci source, as there would be a lot of posts on here if it were.

Any similar problems I have had in the past, was due to an incorrect Xorg set up. evdev etc etc.

Just some ideas.

----------

## alander

 *Thistled wrote:*   

> I always build ehci and uhci into the kernel and they are there from boot, so to speak. If you are building them as modules, then that might also explain your problem.
> 
> 

 

I've always prefered using drivers compiled into the kernel, but since this approach caused the initial problem I tried to compile them as modules instead. By not having ehci loaded the memory stick is running perfectly except from beeing in usb 1.1 mode.

 *Thistled wrote:*   

> It might be worthwhile having a look at udev.
> 
> 

 

Any ideas on what to look for?

 *Thistled wrote:*   

> I am using udev-164-r2 and all is fine, and I am sure it can't be a bug with the uhci or ehci source, as there would be a lot of posts on here if it were.
> 
> 

 

I agree, but since my hardware is not brand new I thoght I might be the only one... The Gentoo installtion is fresh, so no outdated packages on the system,

 *Thistled wrote:*   

> Any similar problems I have had in the past, was due to an incorrect Xorg set up. evdev etc etc.
> 
> 

 

But I have not gone that far on this machine, I just have a nice console right now, you shouldn't need Xorg to get a usb stick to be recognized... 

Anyway, thanks for the ideas, all help is appreciated!

----------

## Thistled

 *Thistled wrote:*   

> I am using udev-164-r2 and all is fine, and I am sure it can't be a bug with the uhci or ehci source, as there would be a lot of posts on here if it were.
> 
> 

 

 *alander wrote:*   

> I agree, but since my hardware is not brand new I thoght I might be the only one... The Gentoo installtion is fresh, so no outdated packages on the system,

 

If you're hardware is not brand new, then try loading the "oldest" udev and take it from there.

Although I don't think the age of your hardware is relevant. I have an old server which is at least 8 years old, and I am running the latest kernel, libraries etc. All is good.

Forgive me, as I don't intend to insult your intelligence, and I am not sure if your are Gentoo savvy or starting out, but is udev loaded in your "sysinit" runlevel?

```
rc-status -a
```

It may also sound crazy, but my partner had a very similar problem with Arch Linux, and it was resolved by enabling legacy USB support in the bios. Sounds bonkers I know, but the symptoms were the exact same, had use of keyboard at grub, but not once init had kicked in. I was left scratching my head with that one, as something had changed the setting in BIOS. WTF?

----------

## alander

I've been running Gentoo for about ten years, but never messed about with usb. Anyway, I'm not offended, only happy for all help! To answer your question, yes udev is in sysinit.

The bios is no good for advanced usb settings, the only thing I can do is enable and disable front and back ports.

----------

## cach0rr0

 *Thistled wrote:*   

> Sounds bonkers I know, but the symptoms were the exact same, had use of keyboard at grub, but not once init had kicked in. I was left scratching my head with that one, as something had changed the setting in BIOS. WTF?

 

I've been bitten by this one. For me, it was because I actually needed *ohci* rather than uhci

I have ohci and ehci as built-ins, the former what seemed to be the magic bullet (nb: i dont have uhci included at all)

----------

## alander

I just don't get why it isn't working! I've tried the ohci way, but no usb 1.1 hubs show up in lsusb, and ehci is still not working.

I've tried compiling the kernel with the config file from ubuntu, but I don't see any difference. Ubuntu has no problems with my ehci whatsoever. What is that makes uhci work but not ehci???

----------

## Thistled

I'm not entirely sure if it is a good idea to use the kernel config file from Ubuntu, as I'm sure the gentoo-sources is patched for gentoo. I may be wrong, but it might be wise to just stick with the gentoo-sources kernel config. HOWEVER - I could be completely WRONG.   :Embarassed: 

How about enabling everything with regards to usb in the kernel config?

Worthwhile checking "USB Mass Storage Support" is enabled within USB Support also? (although, please forgive me if you have done this already)

I get the feeling it is something you have missed from the kernel config, but what, I do not know.

Does it all work when you load the live cd?

----------

## VoidMage

 :Rolling Eyes:  gentoo kernel patches don't have much of effect on .config these days - basically, it's just fbcondecor patch lately.

----------

## alander

Well, trying the Ubuntu kernel config was a just a desperate try. Since it didn't make any difference for my usb problem I have returned to the gentoo sources and my original config file. At least I know that I have not missed any option in the kernel. Belive me, in the last few weeks I have compiled more kernels than I have done during the last 10 years, trying every possible (and impossible) config. And yes, the mass storage support is compiled in alright.

I have not tried the live cd, but numerous editions of the minimal install cd does not work properly. They all work perfectly with my usb keyboard up to the point where I enter the kernel options. But once prompted for the keyboard layout the keyboard is dead, I have tried all possible kernel options without any luck.Last edited by alander on Tue Sep 13, 2011 9:15 am; edited 1 time in total

----------

## DirtyHairy

If the USB keyboard only works in the boot loader and stops working after the kernel has started, my suspicion is that USB is not working _at all_ on the minimal CDs --- in the boot loader, it is handled by the bios emulation layer.

----------

## alander

It is at least nice to know that the minimal install cds can't handle my usb ports either, then it's just not me being stupid... I do wonder what Ubuntu has done to make it work.

----------

