Subject: USB key
To: None <netbsd-help@netbsd.org>
From: Thierry Lacoste <th.lacoste@wanadoo.fr>
List: netbsd-help
Date: 12/12/2004 14:19:32
I'm running NetBSD2.0 on an Acer laptop.
When I plug an USB key I have the following kernel message :

 umass0 at uhub2 port 6 configuration 1 interface 0
 umass0: Pen Drive USB DISK Pro, rev 2.00/0.02, addr 2
 umass0: using SCSI over Bulk-Only
 scsibus0 at umass0: 2 targets, 2 luns per target
 sd0 at scsibus0 target 0 lun 0: <, USB DISK Pro, PMAP> disk removable
 sd0: 117 MB, 470 cyl, 16 head, 32 sec, 512 bytes/sect x 240640 sectors
 sd1 at scsibus0 target 0 lun 1: <, USB DISK Pro, PMAP> disk removable
 sd1: 1440 KB, 80 cyl, 2 head, 18 sec, 512 bytes/sect x 2880 sectors

My fstab contains: /dev/sd0e /mnt/usb msdos rw,noauto
So I mount the key with 'mount /mnt/usb'
Now if I unplug the key without unmounting it,
I have the following kernel message:

 umass0: at uhub2 port 6 (addr 2) disonnected
 sd0(umass0:0:0:0): generic HBA error
 uvm_fault(0x0625600, 0, 1, 1) -> 0xe
 kernel: page fault trap, code=0
 Stopped in pid 7.1 (usb2) at   0:    invalid adress
 db>

With amd, as I expected, I have the same problem.
My /etc/amd.conf contains:

 [ /amd/usb ]
 map_name =		/etc/amd/usb

My /etc/amd/usb contains:

 /defaults	type:=pcfs;opts:=rw,nosuid,nodev
 0		dev:=/dev/sd0e

Here is the output of 'mount':

 /dev/wd0a on / type ffs (local)
 /dev/wd0e on /usr type ffs (local)
 pid466@sirius:/amd/usb on /amd/usb type nfs (hidden)
 pid466@sirius:/amd/cd on /amd/cd type nfs (hidden)

Here is the output of mount after 'ls /amd/usb/0':

 /dev/wd0a on / type ffs (local)
 /dev/wd0e on /usr type ffs (local)
 pid466@sirius:/amd/usb on /amd/usb type nfs (hidden)
 pid466@sirius:/amd/cd on /amd/cd type nfs (hidden)
 /dev/sd0e on /a/sirius/amd/usb/0 type msdos (nosuid, nodev, local)

If I unplug the key without doing 'amq -u /amd/usb/0'
I have the same kernel error as above.

Is there a way to protect the system against forgetful users?

Regards,
Thierry Lacoste.