udisk2 and kde device notifier mount settings

A long time ago in a distance galaxy far far away … I was dealing with the same problem.

When I try to tranfer huge amount of data to my usb stick it suddenly stops and i realize that it has been remounted ro. I’ve noticed that it’s because when the OS detects an error writing it remounts ro. If I manually mount the usb stisk and select remount=rw then all work fine, but I havn’t been able of setting this for kde device notifier along some opensuse versions.

Now I think the solution may be changing udisk2 settings. I’ve found that it is located at /var/lib/polkit-1/localauthority/10-vendor.d/org.freedesktop.udisks2.filesystem-mount.pkla

wich looks like:


[org.freedesktop.udisks2.filesystem-mount]
Identity=unix-group:*
Action=org.freedesktop.udisks2.filesystem-mount
ResultAny=auth_admin
ResultInactive=auth_admin
ResultActive=yes


But i don’t know how to configure it for my desired settings

Which openSUSE version are you using?
First, those .pkla files in /var/lib/polkit-1/localauthority/ are not used anymore in 12.3, if you are using that they might be a left-over which you can delete as it’s useless anyway.
Second, polkit only controls who is allowed to mount disks and if a password is required. You cannot set mount options there.

But I don’t really understand what you are trying to achieve. Your disk is mounted rw, isn’t it? So adding a rw to the mount options won’t help you.
And adding “remount=rw” to the mount options won’t help you either I think, because the problem isn’t in the mounting.

Better find out why your usb stick is having errors and fix the underlying issue… :wink:

PS: I think you misunderstand the “remount=rw” option.
It does not tell the kernel to not remount the disk ro in case of an error.
It’s there to remount an already mounted disk with different mount options, i.e. in your case “rw” instead of “ro”.

I think what you want is the “errors” mount option:

       **errors={continue|remount-ro|panic}
**              Define the behaviour when  an  error  is  encountered.   (Either
              ignore  errors  and  just mark the filesystem erroneous and con-
              tinue, or remount the filesystem read-only, or  panic  and  halt
              the  system.)   The default is set in the filesystem superblock,
              and can be changed using tune2fs(8).

It’s filesystem specific though, not all filesystems support it (that quote is for ext2). But I think not all filesystems remount as ro in case of errors either.
If your stick is formatted with ext2/3 (not sure if that applies to ext4 as well), you should just change it with tune2fs as indicated.
From “man tune2fs”:

       **-e** error-behavior
              Change the behavior of the kernel code when errors are detected.
              In all cases, a filesystem error will cause **e2fsck**(8)  to  check
              the  filesystem  on the next boot.  error-behavior can be one of
              the following:


                   **continue**    Continue normal execution.


                   **remount-ro**  Remount filesystem read-only.


                   **panic**       Cause a kernel panic.


 

So “tune2fs -e continue /dev/sdXY” (where “sdXY” is the corresponding partition on your stick) should change the behaviour the way you want it for that particular partition.

I’m using 12.3

Second, polkit only controls who is allowed to mount disks and if a password is required. You cannot set mount options there. But I don’t really understand what you are trying to achieve. Your disk is mounted rw, isn’t it? So adding a rw to the mount options won’t help you. And adding “remount=rw” to the mount options won’t help you either I think, because the problem isn’t in the mounting.
Sorry, I meant “errors=continue”
Better find out why your usb stick is having errors and fix the underlying issue… :wink:
It’s not an usb stick error. I’ve had the same problem with different hardware configurations, different OS versions and differents usb sticks. If I mount usb stick from kde device notifier and I copy files more than some hundred MB I get an error, but I’ve just mounted manually that way

 andromeda:~ # mount -t vfat -o rw,nosuid,nodev,relatime,uid=1001,gid=100,fmask=0022,dmask=0077,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=continue /dev/sdb1 /mnt/pendrive   

and copied 7GB and no error. regards

Sorry, I meant “errors=continue”.
It’s a fat32 filesystem, so I think the only way to do that is at mount settings… wherever they are

regards

OK, then you might as well delete the whole directory /var/lib/polkit-1/localauthority/ … :wink:

It’s not an usb stick error. I’ve had the same problem with different hardware configurations, different OS versions and differents usb sticks. If I mount usb stick from kde device notifier and I copy files more than some hundred MB I get an error, but I’ve just mounted manually that way

 andromeda:~ # mount -t vfat -o rw,nosuid,nodev,relatime,uid=1001,gid=100,fmask=0022,dmask=0077,iocharset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=continue /dev/sdb1 /mnt/pendrive   

and copied 7GB and no error.

But that behaviour is not normal. I at least have never seen anything like that.

Have you tried mounting it manually without that errors option?

You could create an entry in /etc/fstab with that option, udisks2 should honor that then.

In KDE, in the KDE system-settings there is
an easier way of configuring this policy problem, if it really the one causing this behavior.

No. That system-settings module never really worked at all because it changed wrong files (and the changes got overwritten on package updates anyway). Therefore it has even been removed from the distro half a year ago (but you’re right that it’s still included in 12.3).

* Sat May 18 2013 hrvoje.senjan@gmail.com
- Remove polkit-kde-kcmmodules-1 from Requires, as the package is
  broken - it overwrites rules shipped by other packages (kde#308934),
  and confuses users that it does something it doesn't (bnc#814763)

Also, he doesn’t have a policy problem. He just wants to tell udisks2 which mount options to use.

Ok, I hear you, thanks for the heads-up, I am using xfce so I am not up to date with the kde systems-settings present status.

FWIW, usdisks2 is essentially hard-coded with respect to mounting, but I’m aware of an interesting project called udsisk-glue that is supposed to allow users to have more control with respect to disk-related events. I don’t have direct experience with it, and I don’t have time to investigate further at the moment, so for now I’ll simply leave you to read about it

Automounting - awesome

software.opensuse.org:

Yeah right. But as far as I know, udisks-glue uses udisks1, not udisks2.
Unless that has changed recently…