Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GNOME: too much automounting
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
Kobboi
l33t
l33t


Joined: 29 Jul 2005
Posts: 672
Location: Belgium

PostPosted: Sat Dec 06, 2008 12:23 pm    Post subject: GNOME: too much automounting Reply with quote

In GNOME 2.24, my Windows partition gets automounted (it is not in /etc/fstab). How do I prevent automounting of that partition, without losing the ability of having my other devices (mostly USB sticks and drives) automounted?
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1957
Location: 127.0.0.1

PostPosted: Sat Dec 06, 2008 12:58 pm    Post subject: Reply with quote

Hi,

HAL stuff :
Code:

$ cat /etc/hal/fdi/policy/99-personal-rules.fdi
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
    <!-- Auto-mount only removable media -->
    <device>
        <match key="storage.hotpluggable" bool="false">
            <match key="storage.removable" bool="false">
                <merge key="storage.automount_enabled_hint" type="bool">false</merge>
            </match>
        </match>
    </device>
</deviceinfo>
Back to top
View user's profile Send private message
Kobboi
l33t
l33t


Joined: 29 Jul 2005
Posts: 672
Location: Belgium

PostPosted: Sun Dec 07, 2008 1:24 pm    Post subject: Reply with quote

Thanks, that worked. So what I saw was normal default behavior?
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1957
Location: 127.0.0.1

PostPosted: Sun Dec 07, 2008 3:30 pm    Post subject: Reply with quote

Yes. Default configuration of hal : if something is mountable but not mounted and not defined in /etc/fstab, then flag automount = true.
gnome-mount read HAL informations at login, and do it's job accordingly.
Back to top
View user's profile Send private message
Aszrael
Tux's lil' helper
Tux's lil' helper


Joined: 15 Feb 2005
Posts: 101
Location: Hannover/Germany

PostPosted: Wed Dec 17, 2008 3:10 pm    Post subject: Reply with quote

Thanks a lot!
Is there also a way to prevent a specific USB-Device from automounting?
I use pam_usb and don't want the USB-Stick containing my auth-code to be mounted everytime it is plugged in, but all other USB-Devices to act "normally".

Aszrael
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1957
Location: 127.0.0.1

PostPosted: Wed Dec 17, 2008 4:57 pm    Post subject: Reply with quote

Yes, easy. When you plugged-in your usb-stick, the kernel gives a name for the device, for example /dev/sdd. You can get it with dmesg.
Then you can run the following command to get HAL informations (here is relevant informations for my usb stick) :
Quote:

$ hal-device $(hal-find-by-property --key block.device --string /dev/sdd)
udi = '/org/freedesktop/Hal/devices/storage_serial_ChipsBnk_Flash_Disk_0_0'
storage.firmware_version = '2.00' (string)
storage.lun = 0 (0x0) (int)
storage.removable.media_size = 1046609408 (0x3e61fe00) (uint64)
info.vendor = 'ChipsBnk' (string)
storage.partitioning_scheme = 'mbr' (string)
info.addons = { 'hald-addon-storage' } (string list)
linux.hotplug_type = 3 (0x3) (int)
info.product = 'Flash Disk' (string)
info.udi = '/org/freedesktop/Hal/devices/storage_serial_ChipsBnk_Flash_Disk_0_0' (string)
block.device = '/dev/sdd' (string)
block.major = 8 (0x8) (int)
info.interfaces = { 'org.freedesktop.Hal.Device.Storage.Removable' } (string list)
block.minor = 48 (0x30) (int)
block.is_volume = false (bool)
storage.bus = 'usb' (string)
storage.no_partitions_hint = false (bool)
storage.media_check_enabled = true (bool)
info.category = 'storage' (string)
info.capabilities = { 'storage', 'block' } (string list)
storage.automount_enabled_hint = true (bool)
storage.model = 'Flash Disk' (string)
storage.vendor = 'ChipsBnk' (string)
storage.drive_type = 'disk' (string)
storage.originating_device = '/org/freedesktop/Hal/devices/usb_device_204_6025_noserial_if0' (string)
storage.removable = true (bool)
storage.removable.media_available = true (bool)
storage.hotpluggable = true (bool)
linux.sysfs_path = '/sys/block/sdd' (string)
storage.requires_eject = false (bool)
info.parent = '/org/freedesktop/Hal/devices/usb_device_204_6025_noserial_if0_scsi_host_scsi_device_lun0' (string)
storage.removable.support_async_notification = false (bool)
storage.size = 0 (0x0) (uint64)
block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_ChipsBnk_Flash_Disk_0_0' (string)
storage.serial = 'ChipsBnk_Flash_Disk-0:0' (string)

Using these informations, you should be able to write rules for a specific device, using for example the storage.serial string :
Quote:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<!-- Rule for a specific usb stick -->
<device>
<match key="storage.hotpluggable" bool="true">
<match key="storage.removable" bool="true">
<match key="storage.serial" string="ChipsBnk_Flash_Disk-0:0">
<merge key="storage.automount_enabled_hint" type="bool">false</merge>
</match>
</match>
</match>
</device>
</deviceinfo>

This rule means : if the device is hotpluggable, and is removable, and it's serial string match 'ChipsBnk_Flash_Disk-0:0', then flag automount = false.
Should work, untested. Everything is here : http://people.freedesktop.org/~david/hal-spec/hal-spec.html
Back to top
View user's profile Send private message
Aszrael
Tux's lil' helper
Tux's lil' helper


Joined: 15 Feb 2005
Posts: 101
Location: Hannover/Germany

PostPosted: Thu Dec 18, 2008 8:29 am    Post subject: Reply with quote

That's it! Thanks a lot!
I tried to match for volume.uuid, which failed - matching the entire device was the clue

Aszrael
Back to top
View user's profile Send private message
netfab
Veteran
Veteran


Joined: 03 Mar 2005
Posts: 1957
Location: 127.0.0.1

PostPosted: Thu Dec 18, 2008 10:50 am    Post subject: Reply with quote

Aszrael wrote:

I tried to match for volume.uuid, which failed

You probably can do it using indirections, something like this :
Code:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
   <!-- Rule for a specific usb stick -->
   <device>
      <match key="volume.uuid" string="e4191178-6ab3-4998-b06a-1097288442c1">
         <merge key="@info.parent:storage.automount_enabled_hint" type="bool">false</merge>
      </match>
   </device>
</deviceinfo>

This should work, but again, untested.
The volume.uuid string is associated to the partition on the device, not to the device itself, but the automount flag is associated to the device, not to the partition.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum