Results 1 to 10 of 16

Thread: xubuntu: where are the default mount options?

Hybrid View

  1. #1
    Join Date
    Feb 2012
    Beans
    30

    xubuntu: where are the default mount options?

    xubuntu will automount removable drives when plugged into the usb port and I need to change the default for all vfat drives to shortname=lower. Where do I configure this?

    Please don't suggest fstab, this does not seem to play well with the automatic creation and deletion of needed mount points in /media/ there must be a proper way to do this.

    TIA,
    Bernd

  2. #2
    Join Date
    Oct 2008
    Location
    Ottawa, Canada
    Beans
    813
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: xubuntu: where are the default mount options?

    There is a way!
    Install package usbmount. This package will mounts usb devices in a configurable way.
    Edit file /etc/usbmount/usbmount.conf
    You can change various options in that file to your liking. The important ones are:

    FILESYSTEMS="vfat"
    FS_MOUNTOPTIONS="-fstype=vfat,shortname=lower,umask=0,utf8=1,showexe c,flush,uhelper=udisks"

    Also, to safely disconnect a device, you have to run
    Code:
    pumount /media/usb
    Another way would be to unmount with the device brand name.
    Code:
    pumount /var/run/usbmount/<brand name>
    This could be made into a launcher.

    Cheers!
    Last edited by LewisTM; September 13th, 2012 at 09:20 PM.
    husband@wife$ make sandwich
    Permission denied
    husband@wife$ sudo make sandwich

  3. #3
    Join Date
    Feb 2012
    Beans
    30

    Re: xubuntu: where are the default mount options?

    I have tried this and while usbmont works on its own as advertised it unfortunately seems to be totally incompatible with xfce:

    When I plug in my camera then usbmount will mount it at /media/usb0 but xfce (thunar) will display an icon on the desktop "KAMERA" (thats the vfat file system label I gave to it after formatting) and when hovering over it it says "not mounted" (it seems thunar thinks it should be mounted at /media/KAMERA/ but instead usbmount already mounted it at /media/usb0/). I can disable the icon on the desktop but inside thunar it will still show me "KAMERA" in the left side bar (and crash if I click it).

    The strange thing is also pcmanfm and also nautilus will display this "KAMERA" entry in their sidebars (and in nautilus I can even use it), so this makes me believe that there is something else that is managing these devices that is NOT part of xfce or thunar (because other file managers can see it too), I would like to know what exactly it is that is finding the plugged in devices, giving names to them and making them appear in the side bar of 3 different file managers. Maybe this unknown "something" that is doing this is the correct place to configure the aoutomounting behavior?

    Why is all this automatic voodoo so poorly documented, what exactly is going on behind the scenes if I plug in an usb drive, which part is responsible for creating the item in the sidebar of the file managers and the desktops, which piece of software is attempting to mounting it and why does it not recognize that it actually *is* mounted already?

  4. #4
    Join Date
    Feb 2012
    Beans
    30

    Re: xubuntu: where are the default mount options?

    Ok, after a lot of googling and experimenting I think I have found a working solution:


    • remove above mentioned usbmount and also any other automounter script
    • disable auto mounting in thunar
    • install udisks-glue:
      Code:
      sudo apt-get install udisks-glue
    • edit the file /etc/udisks-glue.conf to contain filters for certain devices and commands to execute when they match. Mine now looks like this (only vfat devices will be matched by the filter and automounted for now, can add more filters and matches later):
      Code:
      filter vfat {
          partition_table = false
          usage = filesystem
          type = vfat
      }
      
      match vfat {
          automount = true
          automount_options = { sync, 'shortname=lower' }
          post_mount_command = "notify-send '%device_file\nhas been mounted at\n%mount_point' --icon=gnome-dev-harddisk-usb"
          post_unmount_command = "notify-send '%device_file\nhas been unmounted' --icon=gnome-dev-harddisk-usb"
      }
    • start the daemon udisks-glue as user automatically from within the session autostart or start it manually (as user, not as root!), kill and restart it after config file has changed.

    The above filter will match all devices that have a vfat file system, for each "filter" directive there is also a "match" directive with the same name and the one above will make it use my custom mount options and also display some nice libnotify popups on mount and unmount.


    It seems xfce and Thunar already use udisks to detect which devices exist and also would use udisks to mount them with (hardcoded) default options and the above is 100% compatible with it since it would mount them exactly in the same manner and choose the same mount points that thunar would have choosen and I can then also use the icons on the desktop to open them or to unmount them again.

    Edit: I have marked this thread as "solved" although the underlying problem is not really solved at all. Thunar is simply missing this functionality and I am now totally bypassing and disabling Thunar's auto-mounting feature, it would be extremely nice if the xfce authors could implement such configurable filters and custom mount options directly in Thunar itself to remove the need for using udisks-glue instead of thunar-volman.
    Last edited by 7bit; September 14th, 2012 at 02:32 PM.

  5. #5
    Join Date
    Oct 2008
    Location
    Ottawa, Canada
    Beans
    813
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: xubuntu: where are the default mount options?

    Thanks for the info! It's amazing what a determined mind can come up with.

    FYI Thunar and Xfce have little to do with disk automounting, it's all managed by Devicekit then passed on to GIO/GVFS. The latter subsystem is an offshoot of GNOME. As seems to be the trend lately, GNOME apps have hardcoded instead of configurable settings. Thunar-volman is just one layer on top that calls those processes.

    Cheers!
    husband@wife$ make sandwich
    Permission denied
    husband@wife$ sudo make sandwich

  6. #6
    Join Date
    Feb 2012
    Beans
    30

    Re: xubuntu: where are the default mount options?

    Quote Originally Posted by LewisTM View Post
    FYI Thunar and Xfce have little to do with disk automounting, it's all managed by Devicekit then passed on to GIO/GVFS. The latter subsystem is an offshoot of GNOME.
    I just had a quick look into the source code of thunar-volman and it is calling g_volume_mount() when it detects the event. So it is indeed thunar-volman who is actually mounting it (of course it doesn't call mount itself, it does it through a very abstract API but ultimately it is thunar-volman who gets notified and then deciding whether to mount or not to mount and then doing it). So instead of calling the very limited g_volume_mount() which does not allow to pass additional mount options it could be made to use the udisks API directly to initiate the mounting, this way it would be possible to pass mount options.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •