# udisks !hal automounting

## darkphader

Finally can automount (and eject) with gnome-2.30 without HAL, using udisks but had to apply this patch: http://realcomputerguy.com/gentoo/ to org.freedesktop.udisks.policy which IMO shouldn't be needed as the "allow_active" being set to yes should be sufficient. It appears that udisks does not know who the active users is. The patch simply changes no to yes for "allow_any" in the mount and eject sections.

How to pass the active user to udisks, so that the patch is unnecessary?

Thanks,

Chris

----------

## VoidMage

Not that I'm sure, but does udisks handle that via consolekit ?

----------

## darkphader

 *VoidMage wrote:*   

> Not that I'm sure, but does udisks handle that via consolekit ?

 

Really don't know, although I do have consolekit running.

----------

## M

I think your session must be started with ck-launch-session, like for example

exec ck-launch-session openbox-session 

or gnome, whatever... Try adding that to your session in /etc/X11/Sessions

I read somewhere about some command that you can use to check if your user/session have access to consolekit but I can't remember where and which command it is...

----------

## darkphader

I use 'startx' from the console to bring up gnome.

But my session is listed as active:

```
$ ck-list-sessions 

Session1:

   unix-user = '1000'

   realname = 'Chris Smith'

   seat = 'Seat1'

   session-type = ''

   active = TRUE

   x11-display = ':0'

   x11-display-device = '/dev/tty7'

   display-device = '/dev/tty1'

   remote-host-name = ''

   is-local = TRUE

   on-since = '2010-06-11T02:33:41.471810Z'

   login-session-id = ''

   idle-since-hint = '2010-06-11T03:14:21.300622Z'
```

----------

## darkphader

 *M wrote:*   

> I think your session must be started with ck-launch-session, like for example
> 
> exec ck-launch-session openbox-session 
> 
> or gnome, whatever... Try adding that to your session in /etc/X11/Sessions

 

OK, that helped a bit. Adding it to /etc/X11/Session/Gnome didn't help but I may have done that wrong as I simply replaced

```
exec $command
```

with

```
exec ck-launch-session $command
```

It didn't work at first by using .xinitrc with

```
exec ck-launch-session "gnome-session"
```

 but that turned to be a need to have the console-kit-daemon running before entering startx - even though the daemon will get started upon starting X it doesn't get started soon enough to work properly. So simply adding it to the default run level simplifies that issue.

Two issues remain:

There must be a way to properly use it with /etc/X11/Sessions/Gnome (and other sessions).

and

If I plug in a flashkey with multiple partitions then "Safely Remove Drive" chokes with:

```
Unable to stop drive

Error detaching: helper exited with exit code 1: Detaching device /dev/sde

USB device: /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-6)

SYNCHRONIZE CACHE: FAILED: No such file or directory

(Continuing despite SYNCHRONIZE CACHE failure.)

STOP UNIT: OK

Unbinding USB interface driver: OK

Suspending USB device: FAILED: Cannot open /sys/devices/pci0000:00/0000:00:1d.7/usb5/5-6/power/level for writing: No such file or directory
```

I am guessing that it is due to having more than one partition, I may repartition the flash drive later to test the standard circumstance.

Thanks,

Chris

----------

## darkphader

Haha - when I start Gnome with an ~/.xinitrc containing

```
exec ck-launch-session "gnome-session"
```

 automounting works but my Applications menu is blank :)

----------

## darkphader

So back to ground zero - no automounting or no applications menu, but the crazy thing is that Gnome appears to be properly launched

```
ps ax | grep Gnome

 3143 tty1     S      0:00 /usr/bin/ck-launch-session /etc/X11/Sessions/Gnome
```

without using a custom ~/.xinitrc.

----------

## darkphader

Just adding that automounting works when I use gdm. Why doesn't it work without it?

----------

## red-wolf76

Maybe gdm initializes ck correctly? It is the preferred way (in the GNOME mindset) to run GNOME after all...

----------

## gglaboussole

hi darkphader,

I' have exacty the same problem but I still use hal (My player is banshee and it depends on hal)...

```

Error detaching: helper exited with exit code 1: Detaching device /dev/sdc

USB device: /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1)

SYNCHRONIZE CACHE: OK

STOP UNIT: OK

Unbinding USB interface driver: OK

Suspending USB device: FAILED: Cannot open /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/power/level for writing: No such file or directory

```

So is it a bug ?

----------

## netfab

 *gglaboussole wrote:*   

> 
> 
> ```
> 
> Error detaching: helper exited with exit code 1: Detaching device /dev/sdc
> ...

 

Bump. I hit this bug today. You must probably rebuild your kernel with CONFIG_PM_RUNTIME and CONFIG_USB_SUSPEND.

----------

## darkphader

 *netfab wrote:*   

> Bump. I hit this bug today. You must probably rebuild your kernel with CONFIG_PM_RUNTIME and CONFIG_USB_SUSPEND.

 

I'll try that.

----------

## gglaboussole

For me that's solved the problem    :Smile: 

Merci netfab

----------

## Shocker580

 *netfab wrote:*   

>  *gglaboussole wrote:*   
> 
> ```
> 
> Error detaching: helper exited with exit code 1: Detaching device /dev/sdc
> ...

 

I'have the same problem but in .config(uration) kernel i don't find CONFIG_USB_SUSPEND option for enable. Where is it ?

2.6.37

----------

## swimmer

As said above you also have to enable CONFIG_PM_RUNTIME - you can find that under "Power management and ACPI options -> Run-time PM core functionality"

After that you'll find "USB runtime power management (autosuspend) and wakeup" under "Device Drivers -> USB Support" ...

HTH

swimmer

----------

## Anon-E-moose

 *darkphader wrote:*   

> Haha - when I start Gnome with an ~/.xinitrc containing
> 
> ```
> exec ck-launch-session "gnome-session"
> ```
> ...

 

to fix the app menu problem

try adding 

```
XDG_CONFIG_HOME="$HOME/.config"

XDG_MENU_PREFIX="gnome-"

export XDG_MENU_PREFIX XDG_CONFIG_HOME
```

to .xinitrc before the "exec" line

----------

## darkphader

 *Anon-E-moose wrote:*   

> to fix the app menu problem

 

Actually it finally started working. Must have been fixed in an upgrade.

----------

