#767233 udisks2: Not mounting with user permissions (even vfat!)

Package:
udisks2
Source:
udisks2
Description:
D-Bus service to access and manipulate storage devices
Submitter:
Pier Paolo
Date:
2015-11-05 21:03:04 UTC
Severity:
important
#767233#5
Date:
2014-10-29 13:53:10 UTC
From:
To:
Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***
brand new install of Jessie with Gnome 3 desktop from d-i.

I'm used to the prior version of udisks, and expecting: 1) insert a vfat usb
stick, 2) see her mounted on /media/[VolumeName]/, 3) with right users
permissions to write even on the root of the partition. This used to work even
with internal ext partitions provided non-root user writable folders.

Now I only get any (vfat) usb stick mounted on /media/usb0/ (not respecting
VolumeName) and only root permissions on root and all folders.
This as per standard gnome 3 gui (nautilus thru gvfs i think),

as per:

pierpaolo@trozko:~$ udisksctl mount -b /dev/sdb1
Mounted /dev/sdb1 at /media/usb0.
pierpaolo@trozko:~$ ls -l /media/usb0/
totale 1662984
drwxr-xr-x 2 root root       8192 ott 28 16:26 XXX
drwxr-xr-x 4 root root       8192 giu  4 22:27 YYY
-rwxr-xr-x 1 root root    8387428 ott  3 17:01 ZZZ
....

I tried to add a polkit rule on localauthority:

pierpaolo@trozko:~$ cat /etc/polkit-1/localauthority/10-udisks2.rules
// seen /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy
// adapted from /usr/share/polkit-1/rules.d/gnome-control-center.rules
polkit.addRule(function(action, subject) {
        if ((action.id == "org.freedesktop.udisks2.filesystem-mount") &&
            subject.local &&
            subject.active &&
            subject.isInGroup ("plugdev")) {
                    return polkit.Result.YES;
            }

Anything seem to work as expected.

#767233#10
Date:
2015-05-12 10:35:42 UTC
From:
To:
Hi,

I had the same issue here and it was caused by /etc/fstab entries: if
a relevant fstab entry is used, udisks2 mount the filesystem using it
instead of using its default behaviour.

Here were the relevant fstab entries:

/dev/sdb1       /media/usb0     auto    rw,user,noauto  0       0
/dev/sdb2       /media/usb1     auto    rw,user,noauto  0       0

With the fstab entries:

$ udisksctl mount -b /dev/sdb1 && ls -l /media/usb0 && udisksctl unmount -b /dev/sdb1
Mounted /dev/sdb1 at /media/usb0.
total 64
drwxr-xr-x 9 root root 32768 mai   12 08:19 data
Unmounted /dev/sdb1

Without the fstab entries:

$ udisksctl mount -b /dev/sdb1 && ls -l /media/foo/1C08-1B0C && udisksctl unmount -b /dev/sdb1
Mounted /dev/sdb1 at /media/foo/1C08-1B0C.
total 64
drwx------ 9 foo foo 32768 mai   12 08:19 data
Unmounted /dev/sdb1.

#767233#15
Date:
2015-05-20 08:17:28 UTC
From:
To:
Could it be caused by entries in /etc/fstab as suggested here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740190

?

I had the same problem on my testing/unstable box, I'm reasonably sure
that it wasn't me who added to /etc/fstab the two lines that were
causing the same symptoms
/dev/sdb1       /media/usb0     auto    rw,user,noauto  0       0
/dev/sdb2       /media/usb1     auto    rw,user,noauto  0       0
but I have to admit that I do now know which package did that).

#767233#20
Date:
2015-06-09 03:15:26 UTC
From:
To:
Hi all,

Have been hit by the same permissions error in udisks2 as Pier Paolo

@Pier Paolo  I tried your patch but didn't work. I still get the 'Not
authorized to perform operation' error as seen by you as well. Have
attached a picture to confirm the same.

My /etc/fstab looks like the following :-

[$] cat /etc/fstab

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda6 during installation
UUID=xxxxxxxxxxxxxxx /               ext4    errors=remount-ro 0       1
# /data was on /dev/sda8 during installation
UUID=xxxxxxxxxxxxxxxxx /data           ext4    defaults        0       2
# /home was on /dev/sda7 during installation
UUID=xxxxxxxxxxxxxxxxxx /home           ext4    defaults        0       2
# swap was on /dev/sda9 during installation
UUID=xxxxxxxxxxxxxxxxxxxx none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
tmpfs      /tmp        tmpfs nodev,nosuid,relatime,size=3G   0       0

So as can be seen there is nothing about any /dev/sdb1 devices.

Your 'patch' didn't work at all.

I did try some other things as well.

[$] udisksctl info -b /dev/sdb1

/org/freedesktop/UDisks2/block_devices/sdb1:
  org.freedesktop.UDisks2.Block:
    Configuration:              []
    CryptoBackingDevice:        '/'
    Device:                     /dev/sdb1
    DeviceNumber:               2065
    Drive:
'/org/freedesktop/UDisks2/drives/ST3500320AS_xxxxxxx''
    HintAuto:                   true
    HintIconName:
    HintIgnore:                 false
    HintName:
    HintPartitionable:          true
    HintSymbolicIconName:
    HintSystem:                 false
    Id:                         by-id-ata-ST3500320AS_xxxxxxx-part1
    IdLabel:                    FreeAgent Drive
    IdType:                     ntfs
    IdUUID:                     xxxxxxxxxxxxxxxxxx
    IdUsage:                    filesystem
    IdVersion:
    MDRaid:                     '/'
    MDRaidMember:               '/'
    PreferredDevice:            /dev/sdb1
    ReadOnly:                   false
    Size:                       500105217024
    Symlinks:                   /dev/disk/by-id/ata-ST3500320AS_xxxxxxxxx-part1
                                /dev/disk/by-id/wwn-xxxxxxxxxxxx-part1
                                /dev/disk/by-label/FreeAgent\x20Drive

/dev/disk/by-path/pci-0000:00:1d.7-usb-0:8:1.0-scsi-0:0:0:0-part1
                                /dev/disk/by-uuid/CExxxxxxxxxxxxxxx
  org.freedesktop.UDisks2.Filesystem:
    MountPoints:
  org.freedesktop.UDisks2.Partition:
    Flags:              0
    IsContained:        false
    IsContainer:        false
    Name:
    Number:             1
    Offset:             32256
    Size:               500105217024
    Table:              '/org/freedesktop/UDisks2/block_devices/sdb'
    Type:               0x07
    UUID:              xxxxxxxxxxxxx


Note - I have just replaced some of the info. needed by xxxxxxx for
privacy reasons making sure that the technical bits that are needed
are there.

Mounting by hand had the desired result :-

─[$] udisksctl mount -b /dev/sdb1
Mounted /dev/sdb1 at /media/shirish/FreeAgent Drive.

and this is also seen by :-

[$] udisksctl info -b /dev/sdb1 | grep MountPoints
    MountPoints:        /media/shirish/FreeAgent Drive

I looked at the listing and for sure they were all listed with user's
ownership, not root's .

[$] ll | more /media/shirish/FreeAgent\ Drive
total 1272564
-rw-r--r--  1 shirish shirish   1418441 Feb  4 00:41 008.pdf

I was even able to unmount it properly.

─[$] udisksctl unmount -b /dev/sdb1
Unmounted /dev/sdb1.

So the issue seems to lie somewhere else.

#767233#25
Date:
2015-11-05 20:59:30 UTC
From:
To:
Dear Maintainer,

Just noticed this problem also.

I connected a USB stick to my computer to edit some video files. It automounted
fine but as root and readonly premissions for users.