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.
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.
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.
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
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.
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.
/* 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);
}
else
{
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); }}
else
{
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;
/* determine the GVolume corresponding to the udev device /
volume =
tvm_g_volume_monitor_get_volume_for_kind (context->monitor,
G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE,
g_udev_device_get_device_file (context->device));
if (volume != NULL)
{
tvm_block_device_mount_volume(context,volume);
}
else
{
/ 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?