! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Automount doesn't work.


Description vaxon77 2012-08-10 01:07:17 CEST
I have "Mount removable drives when hot-plugged" option enabled.
However, thunar-volman fails to mount any removable media.

I've made the following script as a workaround for the issue:

cat /usr/local/bin/thunar-volman 
sleep 1
exec /usr/bin/thunar-volman $@ >/tmp/thunar-volman.log 2>&1

Mount succeeds if thunar-volman is started after a small delay.
If I comment "#sleep 1", mount fails and the output of /tmp/thunar-volman.log looks as follows:
cat /tmp/thunar-volman.log 
thunar-volman: Could not detect the volume corresponding to the device.

/usr/bin/thunar-volman --version
thunar-volman 0.8.0 (Xfce 4.10)

Copyright (c) 2004-2007 Benedikt Meurer <benny@xfce.org>
Copyright (c) 2010-2011 Jannis Pohlmann <jannis@xfce.org>

All rights reserved.

Please report bugs to <http://bugzilla.xfce.org/>.

Comment 1 vaxon77 2012-08-10 15:16:39 CEST
The problem seems to be in the inconsitency between thunar and thunar-volman.

Thunar seems to be using UDEV events to detect device add/remove, while thunar-volman uses GVolumeMonitor to find a volume corresponding to the added device and mount it. The problem is gvolume monitor has not set-up the new device volume by the time thunar-volman is started. Obviously UDEV events are emitted first and there's no guarantee GVolumeMonitor manages to set up a volume fast enough for thunar-volman to use it.

I'm not thunar expert, but probably the best way to fix it would be to use the the same event monitoring mechanism in both thunar and thunar-volman. For example, if thunar started thunar-volman based on GVolumeMonitor "volume-added" events AOT UDEV device add events, thunar-volman would detect the volume and mount it without any problems.

Comment 2 Matias De lellis 2012-08-29 18:52:13 CEST
Confirm it.
Inspire in thunar-volman code now try to add support to remobable devices in pragha, and I found this problem.

Now I did a quick test, and adding a sleep (5) before tvm_g_volume_monitor_get_volume_for_kind, solves all the problems.

Comment 3 Matias De lellis 2012-08-29 20:14:52 CEST
Created attachment 4608 
Mount devices with a timeout of 5 seconds.

Tested in Fedora 17 with xfce 4.10.
Only wait 5 seconds to make sure that glib detect the volume.
Comment 4 Andriy Yurchuk 2012-11-01 21:13:26 CET
Auto-mounting worked fine in 4.8. What has changed since then? Maybe
Comment 5 Peter F. Patel-Schneider 2013-02-27 07:06:22 CET
Adding a sleep at the beginning of twm_block_device_mount doesn't work for me.  However, adding a sleep in main() does.

Further, adding a loop inside twm_block_device_mount with a sleep and retry of the tvm_g_volume_monitor_get_volume_for_kind doesn't help at all, even when the total delay runs into several minutes, and even when a new volume monitor is created.

I find this very strange - it is almost as if the contents of the volume monitor are fixed at thread invocation time and can't change thereafter.  There is something about volume monitor not being thread-safe, but I don't understand just what this means.
Comment 6 Philipp 2013-04-01 20:50:58 CEST
I have the same problem in Xubuntu 12.10 with XFCE 4.10.
With the workaround it seems to work now.

Thanks to vaxon77
Comment 7 programmist11180 2013-06-08 09:21:38 CEST
Debian Wheezy, XFCE 4.10. When gvfs 1.16 and udisks2 2.1 is installed, Thunar mounts cd/dvd only if xfburn is launched. Mounts work normal with gvfs 1.12 and udisks 1.0.4
Comment 8 alvk 2013-06-29 02:12:25 CEST
(In reply to programmist11180 from comment #7)
> Debian Wheezy, XFCE 4.10. When gvfs 1.16 and udisks2 2.1 is installed,
> Thunar mounts cd/dvd only if xfburn is launched. Mounts work normal with
> gvfs 1.12 and udisks 1.0.4

I have experienced the same problem with the software you mentioned. Also, I couldn't mount my android phone to. When I've downgraded gvfs and udisks to debian's 'stable' branch, i.e. gvfs 1.12 and udisk 1.0.4, I've got automount worked both for cd/dvd and android phone.
Comment 9 Peter F. Patel-Schneider 2013-11-13 20:40:46 CET
Is there any further investigation of this problem?
Comment 10 programmist11180 2013-11-30 08:30:46 CET
The problem remains when using gvfs of version 1.18.2-2
Comment 11 Peter F. Patel-Schneider 2013-11-30 08:48:07 CET
I compiled the patch in comment 3, which appears to fix the problem, at the cost of a delay in mounting.
Comment 12 programmist11180 2014-01-19 15:39:31 CET
CD/DVD/ any optical disk mount can be broken by udisks2.
Comment 13 programmist11180 2014-01-19 15:45:49 CET
Also see https://bugs.freedesktop.org/show_bug.cgi?id=69825
Comment 14 programmist11180 2014-02-23 15:32:16 CET
A simple way to fix CD/DVD mount and others with udisks2: add to /etc/rc.local:

echo 2000 > /sys/module/block/parameters/events_dfl_poll_msecs

and reboot (Or, if you don't want to reboot now, you can execute this command from the root).

See for more details:
Comment 15 Alejandro Perez 2014-03-03 18:15:46 CET
I have the exact same problem, that gets fixed either with the script or the patch (setting it to 1s, instead of 5s).

Please, fix this issue :)

Besides, I detected that thunar needs to be running, either as a daemon or a window open.
Comment 16 pprw 2014-04-18 12:21:28 CEST
I'm also affected by this bug.

Why nobody fix thunar-volman? The bug report is open since 2012....
Comment 17 Alejandro Perez 2014-04-18 12:23:34 CEST
I desisted and started using udiskie instead. Never had a problem again.
Comment 18 ajvok1 2014-04-22 05:56:59 CEST
Still a problem

$ thunar-volman -V
thunar-volman 0.8.0 (Xfce 4.10)

$ thunar -V
Thunar 1.6.3 (Xfce 4.10)

Please fix.
Comment 19 Matias De lellis 2014-07-05 20:37:47 CEST
Hi there.
I wrote the proposed patch, but honestly not recommend it..

This may solve the problems, but it really is not a problem of thunar!. it's definitely a problem between udev/udisk and glib!.

Please, Those who have problems, test the comented on:


With it work properly, and no require changes in any code..
Comment 20 Peter F. Patel-Schneider 2015-04-11 20:02:46 CEST

doesn't work reliably for me.  It may be that it doesn't help at all, except to cause the race condition to sometimes come out the "right" way.

The problem is still active with Thunar 1.6.6 and thunar-volman 0.8.0.  I'm going to try to add some patches to the current versions.
Comment 21 Peter F. Patel-Schneider 2015-04-11 21:50:44 CEST
My patch that tries to get the volume up to three times, with a 1-second delay between each time, hides the problem successfully.

However, a better solution would be to have thunar-volman only called when the volume has been set up.  This is known, as the volume has to be set up for the icon to appear on the desktop.
Comment 22 Matias De lellis 2015-04-12 18:06:27 CEST
> https://bugzilla.xfce.org/show_bug.cgi?id=9193#c14
> doesn't work reliably for me.  It may be that it doesn't help
> at all, except to cause the race condition to sometimes come
> out the "right" way.

I honestly do not know. In the latest versions of fedora not
have problems and use this change by default.. :S

On thunar volman 0.8.1 added my patch.. :S


As they added to the patch, Please at least reduce the time to one or two seconds. 5 seconds is completely unnecessary.
Comment 23 Peter F. Patel-Schneider 2015-04-12 19:34:07 CEST
I see that 0.8.1 has your patch.

I think that better than waiting 1 second would be to try immediately and only then wait for a bit.  I modified the code accordingly, ending up with 

static gboolean
tvm_block_device_mount_volume (TvmContext *context, GVolume *volume)
  GMountOperation *mount_operation;

  /* check if we have a volume */
  if (volume != NULL)
      /* check if we can mount the volume */
      if (g_volume_can_mount (volume))
          /* try to mount the volume asynchronously */
          mount_operation = gtk_mount_operation_new (NULL);
          g_volume_mount (volume, G_MOUNT_MOUNT_NONE, mount_operation,
                          NULL, (GAsyncReadyCallback) tvm_block_device_mount_finish, context);
          g_object_unref (mount_operation);
          g_set_error (context->error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                       _("Unable to mount the device"));
          /* finish processing the device */
          tvm_device_handler_finished (context);
      g_set_error (context->error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                   _("Could not detect the volume corresponding to the device"));
      /* finish processing the device */
      tvm_device_handler_finished (context);
    return FALSE;

static gboolean
tvm_block_device_mount_retry (TvmContext *context)
  GVolume         *volume;

  volume = 
    tvm_g_volume_monitor_get_volume_for_kind (context->monitor,
                                              g_udev_device_get_device_file (context->device));

  /* if no volume then call anyway to do not-found processing */
  tvm_block_device_mount_volume (context,volume);
  return FALSE;

static gboolean
tvm_block_device_mount (TvmContext *context)
  GVolume         *volume;

  g_return_if_fail (context != NULL);

  /* determine the GVolume corresponding to the udev device */
  volume = 
    tvm_g_volume_monitor_get_volume_for_kind (context->monitor,
                                              g_udev_device_get_device_file (context->device));
  if (volume != NULL)
      /* clean up and try again in one second */
      g_object_unref (context->monitor);
      context->monitor = g_volume_monitor_get ();
      g_timeout_add_seconds(1, (GSourceFunc) tvm_block_device_mount_retry, context);
  return FALSE;

What's the best way to get this put into thunar-volman?
Comment 24 Matias De lellis 2015-04-12 21:03:51 CEST
> I see that 0.8.1 has your patch.

Yes .. Even though I recommended do it. hah :S

> I think that better than waiting 1 second would be to try
> immediately and only then wait for a bit.  I modified the
> code accordingly, ending up with 

Looks better.. =)

> What's the best way to get this put into thunar-volman?

Clone the repo, commit your change with a good description
and make a patch from this commit. ;)

Then attach it here. 

If you doubt, do it with a graphical interface as gitg- =)

Comment 25 Peter F. Patel-Schneider 2015-04-13 00:29:14 CEST
Created attachment 6191 
Try to get GVolume right away and only if that fails wait for 1 second

This should change the total delay from 5 seconds per partition to at most 1 second for an entire physical device.
Comment 26 Peter F. Patel-Schneider 2015-04-13 00:30:36 CEST
OK, done.

Hopefully this will get picked up faster than your patch.
Comment 27 Peter F. Patel-Schneider 2015-07-07 15:18:30 CEST
No action yet that I can see.  Does anyone know how to get this patch looked at?   The current setup with its 5 second delay is getting annoying.
Comment 28 Skunnyk editbugs 2020-05-25 22:44:19 CEST
*** Bug 10801 has been marked as a duplicate of this bug. ***
Comment 29 Git Bot editbugs 2020-05-25 23:10:11 CEST
-- GitLab Migration Automatic Message --

This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/xfce/thunar-volman/-/issues/4.

Please create an account or use an existing account on one of our supported OAuth providers. 

If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests

Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev

Bug #9193

Reported by:
Reported on: 2012-08-10
Last modified on: 2020-05-25
Duplicates (1):
  • 10801 thunar-volman does not automount usb device


Jannis Pohlmann
CC List:
13 users



Additional information