[Bug 1734280] [NEW] udisks unable to mount NTFS-formatted usb drive properly if block device is set to read only (blockdev --setro /dev/sd??)

Michael Tinsay 1734280 at bugs.launchpad.net
Fri Nov 24 07:45:00 UTC 2017


Public bug reported:

In older versions (10.04 and older) we use HAL and UDEV rules to force
all USB drives to be automounted read-only by the Desktop Environment.
But they don't anymore for the newer versions.  After a few days
research and expirementations, I'm now able accomplish it using the UDEV
rule:

KERNEL=="sd[b-z][0-9]", RUN+="/sbin/blockdev --setro /dev/%k"

In 16.04 and 17.10, the above work for FAT/exFAT, ext3/4, and even ext4
on an encrypted partition.  It doesn't work though on NTFS-formatted usb
drives -- I get a permission denied error.

To replicate/test this without creating the UDEV rule:

1. Insert FAT or ext3/4-formatted flash drive.  Let Nautilus automount it.  Note where in the left navigation pane it is.
2. From a terminal session, unmount the partition -- let's say sdb1.
3. Do: sudo blockdev --setro /dev/sdb1
4. In Nautilus' left pane, click on the device name to mount it again.
5. The mount command should show the mounted device as read-only.

Do the same for a NTFS-formated usb drive.  By step #4, it will not
mount with a permission denied error.

** Affects: udisks (Ubuntu)
     Importance: Undecided
         Status: New

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

Title:
  udisks unable to mount NTFS-formatted usb drive properly if block
  device is set to read only (blockdev --setro /dev/sd??)

Status in udisks package in Ubuntu:
  New

Bug description:
  In older versions (10.04 and older) we use HAL and UDEV rules to force
  all USB drives to be automounted read-only by the Desktop Environment.
  But they don't anymore for the newer versions.  After a few days
  research and expirementations, I'm now able accomplish it using the
  UDEV rule:

  KERNEL=="sd[b-z][0-9]", RUN+="/sbin/blockdev --setro /dev/%k"

  In 16.04 and 17.10, the above work for FAT/exFAT, ext3/4, and even
  ext4 on an encrypted partition.  It doesn't work though on NTFS-
  formatted usb drives -- I get a permission denied error.

  To replicate/test this without creating the UDEV rule:

  1. Insert FAT or ext3/4-formatted flash drive.  Let Nautilus automount it.  Note where in the left navigation pane it is.
  2. From a terminal session, unmount the partition -- let's say sdb1.
  3. Do: sudo blockdev --setro /dev/sdb1
  4. In Nautilus' left pane, click on the device name to mount it again.
  5. The mount command should show the mounted device as read-only.

  Do the same for a NTFS-formated usb drive.  By step #4, it will not
  mount with a permission denied error.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/udisks/+bug/1734280/+subscriptions



More information about the foundations-bugs mailing list