how to fix USB hotplug automount fail? (besides reboot)

Archived topics about LMDE 1 and LMDE 2
Locked
TomRoche

how to fix USB hotplug automount fail? (besides reboot)

Post by TomRoche »

I'm running a testing-based LMDE on an old 64-bit laptop (Clevo M762TUN), which is pretty stable/reliable. (details:

Code: Select all

$ lsb_release -ds
Linux Mint Debian Edition
$ cat /etc/debian_version
wheezy/sid
$ uname -rv
3.2.0-4-amd64 #1 SMP Debian 3.2.32-1
$ gcc --version | head -n 1
gcc (Debian 4.6.3-1) 4.6.3
) Mostly I run it on AC (the battery is just about broken, providing ~30 min on full charge); to move it, or when it's not in use, I sleep (aka suspend to RAM) it. I sleep/wake it several times a day, but my time between reboots is usually on the order of tens of weeks. My leading causes of reboot are (in decreasing order of frequency)
  1. hotplugged USB drives no longer automount (more below)
  2. [url=http://forums.linuxmint.com/viewtopic.php?f=199&t=140871]wake-from-sleep fails: it "wakes" to black screen, and I cannot get either a tty or X display[/url]
  3. installing something that requires (or strongly suggests) reboot (e.g., new kernel)--not much I can do about that :-)
Rebooting is quite tedious, since I typically have lots of terminal, editor, and browser tabs open. Hence I'd like to solve my current main cause of reboot, failure to hotplug automount. Details:

Periodically (several times/day) I plug an MP3 player (containing an internal FAT USB drive as well as an "external" microSD) into one of its USB ports to download audio. After a few seconds, a nautilus window pops up, letting me know I have automounted (path=/media/drive_label); I then download the content, `umount` the mount point, and disconnect the player.

Infrequently, and inadvertently, I will sleep the laptop while the player is still USB-attached :-( I can still wake the laptop, and all seems well, but if I subsequently plugin the MP3 player ... nothing happens. I can manually mount the player's USB drives, but that's tedious.

The only thing I know will restore hotplug automount is reboot. I'd like to know, how to restore USB automount when it fails, *without* rebooting? Things I have tried/failed include:

1. stop/start udevd

Code: Select all

me@it:~$ pgrep -l udev
> 304 udevd
> 4379 udevd
> 4380 udevd
me@it:~$ sudo /etc/init.d/udev stop
> Stopping the hotplug events dispatcher: udevd.
me@it:~$ sudo /etc/init.d/udev start
> Starting the hotplug events dispatcher: udevd.
> Synthesizing the initial hotplug events...done.
> Waiting for /dev to be fully populated...done.
me@it:~$ pushd /media/mp3player/content/
> bash: pushd: /media/mp3player/content/: No such file or directory
2. kill/start udevd

Code: Select all

me@it:~$ sudo pkill -9 udev
me@it:~$ pkill -9 udev
me@it:~$ sudo /etc/init.d/udev start
> Starting the hotplug events dispatcher: udevd.
> Synthesizing the initial hotplug events...done.
> Waiting for /dev to be fully populated...done.
me@it:~$ pushd /media/mp3player/content/
> bash: pushd: /media/mp3player/content/: No such file or directory
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
jdackle

Re: how to fix USB hotplug automount fail? (besides reboot)

Post by jdackle »

I can give you no definitive answers but I can try and throw some hints at you. :P
The first hint would be for you to post what laptop (brand and model) you have, as several of those machines have specific issues and specific sollutions. :wink:
TomRoche wrote:
  1. hotplugged USB drives no longer automount (more below)
USB suspending is one thing that somehow tends to get broken more frequently than others. The basic requirement for the operation to be trouble-free seems to release (or stop or unmount, whatever) the USB interfaces before suspending and bringing them back on only after everything else (or most everything) has been woken up. The package laptop-mode-tools provides some handy scripts to automagically handle this and other things. Have you had a look at it?
TomRoche wrote:
  1. wake-from-sleep fails: it "wakes" to black screen, and I cannot get either a tty or X display
The pm-utils package (installed by default) includes (besides pm-suspend, pm-hibernate, etc) a folder named "/usr/lib/pm-utils/video-quirks/" full of workarounds for several, well, quirks related to many different brands of laptops. I don't remember how to use them anymore, but I'm sure someone will be able to help you once you identified what "quirk"(s) concerns your system.
TomRoche wrote:
  1. installing something that requires (or strongly suggests) reboot (e.g., new kernel)
Oh well... :P
TomRoche

Re: how to fix USB hotplug automount fail? (besides reboot)

Post by TomRoche »

TomRoche wrote:Infrequently, and inadvertently, I will sleep the laptop while the player is still USB-attached :-( I can still wake the laptop, and all seems well, but if I subsequently plugin the MP3 player ... nothing happens. I can manually mount the player's USB drives, but that's tedious.
jdackle wrote:what laptop (brand and model)
Clevo M762TUN (Chinese whitebox special :-)
jdackle wrote:The basic requirement for the operation to be trouble-free seems to release (or stop or unmount, whatever) the USB interfaces before suspending and bringing them back on only after everything else (or most everything) has been woken up.
seems reasonable
jdackle wrote:The package laptop-mode-tools provides some handy scripts to automagically handle this and other things. Have you had a look at it?
I thought [url=http://samwel.tk/laptop_mode/]laptop-mode-tools[/url] was only about power management, and I run my laptop mostly on AC, not battery. But I'll try pinging [url=http://samwel.tk/laptop_mode/mailinglist]the laptop-mode-tools maillist[/url]
TomRoche wrote:[Infrequently] wake-from-sleep fails: [the laptop] "wakes" to black screen, and I cannot get either a tty or X display
jdackle wrote:The pm-utils package (installed by default) includes (besides pm-suspend, pm-hibernate, etc) a folder named "/usr/lib/pm-utils/video-quirks/" full of workarounds for several, well, quirks related to many different brands of laptops. I don't remember how to use them anymore, but I'm sure someone will be able to help you
thanks, I've now [url=http://forums.linuxmint.com/viewtopic.php?f=199&t=140871]posted separately about that[/url]
jdackle

Re: how to fix USB hotplug automount fail? (besides reboot)

Post by jdackle »

Ha, my first laptop (and my ever first machine running Linux too!) was a Clevo. As a sidenote, another "source" name for them is Kapok. Anything that you find for a Kapok that has the same model name as your Clevo, you can bet is the exact same machine.
Any other brand name/model they might be sold as means basically nothing. Clevo / Kapok is /are the official brand. :wink:
My model was a different one though (C2100 or C3100 or something like that). Other than the painbringer winmodem it came with, was quite alright, til the EPROM broke, twice. :(

Anyhow, look in your /etc/acpi. It's full of scripts you can read, learn from and ... oh sweetness ... change. I don't remember how, but the pm-utils package on my old laptop had manage to slip itself (scripts of it) into that folder-tree...
My /etc/acpi:

Code: Select all

actions           batterybtn.sh       lockbtn.sh   powerbtn-acpi-support.sh  sleep_suspend.sh               videobtn.sh
always-mute.sh    ejectbtn.sh         mailbtn.sh   power.sh                  sonybright.sh                  voldownbtn.sh
asus-brn-down.sh  events              mediabtn.sh  prevbtn.sh                stopbtn.sh                     volupbtn.sh
asus-brn-up.sh    ibm-wireless.sh     mutebtn.sh   rotatescreen.sh           thinkpad-stretchortouchpad.sh  webbtn.sh
asus-touchpad.sh  if-asus-not-eee.sh  nextbtn.sh   screenblank.sh            tosh-wireless.sh
asus-wireless.sh  lid.sh              playbtn.sh   sleep_suspendbtn.sh       undock.sh
/etc/acpi/events (the ACPI daemon or whatever) will call these scripts when the corresponding events happen:

Code: Select all

ac                    asus-wireless-off   lm_ac_adapter          sony-eject        thinkpad-volume-down    tosh-media
asus-brightness-down  asus-wireless-on    lm_battery             sony-mute         thinkpad-volume-up      tosh-next
asus-brightness-up    asus-wireless-wlan  lm_lid                 sony-sleep        thinkpad-wireless-wlan  tosh-play
asus-f8sv-touchpad    battery             panasonic-lockbtn      sony-volume-down  tosh-battery            tosh-prev
asus-media-eject      ibm-wireless        powerbtn-acpi-support  sony-volume-up    tosh-hibernate          tosh-stop
asus-rotate           lenovo-touchpad     sleepbtn               suspendbtn        tosh-ibutton            tosh-wireless
asus-touchpad         lenovo-undock       sony-brightness-down   thinkpad-cmos     tosh-lock               tosh-www
asus-video            lidbtn              sony-brightness-up     thinkpad-mute     tosh-mail
/etc/acpi/actions (the events scripts are configured to call certain actions, they work like switches to the correct actions to be performed):

Code: Select all

lm_ac_adapter.sh  lm_battery.sh  lm_lid.sh
Different packages installed on your system will meddle with those files too. I'm runnin a DIY desktop with a motherboard (ASUS P8H77-M) whose Super I/O chip is apparently too new for the 3.2 series of the Linux kernel... So there's not much to see actually on my /etc/acpi folders... Your could have a lot more... :wink:
TomRoche

Re: how to fix USB hotplug automount fail? (besides reboot)

Post by TomRoche »

TomRoche wrote:I'll try pinging [url=http://samwel.tk/laptop_mode/mailinglist]the laptop-mode-tools maillist[/url]
[url=http://mailman.samwel.tk/pipermail/laptop-mode/2013-July/000679.html]Their response[/url] is not much use to me now--I just don't have time free to fiddle with systemd.
jdackle wrote:look in your /etc/acpi. It's full of scripts
Not mine, alas:

Code: Select all

$ find /etc/acpi/ | wc -l
4
$ find /etc/acpi/
/etc/acpi/
/etc/acpi/events
/etc/acpi/events/powerbtn-acpi-support
/etc/acpi/powerbtn-acpi-support.sh
$ find /etc/acpi/ -type f | xargs fgrep -ie 'usb' | wc -l
0
Locked

Return to “LMDE Archive”