This is starting to really get on my nerves. A tl;dr version of the issue - it's not a hardware problem since it happened on my "old" desktop as well as on my new one. Their hardware is different but they're both new machines and both run Linux Mint. Meanwhile my old Win XP desktop, my prehistoric Win 98 SE laptop and my HP mini running Xubuntu do not exhibit this problem. Thus the issue seems to be Mint itself, meaning software.
I have a 3TB Toshiba external drive and an internal 1TB drive in one of those adapters/cases for use as an external drive, the English term eludes me at the moment. The first powers itself via USB, the second has it's own power supply. In both cases when plugged in Linux will automatically mount them. However, it will both disconnect and reconnect the drives (or rather just A drive, I only use one at a time) at complete random, at irregular intervals. It doesn't matter if I'm copying files to and from the drives, or if I'm accessing a file on the drive like say watching a video. It will just randomly unmount and then mount again by itself, with no errors except when copying. If I was in the middle of transferring files it'll just say that it failed basically, there's no mention of any deeper error. Yes, the power supply is stable and the cables are good.
I'd appreciate some guidance here because I'm essentially new to Linux and while using it for a while now I posses no deeper knowledge on how to work with it. I stress that this issue is going on on a new machine which is barely a year old, while it doesn't happen on my old configurations including a laptop from circa 1998. Likewise the chances that both my current PC and my "old" PC (about 5 years old) which were both running Mint having some sort of issue with USB itself seems astronomically low.
Linux keeps connecting and disconnecting USB mounted external drives
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Linux keeps connecting and disconnecting USB mounted external drives
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Linux keeps connecting and disconnecting USB mounted external drives
I've had similar issues and discovered that, for me, it was caused by using 'uas' usb devices.
I found out that many USB3 external drives and SATA-to-USB3 adapters now use a recent-ish development called 'USB Attached SCSI', usually abbreviated to 'UAS'. Refer https://en.wikipedia.org/wiki/USB_Attached_SCSI, particularly the section on 'Operating system support'.
As far as I can tell it only causes problems for USB3 ports, so older systems that only have USB2 ports should be immune. Support for UAS appears to have been introduced in kernel 3.15 according to a post at https://www.phoronix.com/scan.php?page= ... px=MTcyMTk, so earlier kernels are probably also immune.
Unfortunately, it seems the specification is vague, and manufacturers cut corners with the specs anyway, and they usually don't make drivers for Linux, so the Linux kernel often has difficulty with them.
Running 'dmesg --follow' in a terminal and then plugging in the usb device will show a bunch of uas-related errors if uas is the problem.
One way to check if the device uses uas is to run the command 'lsusb -t' in the terminal. A 'uas' device will be identified as such, as shown for the device 'Bus 04 Device 2' on the second line of the output, where it says 'Driver=uas':
If that's the case, the next step is to blacklist the uas kernel module for that device, meaning it will then function as a standard usb storage device.
To do that, run 'lsusb' in a terminal and get the device id:
Here the device id for 'Bus 004 Dev 002' is '7825:a2a4'.
That value needs to be added to a kernel blacklist file in the directory '/etc/modprobe.d'. That's an administrator-only directory, so you'll need to use a sudo command to create and edit the file. I called mine 'blacklist-uas-on-quirks.conf'.
This is the contents of my file '/etc/modprobe.d/blacklist-uas-on-quirks.conf':
So the basic formula for a single uas device is
I have three problematic uas devices, so I've added each of their id's to the blacklist separated by commas.
After the blacklist file has been created with the uas id added, run 'sudo update-initramfs -u' and reboot.
Running dmesg in a terminal will show 'UAS is blacklisted for this device, using usb-storage instead':
I hope this helps.
I found out that many USB3 external drives and SATA-to-USB3 adapters now use a recent-ish development called 'USB Attached SCSI', usually abbreviated to 'UAS'. Refer https://en.wikipedia.org/wiki/USB_Attached_SCSI, particularly the section on 'Operating system support'.
As far as I can tell it only causes problems for USB3 ports, so older systems that only have USB2 ports should be immune. Support for UAS appears to have been introduced in kernel 3.15 according to a post at https://www.phoronix.com/scan.php?page= ... px=MTcyMTk, so earlier kernels are probably also immune.
Unfortunately, it seems the specification is vague, and manufacturers cut corners with the specs anyway, and they usually don't make drivers for Linux, so the Linux kernel often has difficulty with them.
Running 'dmesg --follow' in a terminal and then plugging in the usb device will show a bunch of uas-related errors if uas is the problem.
One way to check if the device uses uas is to run the command 'lsusb -t' in the terminal. A 'uas' device will be identified as such, as shown for the device 'Bus 04 Device 2' on the second line of the output, where it says 'Driver=uas':
Code: Select all
$ lsusb -t
/: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
|__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=uas, 5000M
/: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
|__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
|__ Port 4: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
|__ Port 4: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
|__ Port 5: Dev 4, If 0, Class=Vendor Specific Class, Driver=dvb_usb_dib0700, 480M
To do that, run 'lsusb' in a terminal and get the device id:
Code: Select all
lsusb
Bus 002 Device 002: ID 8087:8001 Intel Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8009 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 7825:a2a4
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 004: ID 046d:c248 Logitech, Inc. G105 Gaming Keyboard
Bus 003 Device 006: ID 056a:0011 Wacom Co., Ltd Graphire 2 4x5
Bus 003 Device 005: ID 046d:c077 Logitech, Inc. M105 Optical Mouse
Bus 003 Device 003: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 003 Device 002: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
That value needs to be added to a kernel blacklist file in the directory '/etc/modprobe.d'. That's an administrator-only directory, so you'll need to use a sudo command to create and edit the file. I called mine 'blacklist-uas-on-quirks.conf'.
Code: Select all
sudo xed /etc/modprobe.d/blacklist-uas-on-quirks.conf
Code: Select all
options usb-storage quirks=7825:a2a4:u,174c:55aa:u,0dd8:ba00:u
Code: Select all
options usb-storage quirks=[id]:u
After the blacklist file has been created with the uas id added, run 'sudo update-initramfs -u' and reboot.
Running dmesg in a terminal will show 'UAS is blacklisted for this device, using usb-storage instead':
Code: Select all
2020-05-29T16:07:48,788986+1000 usb 3-13: new high-speed USB device number 7 using xhci_hcd
2020-05-29T16:07:48,829918+1000 usb 3-13: New USB device found, idVendor=7825, idProduct=a2a4, bcdDevice=41.01
2020-05-29T16:07:48,829923+1000 usb 3-13: New USB device strings: Mfr=1, Product=2, SerialNumber=3
2020-05-29T16:07:48,829926+1000 usb 3-13: Product: Best USB Device
2020-05-29T16:07:48,829929+1000 usb 3-13: Manufacturer: ULT-Best
2020-05-29T16:07:48,829932+1000 usb 3-13: SerialNumber: 235678C218CA
2020-05-29T16:07:48,831204+1000 usb 3-13: UAS is blacklisted for this device, using usb-storage instead
2020-05-29T16:07:48,831208+1000 usb-storage 3-13:1.0: USB Mass Storage device detected
2020-05-29T16:07:48,831677+1000 usb-storage 3-13:1.0: Quirks match for vid 7825 pid a2a4: 800000
2020-05-29T16:07:48,831787+1000 scsi host6: usb-storage 3-13:1.0
2020-05-29T16:07:49,837447+1000 scsi 6:0:0:0: Direct-Access ST950032 0AS 4101 PQ: 0 ANSI: 6
2020-05-29T16:07:49,837914+1000 sd 6:0:0:0: Attached scsi generic sg1 type 0
2020-05-29T16:07:49,838214+1000 sd 6:0:0:0: [sdb] 976773168 512-byte logical blocks: (500 GB/466 GiB)
2020-05-29T16:07:49,838502+1000 sd 6:0:0:0: [sdb] Write Protect is off
2020-05-29T16:07:49,838506+1000 sd 6:0:0:0: [sdb] Mode Sense: 47 00 00 08
2020-05-29T16:07:49,838765+1000 sd 6:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
2020-05-29T16:07:49,932353+1000 sdb: sdb1 sdb2 sdb3 sdb4 sdb5
2020-05-29T16:07:49,933677+1000 sd 6:0:0:0: [sdb] Attached SCSI disk
Re: Linux keeps connecting and disconnecting USB mounted external drives
FWIW, I have a USB-3 drive adapter which works fine on both SSDs and HDDs with NTFS formatted partitions, but disconnects pretty regularly with ext4 partitions. However, it still works OK with ext4 partitions for backups, somehow.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Your data and OS are backed up....right?
Re: Linux keeps connecting and disconnecting USB mounted external drives
Code: Select all
sudo xed /etc/modprobe.d/blacklist-uas-on-quirks.conf
Instead use
Code: Select all
xed admin:///etc/modprobe.d/blacklist-uas-on-quirks.conf
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0