LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 08-17-2017, 05:21 AM   #1
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
USB re-scan


I have an embedded Linux system with a 4TB USB SSD attached. When the drive is plugged in while the system is running, everything is fine. The drive shows up in lsusb and fdisk -l, and I can mount it and write to it without issue.

When the drive is plugged in before the system is turned on, however, about 80% of the time it just vanishes when the system boots up. No trace of it in fdisk, lsusb, or /sys/bus/usb/devices. If I physically un/re-plug it, it's recognized and everything is fine.

I'm trying to figure out if there's a command I can run that will re-scan the USB bus to detect the drive without having to physically un/re-plug it, since that's not a realistic long-term solution.

I've tried lsusb, udevadm trigger, and unbind/rebinding the USB controller in /sys/bus/usb/drivers/usb, with no success.
 
Old 08-17-2017, 06:46 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,252

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
I had usb weirdness years ago and eventually traced it to the chipset. Does it happen in all the usb ports or only particular ones? what is your chipset? Can you compare syslog or dmesg logs from a boot where the thing mounted successfully, and one where it didn't?

In my case, btw, 2 ports just didn't respond to the signals they received correctly. They had been quietly disabled in later chips, but I had an early version and had these 2 extra crazy ports. I was actually glad when that motherboard blew.
 
Old 08-17-2017, 09:12 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Moderator response

Moved: This thread is more suitable in <Linux - Embedded & Single-board computer> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 08-17-2017, 09:49 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Original Poster
Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
It's an embedded system, so the USB controller is built into the CPU. I've only tried one of the USB ports because it's the only one that can handle a 1A draw, the others are limited to the standard USB 2.0 0.5A which doesn't work well for external drives. The CPU has a single USB 2.0 host port, the SBC has a built-in hub which splits it out to the 3 available host ports, so they should all be equivalent (other than one of them allowing up to 1.0A while the others cut off at 0.5A). I'll work on getting dmesg/syslog output for a successful vs an unsuccessful boot.

Today I did some experimentation though. When the system booted up with the drive attached, it didn't recognize it. I then soft rebooted 5 times (sudo reboot), and it didn't see the drive on any of them. I then pulled the power lead to the board to shut it off hard, then re-applied power, and on that boot the drive did show up properly. I can't help but think it might be some oddity in the USB->SATA bridge that's switching to low power/sleep mode when it's not mounted in a certain time window after power on. That could lead to intermittent behavior from a cold start, and consistent failure from a warm start, which is what we're seeing. Again that brings me back to some kind of USB re-scan command which might wake up any attached devices and get them talking.
 
Old 08-18-2017, 03:48 AM   #5
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,252

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
Right, if you're into embedded, the chipset is a definite suspect, but you are probably able to work around the inadequacies.

I gather a reboot (No power removal) works, and power off doesn't. I don't like using a 1 amp usb port - I feel the standard 100mA should be sufficient and the drive might need it's own supply. Motherboards don't make good devices to have in your power supply.

There is usually a different bios behaviour for the poweroff & reboot scenarios, and it sounds like you're not rebooting the motherboard, and that's losing your disk. This can be traced to a signal in the usb registers for a new device not being inserted. I think you're into kernel patching to get around it. Are you sure the device is given sufficient time to unmount & degister before the reboot?
 
Old 10-13-2017, 03:28 PM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,252

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
On reboots abd restarts:

I had this in detail on an electronics hardware mailing list years ago, where you could pick the brains of hardware experts and believe them, a startup is very different to a reboot, as everything is initiated fully, whereas a reboot might not even cycle the power to the usb drive.

I have 2 usb disk drives (not pen drives) and they have independent power supplies. One is 2A, one is 3A. Where are you going with 1A powering the drive and port? That will be dropping excess voltage across pcb traces, and you have so many possible hardware issues that could go wrong that you should get a separate psu.
 
Old 10-23-2017, 01:11 PM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Original Poster
Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Sorry for the lack of updates...

1A is not the problem. This is not an HDD, it's an SSD, there is no port for an external supply, just USB. If it can't run off of 1A, then it can't run off of USB 3, as USB 3 is limited at 0.9A. That also wouldn't explain why it works every time when hot-plugging it into the device, it only fails to come up on the occasional power cycle.

You have the reboot/poweroff behavior backwards. A reboot does not work, if it doesn't come up on power-on, a soft reboot does not bring it up either. If it does come up on power-on, a soft reboot also doesn't change anything, it still works after the reboot. It just seems to be hit or miss whether it shows up after a cold boot or not, but whether or not it does, a soft reboot doesn't change things.

I ended up running out of time diagnosing the problem, and I just got it running and then stuck the system on a large UPS to prevent power cycling. That held it for the ~3 weeks I needed it to run, and it's since been dismantled.
 
Old 10-23-2017, 02:29 PM   #8
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
Member response

Hi,

You could get a powered Hub to source the drives so it does not load the systems USB.

Hope this helps.
Have fun & enjoy!
 
Old 10-23-2017, 03:15 PM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Original Poster
Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by onebuck View Post
Hi,

You could get a powered Hub to source the drives so it does not load the systems USB.

Hope this helps.
Have fun & enjoy!
The 5V rail on that system is powered by a dedicated 4A supply. All it does is feed the USB rail, nothing else, so a <1A draw is fine. The 1A limit is a dedicated per-port current limiter to protect the system if a USB device short outs or otherwise misbehaves. Unless something draws >1A, it won't kick in and everything is nominal. As it's a USB 3 SSD with no auxiliary power supply, it has to draw <0.9A or it violates the spec and wouldn't work correctly on most/any host. I measured the draw anyway and it peaks around 0.5A with a steady-state draw of <0.1A.
 
Old 10-23-2017, 07:40 PM   #10
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Does anything show up in /var/log/kern.log or dmesg when there's a reboot? I had a udev issue like this for keyboard/mice on avlinux back when it was based on debian squeeze. Slapping on parts of udev from the next version (wheezy) seemed to make it work without replugging the USB. Probably not related, but something to look at. Not sure if it was udev, but udev (/lib/udev/) and stuff under /etc/X11/ was most of what I fiddled with when it "fixed" on me. You could also try unloading / reloading usb-storage, assuming nothing else is dependent on it like the boot drive. But something that could be used, if it works, via a script after a boot in terms of an automated work around.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
only can scan as root: usb scanner & ubuntu 8.10 otoomet Linux - Hardware 9 11-16-2020 01:30 PM
[SOLVED] Cano scan Lide 210 usb scanner DJM78 Linux - Newbie 8 03-28-2016 02:16 PM
[SOLVED] How to scan USB or USB drive/CD with ClamAV? Kate48 Linux - Newbie 2 08-19-2015 01:22 PM
May I force the O.S. to scan all USB devices? stf92 Linux - Desktop 2 09-25-2013 05:38 PM
[SOLVED] usb printer found, can't scan iceman81 Linux - Newbie 2 09-08-2013 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 01:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration