[Bug 435192] Re: Automatic mounting of read only ntfs partition on usb device fails

Martin Pitt martin.pitt at ubuntu.com
Thu Sep 6 10:28:02 UTC 2012


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, but adding a distro task
for now.

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. I asked the primary upstream
maintainer whether he'd be okay with this.

@James: the udisks task is invalid for quantal because the "udisks"
source is the obsolete 1.x version. We are using udisks2 now, which has
its own task with quantal only. However, when this gets fixed properly
in ntfs-3g, it will work for any udisks version.

** Also affects: ntfs-3g (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: ntfs-3g (Ubuntu Quantal)
   Importance: Undecided => Medium

** Changed in: ntfs-3g (Ubuntu Quantal)
       Status: New => Triaged

** Changed in: ntfs-3g (Ubuntu Precise)
       Status: New => Triaged

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ntfs-3g in Ubuntu.
https://bugs.launchpad.net/bugs/435192

Title:
  Automatic mounting of read only ntfs partition on usb device fails

Status in OEM Priority Project:
  In Progress
Status in OEM Priority Project precise series:
  In Progress
Status in abstraction for enumerating and managing block devices:
  Confirmed
Status in “ntfs-3g” package in Ubuntu:
  Triaged
Status in “udisks” package in Ubuntu:
  Invalid
Status in “udisks2” package in Ubuntu:
  Confirmed
Status in “ntfs-3g” source package in Precise:
  Triaged
Status in “udisks” source package in Precise:
  Confirmed
Status in “ntfs-3g” source package in Quantal:
  Triaged
Status in “udisks” source package in Quantal:
  Invalid
Status in “udisks2” source package in Quantal:
  Confirmed

Bug description:
  [Impact]
  OEM customers raise this issue, thinking that the error message can be misleading to inexperienced users.

  [Fix]

  fixed by below patch:

  diff --git a/precise/src/device.c b/precise/src/device.c
  index a7f8880..8b48612 100644
  --- a/precise/src/device.c
  +++ b/precise/src/device.c
  @@ -6407,6 +6407,7 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
     const FSMountOptions *fsmo;
     char **options;
     char uid_buf[32];
  +  int access_changed;
   
     fstype = NULL;
     options = NULL;
  @@ -6414,6 +6415,7 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
     mount_point = NULL;
     remove_dir_on_unmount = FALSE;
     error = NULL;
  +  access_changed = 0;
   
     /* If the user requests the filesystem type, error out unless the
      * filesystem type is
  @@ -6516,6 +6518,7 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
     for (n = 0; options[n] != NULL; n++)
       {
         const char *option = options[n];
  +      char *start;
   
         /* avoid attacks like passing "shortname=lower,uid=0" as a single mount option */
         if (strstr (option, ",") != NULL)
  @@ -6533,9 +6536,23 @@ device_filesystem_mount_authorized_cb (Daemon *daemon,
             goto out;
           }
   
  +      if (start = strstr(option, "rw")) {
  +	if (device->priv->device_is_read_only) {
  +			start[1]  = 'o';
  +			access_changed = 1;
  +	}
  +      }
  +
         g_string_append_c (s, ',');
         g_string_append (s, option);
       }
  +
  +    if (!access_changed && device->priv->device_is_read_only)
  +    {
  +      g_string_append_c (s, ',');
  +      g_string_append (s, "ro");
  +    }
  +
     mount_options = g_string_free (s, FALSE);
   
     g_print ("**** USING MOUNT OPTIONS '%s' FOR DEVICE %s\n", mount_options, device->priv->device_file);


  [Test Case]
  Format a SD card with NTFS, lock the SD card as write-protected, insert the card into the SD card slot. If the card is mounted as read-only, the bug is fixed.

  [Regression Potential]

  The fix posted looks shouldn't cause regression.

  [Original Report]
  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

  I believe this should be mounted as read-only instead of an error
  message.

  Mounting by hand with the "-o ro" argument works as expected.
  ---
  Architecture: i386
  DistroRelease: Ubuntu 10.04
  NonfreeKernelModules: fglrx
  Package: mountall 2.15
  PackageArchitecture: i386
  ProcEnviron:
   PATH=(custom, user)
   LANG=en_US.utf8
   SHELL=/bin/bash
  ProcVersionSignature: Ubuntu 2.6.32-24.39-generic 2.6.32.15+drm33.5
  Tags: lucid
  Uname: Linux 2.6.32-24-generic i686
  UserGroups: adm admin audio cdrom dialout dip fax fuse lpadmin netdev plugdev sambashare tape video

To manage notifications about this bug go to:
https://bugs.launchpad.net/oem-priority/+bug/435192/+subscriptions




More information about the foundations-bugs mailing list