LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-12-2017, 01:47 AM   #1
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Rep: Reputation: 10
Post How to reset USB service?


Hello.
I'm using Debian 8.9 x64 and I like to reset USB service. How can I do it?

Thank you.
 
Old 09-12-2017, 02:38 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,490

Rep: Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532
What is usb service?
 
1 members found this post helpful.
Old 09-12-2017, 03:03 AM   #3
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,230

Rep: Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006
Do you mean reset the USB (hardware) subsystem? If so, this can be done for a particular device, or for all devices attached to a host controller. There are numerous threads on the subject. For example...

http://www.ubuntubuzz.com/2016/06/re...oot-linux.html
https://unix.stackexchange.com/quest...b-port-via-cli
https://zedt.eu/tech/linux/restartin...system-centos/

A device that has been re-initialised will then be detected again by the kernel/udev.
 
Old 09-12-2017, 03:10 AM   #4
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,852

Rep: Reputation: 337Reputation: 337Reputation: 337Reputation: 337
check out this link below, you might need to create a custom program:

https://askubuntu.com/questions/645/...e-command-line
 
Old 09-12-2017, 03:34 AM   #5
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,230

Rep: Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006Reputation: 1006
Yep, same 'usbreset' C code as in the second link I provided
 
Old 09-24-2017, 03:47 AM   #6
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by ferrari View Post
Do you mean reset the USB (hardware) subsystem? If so, this can be done for a particular device, or for all devices attached to a host controller. There are numerous threads on the subject. For example...

http://www.ubuntubuzz.com/2016/06/re...oot-linux.html
https://unix.stackexchange.com/quest...b-port-via-cli
https://zedt.eu/tech/linux/restartin...system-centos/

A device that has been re-initialised will then be detected again by the kernel/udev.
Excuse me, For each device I must did:
Code:
echo -n "USB ID" | tee /sys/bus/pci/drivers/ehci-pci/unbind
echo -n "USB ID" | tee /sys/bus/pci/drivers/ehci-pci/bind
?
 
Old 09-24-2017, 03:51 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 17,237
Blog Entries: 10

Rep: Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160Reputation: 5160
typical x-y-problem.
what are you really trying to achieve?
 
Old 09-24-2017, 03:57 AM   #8
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by ondoho View Post
typical x-y-problem.
what are you really trying to achieve?
As I said, I like to restart USB service. For example, Sometimes I plugged my Pendrive and Linux tell me it is read only but when I reboot my Linux it become OK.
 
Old 09-24-2017, 11:01 AM   #9
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 5,771

Rep: Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133
Quote:
Originally Posted by hack3rcon View Post
As I said, I like to restart USB service. For example, Sometimes I plugged my Pendrive and Linux tell me it is read only but when I reboot my Linux it become OK.
Sometimes they can be difficult. Usually it's enough to
(1) unmount the drive
(2) unplug it
(3) plug it in again and hope for the best!

If a drive has repeated problems it may need repair: see
man dosfsck
 
Old 09-24-2017, 03:04 PM   #10
justmy2cents
Member
 
Registered: May 2017
Location: U.S.
Distribution: Un*x
Posts: 237
Blog Entries: 2

Rep: Reputation: Disabled
To turn off disk device`s write protect, we use the low level system utility hdparm like this:

Code:
sudo hdparm -r0 /dev/sdb
where we asume that /dev/sdb is the Physical disk device we're working on. If the device has partitions that are mounted as read-only, you should re-mount 'em as read-write in order to write data to them.

If that doesnt work you may have to format the drive
 
Old 09-25-2017, 01:06 AM   #11
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by DavidMcCann View Post
Sometimes they can be difficult. Usually it's enough to
(1) unmount the drive
(2) unplug it
(3) plug it in again and hope for the best!

If a drive has repeated problems it may need repair: see
man dosfsck
No, The device is OK and working in Windows OS very good.
 
Old 09-25-2017, 01:07 AM   #12
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 10
Code:
$ /sys/bus/pci/drivers/ehci-pci/
0000:00:1a.0/ 0000:00:1d.0/ module/
No directory exist:
Code:
tee: /sys/bus/pci/drivers/ehci-pci/unbind: No such file or directory
 
Old 09-25-2017, 01:08 AM   #13
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by justmy2cents View Post
To turn off disk device`s write protect, we use the low level system utility hdparm like this:

Code:
sudo hdparm -r0 /dev/sdb
where we asume that /dev/sdb is the Physical disk device we're working on. If the device has partitions that are mounted as read-only, you should re-mount 'em as read-write in order to write data to them.

If that doesnt work you may have to format the drive
Sorry, It is not working always
 
Old 09-25-2017, 02:16 AM   #14
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,490

Rep: Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532Reputation: 5532
as it was already mentioned: (post #7) you did not try to solve the real problem but want to force the system to do what you need. This will hardly work and most probably you will generate additional problems.
Furthermore
Quote:
Sorry, It is not working always
is not an acceptable answer, please tell us when does it work and when did it fail.

If you use GUI, try to safely remove the pen drive instead of just removing the device itself, that may cause this issue (when you try to plug in something again). If you use CLI you may try to use the commands: umount and/or eject also.

finally if you really want to reset an usb port (not a service), you can try this:
https://unix.stackexchange.com/quest...b-port-via-cli
(it was posted already too)
Did you try it at all?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
usb 1-1: reset high-speed USB device number 2 using ehci-pci jotapdiez Slackware 3 11-14-2014 02:42 PM
Have royally messed up local mail service, how to reset to defaults without reinstall at398 Linux - Newbie 3 05-22-2013 02:15 AM
usb external HD issue: reset high speed USB device using ehci_hcd gstath Slackware 4 08-18-2010 01:35 AM
Self Service Password Reset for Sendmail or Solaris trysten_x Solaris / OpenSolaris 1 07-10-2005 12:58 PM
Everytime I log on to FC3, I have to reset SMB and Network service to get online timswim78 Linux - Networking 4 03-06-2005 04:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:31 PM.

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