Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: External usb drives not working properly (Read 1476 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

External usb drives not working properly

My external hard drive enclosures don't work properly anymore on Artix, using the Mate desktop.

I have 2, a USB 3.0 mains powered one for 2.5 and 3.5" SATA drives and a 2.5" switchable between USB 2.0 and ESATA self powered from the USB for USB or a USB to jack socket for ESATA use which supports both SATA and PATA. The drives themselves are mostly formatted to BTRFS like my main drive partitions as I generally use that unless there's a reason not to.

This is with both a Dell M4400 and M4500. On the M4500 I also have Devuan and Arch partitions where the drives work normally.

In Artix I have custom pressure settings  in /etc/libinput/local-overrides.quirks for the M4500 touchpad as otherwise the pointer can be moved when your finger is just above the touchpad and not even touching it, but in Arch those settings are ignored it seems, when I was trying to get that to work recently, so perhaps there is some difference in libinput with the systemd interface there, which might be related, because when I plug the USB 3.0 enclosure into a USB port on Artix on the M4500 the touchpad pointer stops working and freezes then moves again repeatedly, although the trackpoint works normally.

On both the M4500 and M4400 the drives run very slowly for transfer speeds if mounted and transfers may fail, the drive may remount itself read only, errors get logged on the hard drive itself when examined with smartctl -a.

It doesn't seem to be a kernel issue because I was holding an old kernel version the whole time it was working then stopped working, and then I upgraded to the latest one and it still does it.

Ordinary USB drives seem fine and work norrmally, as does the main internal hard drive. Don't know if anyone else has experienced anything similar.

Re: External usb drives not working properly

Reply #1
Rule out hardware issues by booting the MATE or community-gtk Artix ISO and testing the USB drives.

Re: External usb drives not working properly

Reply #2
Here are some details from dmesg, lsblk, blkid and fdisk -l using the M4500 and plugging in (but not mounting) the USB 3.0 enclosure while booted from the current stable Artix Mate USB iso  artix-mate-openrc-20220713-x86_64.iso, and the touchpad pointing started freezing as soon as it was plugged in.
https://pastebin.com/tsj6yBTd

There seem to be some errors mentioning BTRFS. I mainly use an external drive to rsync backups from another partition so don't know when exactly this problem started. But a while ago I was saving some things to a drive and noticed it seemed very slow and also there was a long pause when mounting. So I checked it with smartctl -a and found loads of logged errors and 383 reallocated sectors so thought it was going bad (it was a cheap used one anyway) so just ordered a replacement. Then later I looked at it again and ran a btrfs scrub on it from Artix which gave a completion time of about half a day and kept finding loads of errors so I cancelled that. But when I ran a btrfs scrub on the same drive on the same laptop but from the Devuan partition it finished in a few minutes and found no errors at all. So possibly it is just BTRFS formatted drives in Artix in an external hard drive enclosure that are affected, I don't know if anything else is too.

Be careful if you test this bug because it might give you a bunch of reallocated sectors and errors in the logs stored on the drive itself too which would be especially annoying if you had some expensive new drive because even if it still works OK it will certainly be unsaleable afterwards!

Edit: It's not just BTRFS as the touchpad pointer also freezes intermittently when I put yet another SATA spinning disc drive that is formatted to EXT3 in the USB 3.0 enclosure.

Re: External usb drives not working properly

Reply #3
I have 2, a USB 3.0 mains powered one for 2.5 and 3.5" SATA drives and a 2.5" switchable between USB 2.0 and ESATA self powered from the USB for USB or a USB to jack socket for ESATA use which supports both SATA and PATA.

 Don't know if anyone else has experienced anything similar.
Is it possible that the problems are caused by the USB 3.0 device and not by artix?
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

Re: External usb drives not working properly

Reply #4
It could be coincidence, something like a bad USB connection could affect things briefly, yet it hasn't caused problems elsewhere. I've 2 enclosures, both had problems only on the Artix partition on 2 different laptops, but they have worked faultlessly with the same drives in other distros on the same laptops, and I've been testing with the 3.0 one because of the obvious pointer issue, I got it new about a year ago, while the other is probably over 10 years old so first I thought it must be going wrong myself too.
  I also use both enclosures to transfer and back up files on a server and not had any problems there either. The problems I've encountered on Artix have been transferring large numbers of files with cp -a or trying to rsync a backup of another partition from Artix, leaving it running and then coming back later to find a load of error messages and the drive had remounted itself read only, the same actions on the same hardware on Devuan or Arch completed correctly.
 These are laptops with working batteries too, so if the mains goes off they keep running, although the USB 3.0 enclosure would be hit by this the other USB powered one wouldn't have been. But it isn't a clear cut situation to test for, except the pointer issue, which was present in the artix-mate-openrc-20220123-x86_64.iso too when I downloaded and booted it earlier today incidentally. If I mount that drive, after I unmount it the touchpad begins to work normally again even without unplugging it.

Update:
I tried linux-zen and linux-hardened from both Artix and the Arch extra/ repos and found no difference, although perhaps with the hardened version the pointer freezes and releases happened on a bit slower timescale, possibly, only a subjective impression as I hadn't been timing the intervals. But then I found the cause - on Arch I had installed the "xf86-input-synaptics" package which I didn't have on Artix. Reversing this situation in both places also reversed the pointer freezing, and the ignored touchpad sensitivity settings in /etc/libinput. So it looks like the touchpad driver in libinput is causing some weird conflict with the driver for external hard drive enclosures, and because these things should be totally separate, most likely this is also causing the intermittent input output problems, and it can't be affecting all types of hw or someone else would surely have noticed by now.

Re: External usb drives not working properly

Reply #5
Code: [Select]
[   73.578839] BTRFS: error (device sdc1: state A) in add_to_free_space_tree:1051: errno=-5 IO failure
[   73.578844] BTRFS info (device sdc1: state EA): forced readonly
[   73.578848] BTRFS: error (device sdc1: state EA) in do_free_extent_accounting:2874: errno=-5 IO failure
[   73.578852] BTRFS: error (device sdc1: state EA) in btrfs_run_delayed_refs:2151: errno=-5 IO failure
[   73.578857] BTRFS warning (device sdc1: state EA): Skipping commit of aborted transaction.
[   73.578860] BTRFS: error (device sdc1: state EA) in cleanup_transaction:1982: errno=-5 IO failure
errno=-5 IO failure means your file system is corrupted.

Regardless of which search engine/distribution is used, you will always find two reasons for the error.
Either it is the hardware or BTRFS itself.
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

Re: External usb drives not working properly

Reply #6
Checking the same drive & enclosure in Devuan earlier today:
Code: [Select]
$ sudo btrfs scrub status mntpoint
scrub status for d8fbf657-4df7-47cb-a7ca-97b24bdb8e6f
        scrub started at Thu Nov  3 20:29:04 2022 and finished after 02:29:33
        total bytes scrubbed: 296.07GiB with 0 errors

Re: External usb drives not working properly

Reply #7
Code: [Select]
man btrfs-scrub

Quote
NOTE:
Scrub is not a filesystem checker (fsck) and does not verify nor repair structural damage in the filesystem.
It really only checks checksums of data and tree blocks, it doesn't ensure the content of tree blocks is valid and consistent.
There's some validation performed when metadata blocks are read from disk but it's not extensive and cannot substitute full btrfs check run.


Code: [Select]
man btrfs-check

Quote
WARNING:
Do not use --repair unless you are advised to do so by a developer or an experienced user, and then only after having accepted that no fsck successfully repair all types of filesystem corruption.
Eg. some other software or hardware bugs can fatally damage a volume.

EOT
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

Re: External usb drives not working properly

Reply #8
Code: [Select]
$ btrfs check -p /dev/sdb1
Opening filesystem to check...
Checking filesystem on /dev/sdb1
UUID: d8fbf657-4df7-47cb-a7ca-97b24bdb8e6f
[1/7] checking root items                      (0:00:21 elapsed, 1864796 items checked)
[2/7] checking extents                         (0:02:21 elapsed, 222742 items checked)
[3/7] checking free space cache                (0:00:18 elapsed, 299 items checked)
[4/7] checking fs roots                        (0:03:07 elapsed, 190659 items checked)
[5/7] checking csums (without verifying data)  (0:00:21 elapsed, 287017 items checked)
[6/7] checking root refs                       (0:00:00 elapsed, 3 items checked)
[7/7] checking quota groups skipped (not enabled on this FS)
found 314257653760 bytes used, no error found
total csum bytes: 303252720
total tree bytes: 3649273856
total fs tree bytes: 3133587456
total extent tree bytes: 154206208
btree space waste bytes: 613670256
file data blocks allocated: 310643216384
 referenced 310642888704

That was in Artix, first I tried with xf86-input-synaptics installed then without and got the same result, although the touchpad behaviour differed as usual, although it did perhaps seem slightly affected and a bit laggy even using the synaptics driver while the check was running.

Re: External usb drives not working properly

Reply #9
Can you tell me why I can't find the UUID: d8fbf657-4df7-47cb-a7ca-97b24bdb8e6f in your log?

Your problem is the drive /dev/sdc1: LABEL="NO-2 500GB HDD" UUID="8e931a17-e12e-4244-9acc-d264a0e4bbf3"
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

Re: External usb drives not working properly

Reply #10
> On the M4500 I also have Devuan and Arch partitions where the drives work normally

You could try lsmod on each of those OS's and compare the output of relevant modules that might show up or not by case. Could be a corrupt module that crashes and make those drives under-perform.

Also you could check in task manager see if something is using more power than necessary downgrading those drives performances. 



Re: External usb drives not working properly

Reply #11
Code: [Select]
$ btrfs check -p /dev/sdb1
Opening filesystem to check...
Checking filesystem on /dev/sdb1
UUID: 8e931a17-e12e-4244-9acc-d264a0e4bbf3
[1/7] checking root items                      (0:00:05 elapsed, 839701 items checked)
[2/7] checking extents                         (0:00:48 elapsed, 96271 items checked)
[3/7] checking free space tree                 (0:00:00 elapsed, 253 items checked)
[4/7] checking fs roots                        (0:00:05 elapsed, 73160 items checked)
[5/7] checking csums (without verifying data)  (0:00:00 elapsed, 203076 items checked)
[6/7] checking root refs                       (0:00:00 elapsed, 3 items checked)
[7/7] checking quota groups skipped (not enabled on this FS)
found 267821469696 bytes used, no error found
total csum bytes: 260004212
total tree bytes: 1577156608
total fs tree bytes: 1202520064
total extent tree bytes: 66043904
btree space waste bytes: 241169968
file data blocks allocated: 266244313088
 referenced 266243964928
Sorry, although I had problems with both drives in the past, this is the supposed replacement for the other 500GB one that checked OK in the last post, this HGST one has no reallocated sectors while the other WD Black has 381 (it used to have none but they are not increasing lately either) so should show problems if it was going to you would think.  But they both seem OK at present, perhaps some update has already resolved it? Those errors came while in an iso hence older versions than now. Some good ideas for things to check on going forward, thank you.

This is the current dmesg output from firstly plugging it in to do the check, then later mounting it, it does mention some errors but it turns out that is a helpful record of past events which can apparently be zeroed again if required with btrfs dev stats -z, so it is only saying there had been problems before. After that is the same command on the original WD Black drive, showing  lots of  recorded errors:

Code: [Select]
[ 1329.287116] usb 2-1.2: new high-speed USB device number 4 using ehci-pci
[ 1329.447018] usb 2-1.2: New USB device found, idVendor=152d, idProduct=0578, bcdDevice= 1.08
[ 1329.447028] usb 2-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1329.447033] usb 2-1.2: Product: LITEON ULTRA 1
[ 1329.447036] usb 2-1.2: Manufacturer: LITEON ULTRA 1
[ 1329.447039] usb 2-1.2: SerialNumber: 00000000006BF
[ 1329.467449] usbcore: registered new interface driver usb-storage
[ 1329.479870] scsi host6: uas
[ 1329.479992] usbcore: registered new interface driver uas
[ 1329.480714] scsi 6:0:0:0: Direct-Access     LITEON   UITRA1           0108 PQ: 0 ANSI: 6
[ 1329.485311] sd 6:0:0:0: Attached scsi generic sg2 type 0
[ 1331.651587] sd 6:0:0:0: [sdb] 976773168 512-byte logical blocks: (500 GB/466 GiB)
[ 1331.651596] sd 6:0:0:0: [sdb] 4096-byte physical blocks
[ 1331.651910] sd 6:0:0:0: [sdb] Write Protect is off
[ 1331.651917] sd 6:0:0:0: [sdb] Mode Sense: 5f 00 00 08
[ 1331.652714] sd 6:0:0:0: [sdb] Disabling FUA
[ 1331.652722] sd 6:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 1331.652903] sd 6:0:0:0: [sdb] Preferred minimum I/O size 4096 bytes
[ 1331.652909] sd 6:0:0:0: [sdb] Optimal transfer size 33553920 bytes not a multiple of preferred minimum block size (4096 bytes)
[ 1331.677018]  sdb: sdb1
[ 1331.677256] sd 6:0:0:0: [sdb] Attached SCSI disk
[ 1332.050950] BTRFS: device label NO-2 500GB HDD devid 1 transid 819 /dev/sdb1 scanned by udevd (3953)
[ 2045.417774] CE: hpet increased min_delta_ns to 20115 nsec
[ 2388.366049] perf: interrupt took too long (3929 > 3925), lowering kernel.perf_event_max_sample_rate to 50000
[ 2790.501073] BTRFS info (device sdb1): using crc32c (crc32c-intel) checksum algorithm
[ 2790.501088] BTRFS info (device sdb1): using free space tree
[ 2790.628073] BTRFS info (device sdb1): bdev /dev/sdb1 errs: wr 3, rd 1, flush 0, corrupt 0, gen 0

$ sudo btrfs dev stats 1mnt
[/dev/sdb1].write_io_errs    3
[/dev/sdb1].read_io_errs     1
[/dev/sdb1].flush_io_errs    0
[/dev/sdb1].corruption_errs  0
[/dev/sdb1].generation_errs  0

$ sudo btrfs dev stats 1mnt
[/dev/sdb1].write_io_errs    0
[/dev/sdb1].read_io_errs     6429
[/dev/sdb1].flush_io_errs    0
[/dev/sdb1].corruption_errs  0
[/dev/sdb1].generation_errs  0


Re: External usb drives not working properly

Reply #12
Think i got it what's happening. I'm seeing this:

Code: [Select]
[ 1329.287116] usb 2-1.2: new high-speed USB device number 4 using ehci-pci

High speed, should not be super speed? You seem to use ehci-pci module but it should be xhci_hcd instead. So there's a chance your device is under-powered so because of that it doesn't use xhci_hcd module but older or better said slower ehci-pci module.

My guess is that you forgot/missed or skipped installing some power management packages in artix while those on devuan and arch installations are present.

So if you are using lsmod and not seeing something similar like bellow you are using those drives under usb 2.0 technology because drives are under-powered, 150 mA, 0.75W instead of 900 mA, 4.5W

      Module                  Size              Used by
     xhci_hcd              344064  1   xhci_pci

Re: External usb drives not working properly

Reply #13
A Dell M4500 has USB 2.0 ports plus an ESATA one as it predates 3.0 although sometimes I use a Medion X89003 (MD 86332) USB 3.0 express card  adapter for that drive, which does give faster transfer speeds than the 2.0 ports. There is the same pointer freezing when I connect via that, and it's on the PCI bus there. The other enclosure (without the pointer freezing issues) is a Newlink, USB 2.0 and ESATA, IDE & SATA 2.5", with chrome ends and a black case, the new ones of those have black ends, and I tend to use that one more as ESATA is the fastest combination with this HW. 3.0 should be backwards compatible? I've used that 3.0 enclosure to back up and restore successfully a TB or two of data on a server that doesn't have USB 3.0 and the OS is so old it doesn't recognize filesystems newer than EXT3, and that enclosure isn't USB powered, it has it's own inbuilt mains PSU - it's a 396U3 USB 3.0 Hard Driver Enclosure, made in China, for SATA 2.5" and 3.5" drives.
 It's certainly another thing to look into though.

Re: External usb drives not working properly

Reply #14
Now you may need to determine how much faster works on Devuan/Arch and compare those to Artix. Is significantly slower on Artix? Meaning 2x, 1.5x or  0.15x. etc

Talking about 2.0 which is slower by default even a tiny fraction slower than that could be very annoying. Meanwhile  do you have upower package installed on Artix? Heard recently someone complaining on something similar and he forgot installing upower package .