Created attachment 65273 [details] [review] patch Mounting of read only NTFS filesystem gives a following error popup: Cannot mount volume. Unable to mount the volume '<Volume name>'. Details: Error opening '/dev/sdb2': Read-only file system Failed to mount '/dev/sdb2': Read-only file system Mounting by hand with the "-o ro" argument works as expected. This bug can be duplicated by mounting a write-protected (aka locked) SD card with NTFS partition. Please also see https://bugs.launchpad.net/ubuntu/+source/udisks/+bug/435192 A patch to fix udisks is attached, which is written by Ming Lei <ming.lei@canonical.com>
Created attachment 66718 [details] [review] add tests to reproduce this Confirming with current udisks. I extended the test suite to try mounting read-only devices for all supported file systems, and it indeed works for anything but NTFS. ====================================================================== ERROR: test_ntfs (__main__.FS) fs: NTFS ---------------------------------------------------------------------- Traceback (most recent call last): File "src/tests/integration-test", line 636, in test_ntfs self._do_fs_check('ntfs') File "src/tests/integration-test", line 758, in _do_fs_check self._do_udisks_check(type) File "src/tests/integration-test", line 931, in _do_udisks_check mount_path = cd_fs.call_mount_sync(no_options, None) File "/usr/lib/python3/dist-packages/gi/types.py", line 47, in function return info.invoke(*args, **kwargs) gi._glib.GError: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error mounting /dev/sr1 at /media/root/2FB591B374B26011: Command-line `mount -t "ntfs" -o "uhelper=udisks2,nodev,nosuid,uid=0,gid=0,dmask=0077,fmask=0177" "/dev/sr1" "/media/root/2FB591B374B26011"' exited with non-zero exit status 18: Error opening '/dev/sr1': Read-only file system Failed to mount '/dev/sr1': Read-only file system However, I'd call this a bug in ntfs-3g -- it should automatically default to mounting the device read-only if it is read-only, just as mount does for any other file system. Unfortunately ntfs-3g does not have a bug tracker. I'll ask the Debian maintainer about how to submit bugs to ntfs3-g. I don't really like that patch. udisks should not silently modify explicitly given options, i. e. turn "rw" into "ro". I could live with a workaround that appends "ro" if "rw" is not given, and the file system is NTFS, once the bug is reported upstream. David, do you agree?
(In reply to comment #1) > I don't really like that patch. udisks should not silently modify explicitly > given options, i. e. turn "rw" into "ro". I could live with a workaround that > appends "ro" if "rw" is not given, and the file system is NTFS, once the bug is > reported upstream. David, do you agree? As you, I prefer to just get ntfs-3g fixed. As for the patch for appending 'ro' on read-only devices, seems useful for vendors to carry but don't want it upstream...
I agree, closing. I did commit the test case though, as that seems useful for verification.
For the record, ntfs-3g has a working bug fix, I forwarded it to http://bugs.debian.org/686914 for the patch (hoping that the Debian maintainer knows how to reach upstream). BTW, the test case that I committed also uncovers the corresponding problem for reiserfs and xfs. I just didn't have the reiserfs/xfs tools installed when I ran those. I'll file upstream bug reports for those as well, and see to fix those or work around in a distro patch.
Seems read-only reiserfs and xfs have no (obvious?) workaround; I reported these issues at https://github.com/karelzak/util-linux/issues/17 https://github.com/karelzak/util-linux/issues/18 and pushed a patch to skip testing readonly mounts for these two, to avoid having tests fail for an extended time.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.