# USB broken? Binary updates broken?



## donallen (Jan 20, 2010)

I tried FreeBSD a year or so ago and abandoned it after it was clear that the USB layer was hopeless (I do my backups to SATA disks in USB shoeboxes). So, the arrival of release 8, with its re-written USB layer, was an invitation to give it another try. Unfortunately, I think things are still broken in USB-land, differently.

A bit of context: I have an HP desktop (AMD dual-core Athlon, 2 Gb of memory, 320 Gb SATA drive) and a Lenovo S10 workstation (Intel quad-core, 4 Gb of memory, 2 146 Gb SAS disks on an LSI raid card setup in a raid 0 array). The two machines share usb keyboard, usb mouse, monitor, sound equipment, and a usb hub via a Raritan KVM. The USB backup disks are plugged into the hub. I run OpenBSD on the HP machine and I was running FreeBSD on the workstation (that machine is used for intensive database work and I was concerned about possible performance issues with OpenBSD and its coarse-grained locking approach to SMP, otherwise I'd run OpenBSD on that machine, too, because I've had an extremely good experience with it during the last year; the system is extremely stable and very easy to administer and upgrade). I say "was", because I have stopped using FreeBSD again, because of the problems I will describe below. My environment on both machines is set up identically as far as X is concerned -- no desktop, just dwm/dmenu. The installed packages are very much the same.

Symptom 1: I was using the workstation, (so, of course, the KVM was pointed at it), running a fairly newly installed FreeBSD 8.0 and one of the backup drives was spinning, but not mounted (it had been mounted and I umounted it). I physically pulled the disk's connector out of the USB hub, at which point both my mouse and keyboard became inoperative. The system had not crashed, but it was unusable, and I had to ssh in from another machine to reboot it.

Symptom 2: If I am using the workstation and I point the KVM at the HP machine and then return to the workstation, the mouse is frozen, every time. dwm keyboard commands don't work either, but ctrl-alt-delete reboots the system.

Another, issue that I noticed this morning was that I did a freebsd-update fetch followed by a freebsd-update install. After rebooting, the system was very unresponsive. Clicking on tabs or links in Firefox resulted in very sluggish responses. Getting an xterm fired up to try to see what was going on took forever. I managed to run 'top' finally, the output of which looked like an idle machine -- low load averages, negligible processor utilization, nothing much of anything going on. At that point, I'd had enough, and I'm in the process of installing Arch Linux.

I'll submit formal bug reports about all this, but I'm curious if anyone else has observed symptoms anything like what I am describing above. Or perhaps has some idea of what's going on?

/Don Allen


----------



## sixtydoses (Jan 20, 2010)

I don't have any problems with my desktop running on FreeBSD except for mounting usb sticks, usb external drives and the likes. I don't know what I did wrong, I don't see much complain about it, so I guess am missing something. Like last night my usb stick mounted fine, and today, after I rebooted my machine, it failed again. Not getting detected at all. It is frustrating, but yea, I love everything else about FreeBSD.


----------



## DutchDaemon (Jan 20, 2010)

USB KVM (with USB keyboard/mouse), USB sticks, USB external disk ... all works fine and predictable for me on my HP laptop with 8-STABLE and XFCE.


----------



## richardpl (Jan 20, 2010)

On 9.0 CURRENT usb works perfectly. Old usb was really crappy.


----------



## DutchDaemon (Jan 21, 2010)

'Old' as in 'pre-8'. I've had no complaints about USB functionality in FreeBSD 8, except maybe the very early -CURRENT developments.


----------



## sixtydoses (Jan 21, 2010)

Think the last time I had USB to work beautifully was back in 7.1 (I think). Never had any issue with mouse and keyboard though.


----------



## DutchDaemon (Jan 21, 2010)

You never removed a USB stick without properly umounting it on 7.1?


----------



## sixtydoses (Jan 21, 2010)

Prolly I did. Like once or twice. Not that I remember of though.

Hmm.. so you were saying probably because I removed a USB stick without unmounting it properly is causing the problem that I'm having now?


----------



## sixtydoses (Jan 21, 2010)

Isn't it.. unlikely?


----------



## DutchDaemon (Jan 21, 2010)

IIRC (I've been on 8 for quite some time now) removing a mounted USB stick on 7.x caused one of two things:

1. an immediate kernel panic and reboot (most of the time)
2. an inability to mount/unmount anything USB-related without rebooting first (some of the time) - the USB stack was simply shot, and I think it affected mice and keyboards too


----------



## sixtydoses (Jan 21, 2010)

Don't really remember such occasion, or, probably my memory is not serving me well.

But since the problem first occurred, I've updated my FreeBSD a few times, recompiled my kernel and all, will it not sort of clean up the previous mess?


----------



## DutchDaemon (Jan 21, 2010)

If you're on a recent 8-STABLE, or a fully-patched 8-RELEASE, I can't see why there would be any real USB problems left. All I can say is: I have none .. and I'm not jumping through hoops. Just a few alterations to my PolicyKit.conf, and it all 'just works'.


----------



## sixtydoses (Jan 21, 2010)

Hmm.. think I'll do some cleaning and rebuilding and see how it goes from there. I'm on 8-RELEASE, updated from source with branch tag RELENG_8_0.


----------



## richardpl (Jan 21, 2010)

So what really does not work for you?


----------



## sixtydoses (Jan 21, 2010)

Most of the time it won't work. Plug in the usb stick, and sometimes it won't get detected all, sometimes dmesg says this:

```
umass0: <vendor 0x0951 product 0x1607, class 0/0, rev 2.00/1.10, addr 2> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:4:0:-1: Attached to scbus4
```

Sometimes it got detected but with this error:

```
pid 8945 (hald-probe-volume), uid 0: exited on signal 6 (core dumped)
```

Mounting manually doesn't work. I've tried both with and without hald and dbus running.


Sometimes it showed up automatically on my xfce, and when I mount it, it'll give me this error:

```
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message 
bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
```

After a few mounting attempts, it'll get mounted.

Sometimes dmesg reports back nothing.

Rarely, it'll work automatically.

My usb ntfs drive won't get detected at all. It's the very same drive I use since I was running FreeBSD 6.x.

I don't remember after which update I did when I realized that my usb drives were recognized automatically, just like Dutch said, it all 'just works'. But that was quite sometime back.


----------



## DutchDaemon (Jan 21, 2010)

sixtydoses said:
			
		

> just like Dutch said, it all 'just works'. But that was quite sometime back.



For me, it is today ..


----------



## sixtydoses (Jan 22, 2010)

You know I seriously thought am gonna get lucky this time.. *sigh*

Just recompiled and rebuilt my kernel, and the result of dmesg after plugging in my usb stick:


```
ugen1.2: <vendor 0x0951> at usbus1
umass0: <vendor 0x0951 product 0x1607, class 0/0, rev 2.00/1.10, addr 2> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:4:0:-1: Attached to scbus4
```


```
root@meh:/boot/kernel#usbconfig 
ugen0.1: <OHCI root HUB nVidia> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON
ugen1.1: <EHCI root HUB nVidia> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen0.2: <USB-compliant keyboard vendor 0x0b38> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen0.3: <Microsoft 3-Button Mouse with I Microsoft> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON
ugen1.2: <product 0x1607 vendor 0x0951> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
```

But am still missing the device for me to mount the usb stick.

Running on:

```
root@meh:/boot/kernel#uname -a
FreeBSD meh 8.0-RELEASE-p2 FreeBSD 8.0-RELEASE-p2 #0: Sat Jan 23 05:57:26 MYT 2010     root@:/usr/obj/usr/src/sys/MEH  amd64
```

Any idea on what I should look into in order to get this working?

Thanks in advance.


----------



## sixtydoses (Jan 23, 2010)

Beastie said:
			
		

> Just an idea. Are you connecting it through an external hub or directly to a root hub? Because unfortunately FreeBSD doesn't detect devices connected through external hubs, unless you plug them in at boot-time. This holds true for all USB devices.
> There was a PR but I think it hasn't been fixed yet as of 8.0-Current.



Hmmm.. I tried rebooting my machine with my usb stick still plugged in(directly, no hub) and it did show up on xfce. I just had to right click and mount it, and it gave me the following error, but it did mount it eventually.


```
Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the 
reply, the reply timeout expired, or the network connection was broken.
```

My dmesg here.


----------



## morbit (Jan 23, 2010)

The usb works for me just fine, though I do not use hal, policykit etc.. To be frank, I only had problems with 7.X when I wishfully removed mounted stick to test problems others had..

Yours dmesg looks normal, I just tested DataTraveler ..


```
<snip>
Jan 23 11:02:22 Thinkpad root: Unknown USB device: vendor 0x0951 product 0x1607 bus uhub3
Jan 23 11:02:22 Thinkpad kernel: ugen3.2: <Kingston> at usbus3
Jan 23 11:02:22 Thinkpad kernel: umass0: <Kingston DataTraveler 2.0, class 0/0, rev 2.00/1.10, addr 2> on usbus3
<snip>
```


----------



## oliverh (Jan 23, 2010)

DutchDaemon said:
			
		

> USB KVM (with USB keyboard/mouse), USB sticks, USB external disk ... all works fine and predictable for me on my HP laptop with 8-STABLE and XFCE.



Well, this is indeed true, but 8-stable has got a lot of fixes, especially for USB shortly after the release ;-)


----------



## morbit (Jan 23, 2010)

If we speak about usb mount/kernel panic fixes, they were prior to 8-RELEASE.


----------

