LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 09-01-2008, 11:18 PM   #1
pwabrahams
Member
 
Registered: Nov 2005
Location: Deerfield MA
Distribution: OpenSuSE, Kubuntu
Posts: 272

Rep: Reputation: 41
How does automount / unmount work for USB memory sticks?


I'm running Kubuntu Hardy Heron 8.04 and I'm having trouble with getting my USB memory sticks to mount automatically when I insert them and unmount automatically when I remove them. I'd have more hope of fixing the problem if I understood what software components are involved in the process, but I haven't been able to locate an explanation of that. Where can I learn about how automounting works?
 
Old 09-01-2008, 11:29 PM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Automatic mounting in modern distributions makes use of the HAL and UDEV systems. HAL is an abstraction layer which notifies the system as to what devices have been connected and disconnected. UDEV is a system designed to automate the creation and removal of devices nodes (the files under /dev) which are required to address devices under Linux.

These two systems work in conjunction with your desktop environment to automount new devices. It is important to understand that HAL and UDEV themselves do not actually mount devices, or access them at all. It is up to your desktop environment to pull it all together. In other words, your DE is going to listen for HAL events, and then go ahead and mount the device with the device node created by UDEV. If your desktop environment is not built to support this (for example, FluxBox) it doesn't matter if HAL and UDEV are working, nothing is going to happen. In that case you would need a stand-alone HAL event manager like ivman.

Now, presumably, you are running KDE. KDE is HAL-aware, so the problem isn't a lack of support in your environment. It could be a permissions issue, or the HAL daemons might not be running. It probably isn't a UDEV problem, as you would likely have more issues than just USB mounting if UDEV wasn't functioning properly. Of course it is impossible to say for sure without more details on the problem you are having.

Last edited by MS3FGX; 09-01-2008 at 11:32 PM.
 
Old 09-01-2008, 11:45 PM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
There are four quick things to check.
  1. You don't use "noacpi" boot option. This will prevent the HAL and DBUS daemons from running.
  2. The hald and dbusd daemons are running. Look at "ps -u root" to find out.
  3. Monitor the kernel messages with "sudo tail -f /var/log/messages" and then insert the drive. It may indicate what the problem is.
  4. Check the filesystem on the pendrive. Can you mount it manually?

Which "callout" that HAL uses when you insert the disk depends on the desktop environment you use. You might want to indicate which desktop you use. KDE has a service that runs in the background listening for messages from the hal daemon.

Also, if the drive is listed in /etc/fstab, hal won't mount it automatically.

Another thing to check is the hidden files in /media/.

There are two files, .hal-mtab and .hal-mtab-lock. A stale entry might also cause a problem. Eject all external media and the delete these files if they don't disappear.

If when monitoring /var/log/messages, the device node of the partition is given, you could try mounting it with the halmount command. It is udev that creates the device node. If a device node is working, then udev must be working.

For example: "halmount /dev/sdb1"

It might also help if you posted the output of "sudo /sbin/chkconfig -l".

If you use kde 3.5, then enable the display of unmounted and mounted external drives in desktop properties.

Last edited by jschiwal; 09-02-2008 at 12:02 AM.
 
Old 09-02-2008, 12:44 PM   #4
pwabrahams
Member
 
Registered: Nov 2005
Location: Deerfield MA
Distribution: OpenSuSE, Kubuntu
Posts: 272

Original Poster
Rep: Reputation: 41
Explicit mount works

A big clue to what's going on is that I can mount the USB drive explicitly with, e.g., mount /dev/sdb1 /media/usb1. So if HAL and UDEV are required for an explicit mount, they can't be at fault.

hald isn't running, I found. If I try to start it explicitly, nothing happens -- it doesn't show up in the process list, but there are no messages about it either in /var/log/messages or in the output of dmesg.

I'm running KDE 3.5.10.
 
Old 09-02-2008, 01:10 PM   #5
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Quote:
So if HAL and UDEV are required for an explicit mount, they can't be at fault.
They aren't, at least, HAL isn't. The fact that you have a /dev/sdb device node when you plug the device in would seem to indicate that UDEV is working.

Combined with the other clue you found, I would say HAL probably isn't working properly. Have you tried reinstalling it?
 
Old 09-02-2008, 01:27 PM   #6
pwabrahams
Member
 
Registered: Nov 2005
Location: Deerfield MA
Distribution: OpenSuSE, Kubuntu
Posts: 272

Original Poster
Rep: Reputation: 41
hal reinstallation fails!

I tried reinstalling hal and got the message:
Code:
subprocess post-installation script returned error exit status 1
Where do I go from here?

I guess hal isn't working right.
 
Old 09-05-2008, 05:05 PM   #7
pwabrahams
Member
 
Registered: Nov 2005
Location: Deerfield MA
Distribution: OpenSuSE, Kubuntu
Posts: 272

Original Poster
Rep: Reputation: 41
Hal working now, but still no automount notification

I finally got hal working again -- the problem was an improperly designed configuration file in /etc/dbus-1/system.d/hal.conf (contradictory permissions). I can get automounting by installing usbmount, so that /dev/sdb1 is correctly mounted on /media/usb0. However, there is no desktop notification that the mount has taken place. That's not too surprising since usbmount is advertised as a lightweight solution to the automount problem.

Without usbmount, when I insert a USB memory stick into the machine, hal definitely knows about it since it shows up in the lshal listing. However, it isn't automounted.

So I'm still wondering which system component is supposed to pick up on the mount and issue the notification. Whatever it is, it's falling down on the job (and pre-Hardy, it was working).

Last edited by pwabrahams; 09-05-2008 at 11:46 PM. Reason: typo in critical place
 
  


Reply

Tags
automount, usb


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
udev handling of usb memory sticks kscott121 Linux - Software 4 12-27-2007 05:49 PM
automount usb memory on corelinux davidkline Linux - Newbie 3 01-14-2006 05:35 PM
Conflicting results with usb memory sticks Taliesin Linux - Hardware 4 03-31-2005 01:43 AM
USB memory sticks island_dude Linux - Hardware 1 01-20-2004 12:16 PM
Memory Sticks and Dig Cam wont Share the USB :( mudelf Linux - General 0 11-07-2003 02:48 AM


All times are GMT -5. The time now is 04:14 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration