How do I disable automount for removable devices in Hardy??

Asked by mortenvp

In the good, old gutsy-days I was able to disable automount for external devices from "system" > "preferences" > "removable drives and media". There was a "storage"-tab where I could unmark the automount-feature. The storage-tab is gone in Hardy (along with the multimedia-tab, which is now found in Nautilus), so now I'm stuck with a system, that keeps mounting USB/Firewire-devices, flashcards etc. How do I disable this feature?????

By the way - my internal volumes doesn't mount automatically, so I'm not looking for help to configure my .fstab...

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Max Schukin
Solved:
Last query:
Last reply:
Revision history for this message
Max Schukin (schukin) said :
#1

Hi,

Run Nautilus and open Edit => Preferences > Media.
Turn off "Browse media when inserted".

Hope this helps.

Revision history for this message
mortenvp (mortenvp) said :
#2

Thanks, but unfortunatly it doesn't help.

Turning off "Browse media when inserted" prevents Nautilus from opening the inserted media and showing the content, but the media will still be mounted when inserted....

Revision history for this message
Best Max Schukin (schukin) said :
#3

There is a solution but you will have to enter your password every time you want to mount a removable device:
1. Press Alt+F2 and enter:
polkit-gnome-authorization
2. Go to Storage => Mount file systems from removable drivers
3. Press the "Edit..." button
4. Choose "Active Console: Authentication"
5. Press the "Modify..." button

Revision history for this message
mortenvp (mortenvp) said :
#4

Thanks Max.

It used to be so easy and now it suddenly has to be difficult - wonder why...

It's very important for me to get rid of the automounting, so I will live with having to enter my password and consider the problem solved.

Thanks again - I'd never had figured that one out...:-)

Revision history for this message
mortenvp (mortenvp) said :
#5

Thanks Max Schukin, that solved my question.

Revision history for this message
Max Schukin (schukin) said :
#6

You are welcome =)

Revision history for this message
Michael Spencer (xixsixxix) said :
#7

Editing the authorization settings seems a bit extreme ;)

Instead, turn off Nautilus' auto-mounting of external media:

$ gconf-editor

apps > nautilus > preferences
Uncheck the "media_automount" option

Revision history for this message
Matt Hurne (mhurne) said :
#8

I prefer Michael Spencer's solution. Because of the things I use my system for on a daily basis, I don't want ANYTHING automatically mounted, ever. Unless I want it mounted at boot, but I handle that in my fstab. Michael's solution accomplished this for me. I wish I could enable the auto mounting, actually, 'cause its sweet. Oh well. :-(

Revision history for this message
mortenvp (mortenvp) said :
#9

Hi Michael,

Just what I needed - now it works exactly as I wanted....:-)

Revision history for this message
Michael Spencer (xixsixxix) said :
#10

Glad I could help =)

Revision history for this message
psypher (psypher246) said :
#11

What happened to the easy option in Systems\Preferences\Revomable Drives and Media???

That used to be the simplest way of disabling automounting for various reasons like when it causes absolute havoc and confusion when trying to partition drives with gparted.

Please could a tab be replaced for external drives AND disc media on that Removable drives and media app. It's the logical place to put it and is EXTREMELY useful!

Revision history for this message
Vivek Kapoor (marquivon) said :
#12

I second psypher

I was trying to network boot a USB device, and for that I had to partition it. But everytime I made changes in the partition it used to Auto Mount. There's no option under "Systems\Preferences\Revomable Drives and Media" which I thought was really convenient. I think putting the option back into the "Systems\Preferences\Revomable Drives and Media" would be a good idea.

Revision history for this message
Manuel Iglesias Alonso (glesialo) said :
#13

I feel like a helpless Microsoft user when unwanted applications start by themselves (plus error dialog boxes) when I insert a Cd in the drive.
I want to decide what happens when in my system, besides I use a semaphore script to share media (i.e. several applications writing backups in an external H.D.) and the automount fucks things up :-(
I have found a way to inhibit automount: Insert a file (NoAutomountRemovableMedia.fdi) (A symbolic link does not work) in /etc/hal/fdi/policy with the following contents: {
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">
<!--
  The following shows how to hint gnome-volume-manager, and other programs
  that honor the storage.automount_enabled_hint, to not mount media.
  Notes:
    -<match key="storage.removable" bool="true"> does not include optical drives ??
     they have to be named in the following rules.
    -To find out optical drive names run:
     hal-disable-polling device /dev/dvd
     hal-disable-polling device /dev/cdrw
     (Note: device is an option and needs two minus signs in front: Not included
     because interpreted as xml comments) and read generated files in /etc/hal/fdi/information
     (erase above files afterwards)
-->
  <device>
      <match key="storage.removable" bool="true">
        <merge key="storage.automount_enabled_hint" type="bool">false</merge>
      </match>
  </device>

  <device>
    <match key="info.udi" string="/org/freedesktop/Hal/devices/storage_model_LTR_52246S">
        <merge key="storage.automount_enabled_hint" type="bool">false</merge>
    </match>
  </device>

  <device>
    <match key="info.udi" string="/org/freedesktop/Hal/devices/storage_model_XJ_HD165H">
        <merge key="storage.automount_enabled_hint" type="bool">false</merge>
    </match>
  </device>

</deviceinfo>

}

I thought that: {
  <device>
      <match key="storage.removable" bool="true">
        <merge key="storage.automount_enabled_hint" type="bool">false</merge>
      </match>
  </device>
} would be enough but it only works with Flash memories :-(

Now I have another problem and I would appreciate your help:
In earlier Ubuntu distributions when I mounted a second h.d.'s partition an icon appeared in my desktop and the mounted partition appeared in nautilus' side pane. With Ubuntu 7.1 the icon appeared in the desktop but the partition did not show in nautilus. Now with Ubuntu 8.04 the mounted partition does not appear anywhere (mounted loops are shown in the desktop though -it did not happen in earlier Ubuntus). I know it is because of HAL: When hald (HAL daemon) is stopped mounted partitions appear both in the desktop and nautilus.
Any idea of how to tell HAL to, please, pretty please, show them?

Revision history for this message
Manuel Iglesias Alonso (glesialo) said :
#14

Reading files in /usr/share/doc/hal/examples I have found a better way to inhibit automount:

/etc/hal/fdi/policy/NoAutomountRemovableMedia.fdi {
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">

<!--
  The following shows how to hint gnome-volume-manager, and other programs
  that honor the storage.automount_enabled_hint, to not mount removable media.
-->
  <device>
      <match key="storage.removable" bool="true">
        <merge key="storage.automount_enabled_hint" type="bool">false</merge>
      </match>
  </device>

<!--
  The following shows how to hint gnome-volume-manager, and other programs
  that honor the storage.automount_enabled_hint, to not mount optical drives.
-->

  <device>
      <match key="storage.cdrom.cdr" bool="true">
        <merge key="storage.automount_enabled_hint" type="bool">false</merge>
      </match>
  </device>

</deviceinfo>
}

I have checked that the following devices are not automounted {
Usb flash memory.
Usb Digital camera.
Cd and Dvd drives.
}

But if I connect an external H.D. to an Usb port it is still automounted. It seems that HAL finds out it is really a PATA H.D. and does not consider it removable.

I am still trying to make HAL allow the display (In Desktop & nautilus) of mounted partitions of my second (Internal SATA) HD. I would be grateful for any help.

Revision history for this message
browncoat-rabeye (iphonemyass) said :
#15

I am using Hardy Heron on a Samsung Q1U and a U727 Sprint USB modem. When I insert the modem which also has a SD slot built in, it autoloads as a CD device and inorder to use the modem I have to Eject the CD device first then the modem works.

I am looking for a way to disable the autoload and tried the first comment:
Systems\Preferences\Revomable Drives and Media

That didn't work, and then I tried:
$ gconf-editor

apps > nautilus > preferences
Uncheck the "media_automount" option

this didn't work, so I next tried;
polkit-gnome-authorization
2. Go to Storage => Mount file systems from removable drivers
3. Press the "Edit..." button
4. Choose "Active Console: Authentication"
5. Press the "Modify..." button

And that didn't work either.

Going to try Manuel's method (above) next.

Revision history for this message
tz (thomas-mich) said :
#16

If I disable automount either via Nautilus or doing the /etc/hal stuff, when I try to use the panel mounter, I get a box saying "Mount Error", no other text, a DoNotEnter icon, and an OK button. Having a popup every time I insert the drive is also annoying. Gutsy just worked. Now I have to do the equivalent of registry hacks.

In Hardy, the choices are either automounting the half-dozen partitions on my USB mirror drive, or not being able to mount at all except by doing sudo mount commands in a console. This is progress?

I want to have it so when I insert a drive it appears in the panel but does not mount, but when I tell the panel to mount it, it will like I have Gutsy working. This does not appear to be possible in Hardy.

Revision history for this message
Manuel Iglesias Alonso (glesialo) said :
#17

Hi tz!
It is like crying in a desert: nobody hears/answers :-(

I have all devices listed in /etc/fstab and 'mount/umount /media/dvd' (You can create a panel launcher) works without any popups.

In case you want a toggle mount/umount command use this MountUmount shell script {
#!/bin/bash
#Written by Manuel Iglesias. <email address hidden>

CommandName=${0##*/}
fstabFile=/etc/fstab

echoE()
{
echo $* 1>&2
 return 0
}

Usage()
{
echoE "'$CommandName' mounts or umounts a device listed in $fstabFile."
echoE "'$CommandName' checks if MountPoint corresponds to a mounted device."
echoE "If mounted it umounts the device. If unmounted it mounts the device."
echoE "Usage: '$CommandName MountPoint'."
echoE "Note: 'MountPoint' can be a link to MountPoint listed in $fstabFile."
echoE
 return 0
}

if [ $# -ne 1 ] || [ "$1" == "-h" ] || [ "$1" == "-?" ] || [ "$1" == "--help" ] || [ "$1" == "-help" ]
  then
    Usage
    exit 64
fi

MountPoint=`readlink -e $1`
if [ -z "$MountPoint" ]
  then
    MountPoint=$1
fi

MountInfo=`cat $fstabFile | awk '$2 == "'$MountPoint'"'`
if [ -z "$MountInfo" ]
  then
    echoE "$CommandName: $MountPoint not in $fstabFile. Aborting."
    echoE "$CommandName: $fstabFile contents:"
    cat $fstabFile 1>&2
    exit 69
fi

#$MountInfo empty if $MountPoint not mounted
MountInfo=`mount | awk '$3 == "'$MountPoint'"'`
if [ -n "$MountInfo" ]
  then
    umount -l $MountPoint
  else
    mount $MountPoint
fi
}

Revision history for this message
psypher (psypher246) said :
#18

So has anybody tried intrepid yet. Is the really AWESOME feature replaced, where a non technical user could just go click click click and they don't have to mount a USB device when you plug it in. is there anyone at Canonical who can say why they hell this feature was just removed??? Does it not seem like regression for a desktop who claims to want to revolutionize the market. I really truly hope Canocical's new dev team can really look at things like this, because it's things like this that DID make Ubuntu stand out, and it gets removed??????

So yeah I see the thread has been marked solved. Sure you can use a few workarounds, but seriously, a feature dissapearing and the community having to do a workaround is not really solved then?

Really hope Intrepid is leaps and bounds ahead of hardy, which has been really dissapointing and frustrating for someone who uses it and only it all day long

Revision history for this message
mortenvp (mortenvp) said :
#19

I've tried Intreped for 4 weeks now, and the automount problem still exists, so don't expect too much..... You can still install "removable drives and media" (it is not installed by default), but you won't be able to turn off automount for external drives. Michael Spencers solution is still the easiest way to do it.....

Revision history for this message
psypher (psypher246) said :
#20

how do i install "removable drives and media". searched for it in synaptic, found nothing like it. not that it makes a diffrence since you say it doesn't do what it used to do in feisty (i think it was feisty). It's so annoying bragging to a windows user about how awesome this feature was where you could just stop usb devices from mounting and now it's gone.

Revision history for this message
mortenvp (mortenvp) said :
#21

If you want "removable drives and media" installed, follow the instructions here http://blog.appnr.com/help/. After that you can install it directly from here http://appnr.com/ (along with 1785 other applications).

Revision history for this message
John Wiersba (jrw32982) said :
#22
Revision history for this message
John Wiersba (jrw32982) said :
#23
Revision history for this message
Jan Hlodan (wewek) said :
#24

and if I want to enable the auto-mount in Kubuntu 9.04?
I have two external disks pluged in and after start up, they are unmounted. I f I want to mount them all (5 partitions), I need to open them via dolphin (5 times!)
Why Ubuntu mount them automatically during the booting and Kubuntu not?
also see bug: #382830