# Problem with USB devices



## mwgary (Aug 26, 2019)

Hi,

I've just recently installed Freebsd 12 release.  Everything seems to be working, mostly.  I am however having problems with the system recognising USB3 devices, or more specifically flash drives, USB hard drives and DVD drives. When Plugged in nothing happens, or sometimes the flash drive may be recognised after around 2 minutes, then I can mount it, but that's only 1 in 5 times.  USB2 no problems at all.

I've poked around with various settings and permissions etc, but nothing appears to work.  Technical details as follows if it helps:-

HP Pavilion 550-182na Desktop, all AMD and Radeon chipsets

Output of `dmesg`

```
scsi_cd: cdioctl: cdioreadsubchannel: error, len=0                                                                            
pid 77669 (conftest), uid 0: exited on signal 11 (core dumped)                                                              
ugen1.3: <Verbatim STORE N GO> at usbus1
umass2 on uhub3
umass2: <Verbatim STORE N GO, class 0/0, rev 2.00/1.05, addr 2> on usbus1
umass2: SCSI over Bulk-Only; quirks = 0xc100
umass2:12:2: Attached to scbus12
```
/etc/sysctl.conf

```
# $FreeBSD: releng/12.0/sbin/sysctl/sysctl.conf 337624 2018-08-11 13:28:03Z brd $                                             
#                                                                                                                            
# This file is read when going to multi-user and its contents piped thru
# ``sysctl'' to adjust kernel values. ``man 5 sysctl.conf'' for details.
#

# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
vfs.zfs.min_auto_ashift=12
dev.hdac.0.polling=1
hw.snd.default_unit=0
vfs.usermount=1
kern.maxfiles=200000
kern.sched.preempt_thresh=224
hw.syscons.bell=0
kern.ipc.shm_allow_removed=1
kern.ipc.shmmax=67108864
kern.ipc.shmall=32768
vfs.read_max=128
net.local.stream.recvspace=65536
net.local.stream.sendspace=65536
#shared memory for Chromium
kern.ipc.shm_allow_removed=1
```

/etc/rc.conf


```
hostname="FreeBSD-Mark"                                                                                                       
keymap="uk.kbd"                                                                                                              
ifconfig_re0="DHCP"
sshd_enable="YES"
pf_enable="YES"
pf_rules="/etc/pf.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
pflog_flags=""
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
zfs_enable="YES"
kld_list="/boot/modules/amdgpu.ko"
#snddetect_enable="YES"
#mixer_enable="YES"
#gnome_enable="YES"
#moused_enable="YES"
dbus_enable="YES"
hald_enable="YES"
avahi_daemon_enable="YES"
#gdm_enable="YES"
sddm_enable="YES"
clear_tmp_enable="YES"
clean_tmp_X="YES"
microcode_update_enable="YES"
sendmail_enable="NONE"
#fsck_y_enable="YES"
swapexd_enable="YES"
syslogd_flags="-c -ss"
linux_enable="YES"
cupsd_enable="YES"
devd_enable="YES"
devfs_system_ruleset="devfsrules_common"
saned_enable="YES"
#amd_enable="YES"
#amd_flags="a /.amd_mnt -c 10 -w -l syslog /host /etc/amd.map"
autofs_enable="YES"
ataidle_enable="YES"
ataidle_devices="ada0 ada1"
ataidle_ada0="-A 0 -P 0"
mixer_enable="YES"
mouse_type="auto"
webcamd_enable="YES"
ntpdate_enable="YES"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
```

and /boot/loader.conf


```
kern.geom.label.disk_ident.enable="0"                                                                                         
kern.geom.label.gptid.enable="0"                                                                                             
#hw.sdhci.enable_msi=0 
zfs_load="YES" 
sound_load="YES" 
snd_hda_load="YES" 
loader_logo="beastie" 
hw.syscons.disable=1 
kern.vty=vt 
linux_load="YES" 
linux_enable="YES" 
kern.ipc.shmseq=1024 
kern.ipc.shmmni=1024 
kern.maxproc=100000 
mmc_load="YES" 
mmcsd_load="YES" 
sdhci_load="YES" 
atapicam_load="YES" 
fuse_load="YES" 
coretemp_load="YES" 
tmpfs_load="YES" 
aio_load="YES" 
libiconv_load="YES" 
msdosfs_iconv_load="YES" 
libmchain_load="YES" 
cd9660_iconv_load="YES" 
#cuse_load="YES" 
cuse4bsd_load="YES" 
uplcom_load="YES" 
ng_ubg_load="YES" 
hw.usb.xhci.xhci_port_route=-1
```

I hope I've provided enough info.  Needless to say, on the same system, I have no problem with Linux detecting the same hardware, or for that matter the accursed Windows. 

Outside of this, its a fairly rock steady install, and I'm pleased with it.  But the USB thing is going to bug me until I find a way to fix it.  I cant imaging for one moment I am the only person this has happend to.

Any help appreciated.

Regards


----------



## userxbw (Sep 1, 2019)

for usb stick and an external hdd ext4. I got this to automount

```
[userx@FreeBSD64ssd ~]$ cat /etc/rc.conf
...
#devfs_system_ruleset="devfsrules_common"
devfs_system_ruleset="localrules"
autofs_enable="YES"
fuse_load="YES"
...
```


```
[userx@FreeBSD64ssd ~]$ cat /boot/loader.conf
....
kldload fuse
```









						Chapter 19. Storage
					

This chapter covers the use of disks and storage media in FreeBSD. This includes SCSI and IDE disks, CD and DVD media, memory-backed disks, and USB storage devices.




					www.freebsd.org
				




I took from that page and added into that files the few things I figured I needed.


```
[userx@FreeBSD64ssd ~]$ cat /etc/auto_master
# $FreeBSD: releng/12.0/usr.sbin/autofs/auto_master 337749 2018-08-14 13:52:08Z trasz $
#
# Automounter master map, see auto_master(5) for details.
#
/net            -hosts          -nobrowse,nosuid,intr
# When using the -media special map, make sure to edit devd.conf(5)
# to move the call to "automount -c" out of the comments section.
/media          -media          -nosuid,noatime,autoro
#/-             -noauto
```


```
[userx@FreeBSD64ssd ~]$ cat /etc/devfs.rules
[localrules=5]
add path 'da*' mode 0660 group operator
```


```
[userx@FreeBSD64ssd ~]$ cat  /usr/local/etc/automount.conf
USERUMOUNT=YES
ATIME=NO
REMOVEDIRS=YES
FM="pcmanfm"
USER=userx
#ENCODING=pl_PL.ISO8859-2
#CODEPAGE=cp852
```
FM="pcmanfm" so that file manager opens upon inserting into USB Port.

most of this is a search and find then add it. as far as I remember I installed automount and whatever came with it, and fuse* and that is it. I can get to my data partition to share between Linux and freeBSD ext4 r/w as far as ntfs I have not bothered with it because I do not use it for Linux and FreeBSD on this laptop.

it automounts usb sticks, and external USB Ports HDDs. too. ext4 r/w, and all this laptop has is 3.0 USB ports, the only thing I have not gotten to work is my SD Card slot. but I'm not sweating that. and this is on a HP Elitebook 840 g2 btw
though it it should not matter, just try adding what you do not have that I do, and hopefully you'll have automount 3.0 USB Ports.

they mount in /media


----------



## mwgary (Sep 3, 2019)

userxbw said:


> for usb stick and an external hdd ext4. I got this to automount
> 
> ```
> [userx@FreeBSD64ssd ~]$ cat /etc/rc.conf
> ...



Thanks for the advice.  We have partial success.  It is now automounting.  However, its taking a whole minute for the OS to assign a device name to the flash drive, then then automounting.  Then a further minute before the content of the directory is visible.  Most strange.  USB2 ports, no such problem, its instant.

I shall crack on to find a solution.  I'm sure its a chipset problem.  Another PC of mine, Intel based, everything works as it should.

Thanks anyway.


----------



## userxbw (Sep 4, 2019)

mwgary said:


> Thanks for the advice.  We have partial success.  It is now automounting.  However, its taking a whole minute for the OS to assign a device name to the flash drive, then then automounting.  Then a further minute before the content of the directory is visible.  Most strange.  USB2 ports, no such problem, its instant.
> 
> I shall crack on to find a solution.  I'm sure its a chipset problem.  Another PC of mine, Intel based, everything works as it should.
> 
> Thanks anyway.


yeah, on mine. the attached drives, it sees all of them some of the times, and some of them all of the time. I do not plug in much, so I do not have a real idea on how that preforms. I have not yet gotten it to see SD Cards. 

My option is they have two many methods of how it "automounts" a drive. They should put them all into one program and name it automount. 

when booting it sees the partitions. I do think I remember reading somewhere how it has this detach mount after x amount of time of no use thing. Nevertheless, it still needs to be consolidated in my option. ie. needs work. 

I did not write this OS, I'm still learning its quirks.
cheers!


----------



## Alain De Vos (Sep 4, 2019)

For HP Pavilion and some USB devices the following quirck can help,
# /usr/sbin/usbconfig ugenx.y   add_quirk UQ_MSC_NO_INQUIRY
Check 
# dmesg | grep ugen 
for the x.y


----------



## userxbw (Sep 5, 2019)

a little more one that,


			usb_quirk(4freebsd) — freebsd-manpages — Debian jessie — Debian Manpages
		

it says debian, but they get it from freebsd man pages





						usb_quirk(4)
					






					www.freebsd.org


----------



## rpowell47 (Sep 5, 2019)

mwgary said:


> Hi,
> 
> I've just recently installed Freebsd 12 release.  Everything seems to be working, mostly.  I am however having problems with the system recognising USB3 devices, or more specifically flash drives, USB hard drives and DVD drives. When Plugged in nothing happens, or sometimes the flash drive may be recognised after around 2 minutes, then I can mount it, but that's only 1 in 5 times.  USB2 no problems at all.
> 
> ...


Try 
usb_enable=“YES”
In your rc.conf file


----------



## Alain De Vos (Sep 5, 2019)

rpowell47 said:


> usb_enable=“YES”


Never heard of it. usb is not a service and usb is part of the kernel. Which script does this executes ?


----------



## userxbw (Sep 6, 2019)

I just found this one for freebsd. it seems to be working a lot better. 









						FreeBSD Desktop – Part 17 – Configuration – Automount Removable Media
					

In this article in the FreeBSD Desktop series I will introduce various methods to automatically (or not) mount external/removable devices such as USB or eSATA disks/pendrives or SD/microSD flash ca…




					vermaden.wordpress.com
				




sysutils/dsbmd towards the bottom of the page.


----------

