# hald(1) and nautilus(1) does not automount media



## vermaden (Oct 2, 2009)

No matter what setups I have tried I am not able to get *nautilus(1)* to automount media with *hald(1)*, thats strange since I have got working setup in the past ...

Below is my setup, config files, ...

*/etc/rc.conf*

```
font8x14="iso02-8x14"
font8x16="iso02-8x16"
font8x8="iso02-8x8"
keymap="pl_PL.ISO8859-2"
keyrate="fast"
scrnmap="NO"
allscreens_flags="MODE_34"

moused_enable="YES"
sshd_enable="YES"
powerd_enable="YES"
hald_enable="YES"
dbus_enable="YES"
polkitd_enable="YES"

hostname="mavio"
devd_enable="YES" 
devfs_system_ruleset="devfsrules_common"
```

*/etc/sysctl.conf*

```
hw.syscons.bell=0
kern.coredump=0
vfs.usermount=1
```

*/etc/devfs.conf* (taken from PC-BSD 7.1.1)

```
# Commonly used by many ports 
link	cd0	cdrom 
link	cd0	dvd 
 
# Allow a user in the wheel group to query the smb0 device 
#perm	smb0	0660 
 
# Allow all users to access CD's  
perm	/dev/acd0	0666 
perm	/dev/acd1	0666 
perm	/dev/cd0	0666 
perm	/dev/cd1	0666 
 
# Allow all USB Devices to be mounted 
perm	/dev/da0	0666 
perm	/dev/da1	0666 
perm	/dev/da2	0666 
perm	/dev/da3	0666 
 
# Misc other devices 
perm	/dev/pass0 	0666 
perm	/dev/xpt0	0666 
perm	/dev/agpart	0666
perm	/dev/uscanner0  0666
```

*/etc/devfs.rules* (taken from PC-BSD 7.1.1)

```
[devfsrules_common=7] 
add path 'ad*'    mode 666 group operator 
add path 'acd*'   mode 666 group operator 
add path 'cd*'    mode 666 group operator 
add path 'pass*'  mode 666 group operator 
add path 'xpt*'	  mode 666 group operator 
add path 'ugen*'  mode 666 group operator
add path 'usb*'   mode 666 group operator
add path 'fd*'    mode 666 group operator
add path 'uscan*' mode 666 group operator
```

*/usr/local/etc/PolicyKit/PolicyKit.conf* (none of these versions work)

```
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->

<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">

<config version="0.1"> 
  <define_admin_auth group="operator"/> 
  <match action="org.freedesktop.hal.storage.mount-removable"> 
    <match user="vermaden">
      <return result="yes"/> 
    </match> 
  </match> 
  <match action="org.freedesktop.hal.storage.mount-fixed"> 
    <match user="vermaden">
      <return result="yes"/> 
    </match> 
  </match> 
  <match action="org.freedesktop.hal.storage.eject"> 
    <match user="vermaden">
      <return result="yes"/> 
    </match> 
  </match> 
</config>
```

*/usr/local/etc/PolicyKit/PolicyKit.conf* (none of these versions work)

```
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->

<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">

<config version="0.1"> 
  <define_admin_auth group="operator"/> 
  <match action="org.freedesktop.hal.storage.mount-removable"> 
    <return result="yes"/> 
  </match> 
  <match action="org.freedesktop.hal.storage.mount-fixed"> 
    <return result="yes"/> 
  </match> 
  <match action="org.freedesktop.hal.storage.eject"> 
    <return result="yes"/> 
  </match> 
</config>
```

*/usr/local/etc/hal/fdi/policy/preferences.fdi* (added from PC-BSD 7.1.1)

```
<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
 
<device>
 <match key="volume.fstype" string="vfat">
  <match key="volume.size" compare_ge="128000000000">
    <merge key="volume.policy.mount_option.large" type="bool">true</merge>
  </match>
 </match>
</device>

</deviceinfo>
```

*/usr/local/share/hal/fdi/policy/20thirdparty/10-mouse-sysmouse.fdi* (added from PC-BSD 7.1.1)

```
<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">
  <device>
    <match key="freebsd.driver" string="ums">
      <match key="freebsd.unit" int="0">
        <merge key="info.ignore" type="bool">true</merge>
      </match>
    </match>
  </device>
</deviceinfo>
```

*mavio# mount*

```
/dev/ad4s2a on / (ufs, local)
devfs on /dev (devfs, local, multilabel)
/dev/ad4s2e on /usr (ufs, local, soft-updates)
/dev/ad4s2d on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
```

