Bug 113787

Summary: Automounting Olympus Cameras (others too) on Gnome
Product: [Fedora] Fedora Reporter: Alexandre Strube <surak>
Component: hotplugAssignee: Bill Nottingham <notting>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1CC: exodus, ihok, johnp, mitr, redhat.bugzilla, rvokal, yqu
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-11-14 14:28:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexandre Strube 2004-01-18 01:59:51 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031202

Description of problem:
Olympus (as many other digital cameras implementing usb mass storage)
are not mounted automagically in fedora. Most of it are correctly
found as usb devices, so you can manually mount it, usually in
/dev/sda1. This bugzilla entry gives some insights (as well as a
partial solution for it)

Version-Release number of selected component (if applicable):
hotplug-2003_08_05-1

How reproducible:
Always

Steps to Reproduce:
1. Plug a camera
2. Messages are generated in /var/log/messages
3. Nothing else happens
    

Actual Results:  Nothing.

Expected Results:  The camera icon appear on desktop automatically.

Additional info:

For making olympus cameras be automounted, change 
/etc/updfstab.conf.default from...
device camera {
    partition 1
    match   hd DSC
    match   hd CAMERA
}
to...
device camera {
    partition 1
    match   hd DSC
    match   hd CAMERA
    match   hd OLYMPUS}

updfstab would now add an entry to /etc/fstab. But that's not all.

The script /etc/hotplug/usb/usb-storage would be executed when the
camera is added, but Fedora don't have this script, nor it's called in
Fedora anyway.

This is because /etc/hotplug/usb.usermap shipped with Fedora has only
comments - copying every line containing "usb-storage" from
/lib/modules/[KERNEL VERSION]/modules.usbmap makes
/etc/hotplug/usb/usb-storage be executed.

Now the missing part is build up a proper /etc/hotplug/usb/usb-storage
that can correctly mount and umount the camera.

To mount, just mount a /mnt/camera, and that's ok. The problem now is
that the camera is not unmounted when it was unplugged and, in fact,
only root can umount it which it inconvenient.

It turns outs that hotplug sets a variable called $REMOVER which you
can access in the hotplug script ( /etc/hotplug/usb/usb-storage) which
is the path of the script that will be executed when the device is
unplugged.  The value of $REMOVER always end up being
/var/run/usb/{cryptic_string}.  So, Jason modified its script to
actually write a removal script to that path which would umount the
camera.  In the end the script at /etc/hotplug/usb/usb-storage looked
like this...
#!/bin/bash
mount /mnt/camera
echo '#!/bin/bash' > "$REMOVER"
echo 'umount /mnt/camera' >> "$REMOVER"
chmod u+x $REMOVER

Problems: 
* /var/run/usb directory not exist on fedora - it needs to be manually
created. 
* Camera is mounted as root, so files cannot be deleted from Nautilus.

This was posted to fedora-list by Jason Cortezzo, just put it here to
make sure this is included on FC2, to make this very nice usability
improvement.

Comment 1 Shawn Iverson 2004-02-03 22:43:10 UTC
Under the section of this bugzilla report where you copy certain 
modules.usbmap to usb.usermap, it is not necessary if the following 
is done (specifically with the Lexar Jumpdrive, but should affect ALL 
usb-storage devices):

Edit the /etc/hotplug/hotplug.functions do the following:

Move the following script lines up:

    if echo "$MODULE" | grep -q "usb-storage" > /dev/null 2>&1 ; then
            [ -x /usr/sbin/updfstab ] &&  /usr/sbin/updfstab
    fi

Move them right above this section:

      if [ -x $HOTPLUG_DIR/$TYPE/$MODULE ]; then
            debug_mesg Module setup $MODULE for $DESCRIPTION
            $HOTPLUG_DIR/$TYPE/$MODULE
            LOADED=true
      fi

The $HOTPLUG_DIR/$TYPE/$MODULE translates to the /etc/hotplug/usb/usb-
storage script.  It executes mount as indicated in bugzilla #113787, 
but nothing mounts because no entry is made in /etc/fstab.  The 
reason that the usb.usermap workaround works is because the usb.agent 
script calls load_drivers () again for the contents of usb.usermap, 
and since the entry has been made, the mount succeeds.

As for the root problem, I am trying to figure out how the /dev/fd0 
device becomes owned by the current user.  If I can figure this out 
then the rest should be history.

Comment 2 Damian Christey 2004-02-11 19:20:42 UTC
Device nodes such as /dev/fd0 get their permissions changed when a
user logs in, by a pam module the name of which I forget at the
moment... but the settings for it are contained in
/etc/security/console.perms

Hope that helps...

Comment 3 Alex Thomsen Leth 2004-05-03 16:01:36 UTC
will this feature be included in fc2 ??

Comment 4 Bill Nottingham 2004-05-03 18:42:49 UTC
There haven't been any changes made locally in this area.


Comment 5 Alexandre Strube 2004-05-03 20:35:57 UTC
This is about usability, something which differentiates all Redhat's
distributions from the rest. Why not make this change then?

Comment 6 HaJo Schatz 2004-06-21 19:23:31 UTC
If I understand correctly, this feature assumes that you unmount the
camera *after* it's been unplugged. How, then, is the kernel supposed
to flush the cache to the drive? I.e. this calls for data corruption,
doesn't it?

Comment 7 Alexandre Strube 2004-06-22 03:26:18 UTC
What difference does it make? The filesystem is mounted as root, so
it's read only...

Comment 8 Bryan W Clark 2004-08-13 06:42:43 UTC
I'm adding J5 to the CC of this bug as I suspect it has probably
already been partially solved with the new drop of
HAL/D-BUS/fstab-sync coming in rawhide.

Comment 9 John (J5) Palmieri 2004-08-13 15:42:21 UTC
Once gnome-volume-manager is in this should be for the most part
solved.  Only thing left is to make a libgphoto VFS module so that
cameras that are not exported as mass storage can also be used with ease.

Comment 10 Alexandre Strube 2004-08-15 19:47:08 UTC
Just upgraded from Fedora 1 to fedora 2. The Olympus is still not part
of updfstab.conf , altough sony has been added. Is there any issue
with olympus that we are not aware of?

The usb-storage still needs to be created. Well, not quite a progress.
Just booted a open version of Xandros and all of this went up
automatically (including the printer installation assistant when I
plugged it in). 

Come on, this is not sooo damn complicated to be in bugzilla for more
than one release of fedora.

Comment 11 John (J5) Palmieri 2004-08-16 14:50:32 UTC
Check out rawhide.  If your Olympus is mass storage it will add it to
/etc/fstab. As my comment says above, once g-v-m is in , which should
be sometime this week, it will also be automounted.  All this takes a
huge amount of work to do correctly, please be patient.

Comment 12 Damian Christey 2004-11-14 08:36:37 UTC
g-v-m fixes this in Fedora Core 3.

Comment 13 Alexandre Strube 2004-11-14 15:11:14 UTC
It does not automount. It appears at "MY Computer", which is quite
different. You still have to mount it manually, or clicking its icon
twice.

Comment 14 John (J5) Palmieri 2004-11-14 15:33:05 UTC
It should pop up with an import photo dialog.  It should also
automount it as long as you have gnome-volume-manager installed.

Comment 15 Yunyun Qu 2008-10-09 08:23:54 UTC
Is this problem solved? A customer encountered the same problem and didn't know how to solve it. The OS release is RHEL5.0.

(In reply to comment #13)
> It does not automount. It appears at "MY Computer", which is quite
> different. You still have to mount it manually, or clicking its icon
> twice.