*/etc/fstab *

```
# Device		Mountpoint	FStype	Options		Dump	Pass#
/dev/ad4s2b		none		swap	sw		0	0
/dev/ad4s2a		/		ufs	rw		1	1
/dev/ad4s2e		/usr		ufs	rw		2	2
/dev/ad4s2d		/var		ufs	rw		2	2
/dev/acd0		/cdrom		cd9660	ro,noauto	0	0
proc			/proc		procfs	rw		0	0
```

Output of *hald --verbose=yes --daemon=no* command: http://pastebin.com/f330ca20f

*dmesg(1)* output with pendrive in: http://pastebin.com/f5bf9d125

Output of: *gnome-mount --block --no-ui --verbose --hal-udi /org/freedesktop/Hal/devices/storage_model_DataTraveler_2_0*

```
gnome-mount 0.8
** Message: Drive /org/freedesktop/Hal/devices/storage_model_DataTraveler_2_0 does not contain media.
```

During the output gathering, pendrive was connected (KINGSTON), then it was disconected, then, again connected.

All I want to achieve is to get *nautilus(1)* (standalone without GNOME) automount media with *hald(1)*.

I have read HAL FAQ again and again but that still does not helps:
http://www.freebsd.org/gnome/docs/halfaq.html

PC-BSD 7.1.1 automounts media without any problems on that box, but nautilus(1) is no go, even after *portmaster -r -p nautilus*.

Thanks in advance for any input.


----------



## SirDice (Oct 2, 2009)

Are those devices in /etc/fstab? If they are remove them. Hal/nautilus doesn't mount anything that's in fstab.


----------



## vermaden (Oct 2, 2009)

@SirDice

I have added *dmesg(1)* output, */etc/fstab* listing, and *mount(1)* output.

Checking the HAL FAQ it can mount media that is in /etc/fstab:


> Step 4: While not really part of hal volume management, you may also be able to have volumes listed in /etc/fstab automatically mounted. In GNOME, for example, Nautilus will mount volumes listed in /etc/fstab provided the following conditions are met:
> The vfs.usermount sysctl is set to 1.
> The user requesting the mount owns the mount point.
> The user requesting the mount is in the "operator" group.
> ...



But that is not the case here, the pendrive is NOT in */etc/fstab*.


----------



## SirDice (Oct 2, 2009)

Remove all that stuff you added from pc-bsd.

Here's what I have and that seems to work:

devfs.conf:

```
perm cd* 0660
perm pass* 0660
perm xpt0 0660
```

I don't have a devfs.rules.


```
cat /usr/local/etc/PolicyKit/PolicyKit.conf
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- XML -*- -->

<!DOCTYPE pkconfig PUBLIC "-//freedesktop//DTD PolicyKit Configuration 1.0//EN"
"http://hal.freedesktop.org/releases/PolicyKit/1.0/config.dtd">

<!-- See the manual page PolicyKit.conf(5) for file format -->

<config version="0.1">
    <match user="root">
	<return result="yes"/>
    </match>
    <define_admin_auth group="wheel"/>
    <match action="org.freedesktop.hal.storage.mount-removable">
        <match user="dice">
    		<return result="yes"/>
        </match>
    </match>
    <match action="org.freedesktop.hal.storage.mount-fixed">
        <match user="dice">
      		<return result="yes"/>
  	</match>
    </match>
    <match action="org.freedesktop.hal.storage.eject">
	<match user="dice">
		<return result="yes"/>
	</match>
    </match>
</config>
```

Make sure you have a /media directory:

```
ls -ld /media/
drwxr-xr-x  2 root  wheel  512 Sep 20 23:38 /media/
```

Check with gconf is auto mount is turned on 
Apps -> nautilus -> preferences
Look for media_automount and related keys.

Make sure your user is a member of operator:

```
>id -a
uid=1001(dice) gid=1001(dice) groups=1001(dice),5(operator)
```

That should do it.


----------



## vermaden (Oct 2, 2009)

@SirDice

Thanks, I will check it a fast as possible.


----------



## vermaden (Oct 2, 2009)

With that procedure:
1. put all configs on their place
2. (re)start dbus
3. (re)start hald
4. start x11 as regular user
5. start nautilus
6. plugin pendrive (should automount)​
*dmesg(1)* after plugging pendrive:

```
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <Corsair Flash Voyager 1100> Removable Direct Access SCSI-0 device 
da0: 40.000MB/s transfers
da0: 3840MB (7864320 512 byte sectors: 255H 63S/T 489C)
GEOM: da0: partition 1 does not start on a track boundary.
GEOM: da0: partition 1 does not end on a track boundary.
```

*dmesg(1)* after unplugging pendrive:

```
ugen6.2: <Corsair> at usbus6 (disconnected)
umass0: at uhub6, port 1, addr 2 (disconnected)
(da0:umass-sim0:0:0:0): lost device
(da0:umass-sim0:0:0:0): removing device entry
```



> Check with gconf is auto mount is turned on
> Apps -> nautilus -> preferences
> Look for media_automount and related keys.




```
% gconftool-2 -R /apps | grep media
   media_autorun_x_content_open_folder = []
   media_automount = true
   media_autorun_never = false
   media_autorun_x_content_ignore = []
   media_automount_open = true
   media_autorun_x_content_start_app = [x-content/software]
```

I have also done: *portmaster -r -p hald*


```
FreeBSD mavio 8.0-RC1 FreeBSD 8.0-RC1 #0: Thu Sep 17 20:45:19 UTC 2009     root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
```

Still no go, *nautilus(1)* does not automount the pendrive.

Should I consider it as 8.0-RC1 bug?


----------



## plamaiziere (Oct 3, 2009)

vermaden said:
			
		

> With that procedure:
> 1. put all configs on their place
> 2. (re)start dbus
> 3. (re)start hald
> ...



With usb stick you must use devfs.rules, devfs.conf is applied only at startup.


----------



## vermaden (Oct 3, 2009)

@plamaiziere

I have tried /etc/devfs.rules also, check first post for details.


----------



## bboozzoo (Oct 25, 2009)

hmm same behaviour here. funny though, if the USB flash is inserted before logging into gnome, the drive gets mounted. If I insert it after logging in, the drive does not appear in nautilus.

There is though some traffic seen by dbus-monitor.


```
signal sender=:1.26 -> dest=(null destination) serial=23 path=/org/gtk/Private/RemoteVolumeMonitor; interface=org.gtk.Private.RemoteVolumeMonitor; member=DriveConnected
   string "org.gtk.Private.HalVolumeMonitor"
   string "0x28599660"
   struct {
      string "0x28599660"
      string "Mass Storage Drive"
      string ". GThemedIcon drive-removable-media drive-removable drive"
      boolean false
      boolean false
      boolean true
      boolean false
      boolean false
      array [
      ]
      array [
         dict entry(
            string "hal-udi"
            string "/org/freedesktop/Hal/devices/computer_storage"
         )
         dict entry(
            string "unix-device"
            string "/dev/da0"
         )
      ]
   }
```


----------



## vermaden (Oct 25, 2009)

bug submitted: http://freebsd.org/cgi/query-pr.cgi?pr=139972


----------



## varnie (Nov 25, 2009)

i have just discovered this thread.
i have in general the same issue but i use:

*FreeBSD 8.0 Release
Xfce4 4.6.1 
XDM*
.

tried every possible ways i've come up with but still unable to automount any media (flash mp3 players, DVD-ROM).


----------



## vermaden (Nov 25, 2009)

@varnie

Then add your thoughts to bug-info:
http://freebsd.org/cgi/query-pr.cgi?pr=139972


----------



## varnie (Nov 29, 2009)

good news, *vermaden*!

there's a new version of hal in ports-tree available on this moment: hal-0.5.13. i've just updated my ports and now i am able to auto-mount my USB devices in XFCE. please give it a try and write back.


----------



## graudeejs (Nov 29, 2009)

varnie said:
			
		

> good news, *vermaden*!
> 
> there's a new version of hal in ports-tree available on this moment: hal-0.5.13. i've just updated my ports and now i am able to auto-mount my USB devices in XFCE. please give it a try and write back.



I don't think he's fancy about hal.


----------



## varnie (Nov 29, 2009)

*killasmurf86*
i don't think he's not interested in getting new info about the problem he has discovered.


----------



## vermaden (Nov 29, 2009)

@varnie

I have received that info on email after closing the bug, but thanks for info, I will check that in free time.

@killasmurf86 / @varnie

Both of You are right 

I am not fancy about hal [we will see what inmproovements (or problems) will DeviceKit create], but I wanted to check how it will work with automount (generally I use that only for pendrives, and I have had mount/umount options in fluxbox menu.


----------

