Should ignore SmartWare partitions when using Western Digital external drives

Bug #474790 reported by Dennis Craven
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
udisks
Fix Released
Medium
udisks (Ubuntu)
Fix Released
Low
Martin Pitt
Karmic
Won't Fix
Undecided
Unassigned

Bug Description

Binary package hint: devicekit-disks

Release of Ubuntu: Karmic
Package Version: 007-2ubuntu3
Expected Results: When a WD external drive is plugged in, the SmartWare Virtual CD is not detected or mounted.
Actual Results: The SmartWare Virtual CD is detected and mounted.

The SmartWare Virtual CD partition on these drives is useless in Linux. It includes Windows/Mac utilities only, and is not usable space. This portion of the drive should probably be ignored on Linux desktops.

Here is relevent output of "devkit-disks --dump":
Showing information for /org/freedesktop/DeviceKit/Disks/devices/sr1
  native-path: /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0/host14/target14:0:0/14:0:0:1/block/sr1
  device: 11:1
  device-file: /dev/sr1
    by-id: /dev/disk/by-id/usb-WD_Virtual_CD_070A_575839304137395737383234-0:1
    by-path: /dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:1
  detected at: Wed 04 Nov 2009 04:38:44 PM EST
  system internal: 0
  removable: 1
  has media: 1 (detected at Wed 04 Nov 2009 04:38:44 PM EST)
    detects change: 1
    detection by polling: 1
    detection inhibitable: 1
    detection inhibited: 0
  is read only: 0
  is mounted: 0
  mount paths:
  mounted by uid: 0
  presentation hide: 1
  presentation nopolicy: 0
  presentation name:
  presentation icon:
  size: 700448768
  block size: 2048
  job underway: no
  usage: filesystem
  type: udf
  version:
  uuid:
  label: WD SmartWare
  optical disc:
    blank: 0
    appendable: 0
    closed: 0
    num tracks: 0
    num audio tracks: 0
    num sessions: 0
  drive:
    vendor: WD
    model: Virtual CD 070A
    revision: 1028
    serial: 575839304137395737383234
    detachable: 1
    can spindown: 0
    rotational media: 1
    ejectable: 1
    media: optical_cd
      compat: optical_cd optical_mrw optical_mrw_w
    interface: usb
    if speed: 480000000 bits/s
    ATA SMART: not available

========================================================================

And the output of "udevadm info -q all -n /dev/sr1" is:

P: /devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0/host14/target14:0:0/14:0:0:1/block/sr1
N: sr1
S: block/11:1
S: scd1
S: disk/by-id/usb-WD_Virtual_CD_070A_575839304137395737383234-0:1
S: disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:1
S: disk/by-label/WD\x20SmartWare
S: cdrom3
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0/host14/target14:0:0/14:0:0:1/block/sr1
E: MAJOR=11
E: MINOR=1
E: DEVNAME=/dev/sr1
E: DEVTYPE=disk
E: SUBSYSTEM=block
E: ID_CDROM=1
E: ID_CDROM_MRW=1
E: ID_CDROM_MRW_W=1
E: ID_CDROM_MEDIA=1
E: ID_VENDOR=WD
E: ID_VENDOR_ENC=WD\x20\x20\x20\x20\x20\x20
E: ID_VENDOR_ID=1058
E: ID_MODEL=Virtual_CD_070A
E: ID_MODEL_ENC=Virtual\x20CD\x20070A\x20
E: ID_MODEL_ID=070a
E: ID_REVISION=1028
E: ID_SERIAL=WD_Virtual_CD_070A_575839304137395737383234-0:1
E: ID_SERIAL_SHORT=575839304137395737383234
E: ID_TYPE=cd
E: ID_INSTANCE=0:1
E: ID_BUS=usb
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usb-storage
E: ID_PATH=pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:1
E: ID_FS_LABEL=WD_SmartWare
E: ID_FS_LABEL_ENC=WD\x20SmartWare
E: ID_FS_TYPE=udf
E: ID_FS_USAGE=filesystem
E: ACL_MANAGE=1
E: GENERATED=1
E: DKD_PRESENTATION_HIDE=0
E: DKD_MEDIA_AVAILABLE=1
E: DKD_PARTITION_TABLE=1
E: DKD_PARTITION_TABLE_SCHEME=apm
E: DKD_PRESENTATION_NOPOLICY=0
E: DEVLINKS=/dev/block/11:1 /dev/scd1 /dev/disk/by-id/usb-WD_Virtual_CD_070A_575839304137395737383234-0:1 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:1 /dev/disk/by-label/WD\x20SmartWare /dev/cdrom3v/sr1":

Tags: bitesize
Revision history for this message
Dennis Craven (dcraven) wrote :

I've tried fixing this myself so that I could upload a patch to one of the rules files but the rules files are a mess since this is an "updated from Jaunty" machine (HAL-->DeviceKit). I don't know what files are obeyed.

The only way I got this to be ignored is to add "ENV{DKD_PRESENTATION_HIDE}="1"" to the appropriate line in 70-persistent-cd.rules, however I get the feeling this is not the right way to fix the problem.

Revision history for this message
Martin Pitt (pitti) wrote :

Dennis, /lib/udev/rules.d/95-devkit-disks.rules has those rules now (which partitions to hide). It's a bit sad that this doesn't have a DKD_PARTITION_TYPE, so we need to do the matching based on the SCHEME (apm) and ID_FS_LABEL.

Changed in devicekit-disks (Ubuntu):
status: New → Triaged
importance: Undecided → Low
tags: added: bitesize
Revision history for this message
Dennis Craven (dcraven) wrote : Re: [Bug 474790] Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

On Sat, Nov 7, 2009 at 3:07 AM, Martin Pitt <email address hidden> wrote:

> Dennis, /lib/udev/rules.d/95-devkit-disks.rules has those rules now
> (which partitions to hide). It's a bit sad that this doesn't have a
> DKD_PARTITION_TYPE, so we need to do the matching based on the SCHEME
> (apm) and ID_FS_LABEL.
>

Hmm.. That file is missing from my system. I'll look further into this.
Thanks for the tip Martin!

Revision history for this message
Dennis Craven (dcraven) wrote : Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

Please ignore my last comment (#3). The file is indeed there. I looked in etc instead :/

Revision history for this message
Dennis Craven (dcraven) wrote :

So. Here is what I did...

First I tried to create a rule matching what Martin suggested in comment #2. I added a rule to/lib/udev/rules.d/95-devkit-disks.rules. It looked like this:
    ENV{ID_FS_TYPE}=="WD_SmartWare", ENV{DKD_PARTITION_SCHEME}=="apm", ENV{DKD_PRESENTATION_HIDE}="1"

This rule for some reason did not match/work. After restarting udev (is this even necessary?) and plugging in the drive, that rule was ignored and the SmartWare partition mounted as a CD.

Based on the autogenerated entry in /etc/udev/rules.d/70-persistent-cd.rules when the drive is detected, I tried adding this rule to the /lib/udev/rules.d/95-devkit-disks.rules file:
    SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="WD_Virtual_CD*", ENV{DKD_PRESENTATION_HIDE}="1"

This worked fine, and the drive is hidden. Is this an appropriate and sufficiently generic rule in that it will work across other people's systems? Notice the * expression when specifying ID_SERIAL.

Revision history for this message
Dennis Craven (dcraven) wrote :

As useful as it probably isn't, here's a patch that adds the rule as described above. It's patched against the current karmic package.

Revision history for this message
In , Martin Pitt (pitti) wrote :

The SmartWare Virtual CD partition on these drives is useless in Linux. It includes Windows/Mac utilities only, and is not usable space. This portion of the drive should probably be ignored on Linux desktops.

P: /devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0/host14/target14:0:0/14:0:0:1/block/sr1
N: sr1
S: block/11:1
S: scd1
S: disk/by-id/usb-WD_Virtual_CD_070A_575839304137395737383234-0:1
S: disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:1
S: disk/by-label/WD\x20SmartWare
S: cdrom3
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0/host14/target14:0:0/14:0:0:1/block/sr1
E: MAJOR=11
E: MINOR=1
E: DEVNAME=/dev/sr1
E: DEVTYPE=disk
E: SUBSYSTEM=block
E: ID_CDROM=1
E: ID_CDROM_MRW=1
E: ID_CDROM_MRW_W=1
E: ID_CDROM_MEDIA=1
E: ID_VENDOR=WD
E: ID_VENDOR_ENC=WD\x20\x20\x20\x20\x20\x20
E: ID_VENDOR_ID=1058
E: ID_MODEL=Virtual_CD_070A
E: ID_MODEL_ENC=Virtual\x20CD\x20070A\x20
E: ID_MODEL_ID=070a
E: ID_REVISION=1028
E: ID_SERIAL=WD_Virtual_CD_070A_575839304137395737383234-0:1
E: ID_SERIAL_SHORT=575839304137395737383234
E: ID_TYPE=cd
E: ID_INSTANCE=0:1
E: ID_BUS=usb
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usb-storage
E: ID_PATH=pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:1
E: ID_FS_LABEL=WD_SmartWare
E: ID_FS_LABEL_ENC=WD\x20SmartWare
E: ID_FS_TYPE=udf
E: ID_FS_USAGE=filesystem
E: ACL_MANAGE=1
E: GENERATED=1
E: DKD_PRESENTATION_HIDE=0
E: DKD_MEDIA_AVAILABLE=1
E: DKD_PARTITION_TABLE=1
E: DKD_PARTITION_TABLE_SCHEME=apm
E: DKD_PRESENTATION_NOPOLICY=0
E: DEVLINKS=/dev/block/11:1 /dev/scd1 /dev/disk/by-id/usb-WD_Virtual_CD_070A_575839304137395737383234-0:1 /dev/disk/by-path/pci-0000:00:1d.7-usb-0:2:1.0-scsi-0:0:0:1 /dev/disk/by-label/WD\x20SmartWare /dev/cdrom3v/sr1":

Revision history for this message
In , Martin Pitt (pitti) wrote :

Created an attachment (id=31077)
git formatted patch

Revision history for this message
In , Martin Pitt (pitti) wrote :

Created an attachment (id=31078)
git formatted patch

whoopsie, typo

Revision history for this message
Martin Pitt (pitti) wrote : Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

> ENV{ID_FS_TYPE}=="WD_SmartWare",

This can't work, since the file system type is udf:

E: ID_FS_LABEL=WD_SmartWare
E: ID_FS_LABEL_ENC=WD\x20SmartWare
E: ID_FS_TYPE=udf

How about the patch I just sent to upstream? https://bugs.freedesktop.org/attachment.cgi?id=31078

Revision history for this message
Martin Pitt (pitti) wrote :

Patch sent to upstream for review and inclusion.

Changed in devicekit-disks (Ubuntu):
status: Triaged → Fix Committed
assignee: nobody → Martin Pitt (pitti)
Changed in devicekit:
status: Unknown → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package devicekit-disks - 009-1ubuntu2

---------------
devicekit-disks (009-1ubuntu2) lucid; urgency=low

  Resynchronize to Debian git head, no remaining Ubuntu changes.

  [ Michael Biebl ]
  * debian/patches/09-reiserfs-support.patch
    - Add support for ReiserFS.

  [ Martin Pitt ]
  * Add debian/local/ubuntu.pkla: Allow passwordless file system operations
    for local foreground admin user sessions on Ubuntu. Install it in
    debian/rules. (LP: #465054)
  * Add 02-allow-simulated-smart.patch: Allow simulated SMART data on
    non-SMART devices. This is both useful for testing DK-disks itself, as
    well as recreating bugs with SMART handling. (fd.o #24772)
  * Add 03-hide-configuration-partition-12.patch: Hide Compaq recovery
    partition type 0x12. (fd.o #24999, LP: #451304)
  * Add 04-hide-wd-smartware-partition.patch: Ignore Western Digital SmartWare
    partitions. (fd.o #25009, LP: #474790)
  * Add 06-guid-partition-flags.patch: Fix setting flags for GUID partitions.
    (fd.o #25034)
 -- Martin Pitt <email address hidden> Wed, 11 Nov 2009 17:42:19 +0100

Changed in devicekit-disks (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Dennis Craven (dcraven) wrote :

Hi Martin,

I wanted to mention that the patch submitted for this bug does not work. Once the patch is applied, the SmartWare partition still mounts as before. Should I be making this comment here or upstream? Or both?

Revision history for this message
In , Martin Pitt (pitti) wrote :

(From update of attachment 31078)
I got feedback that this does not actually work. Marking this as broken, hold on. I'll followup with a better patch.

Revision history for this message
Martin Pitt (pitti) wrote : Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

This looks good; I also want to fold the fix for bug 419663 into the next SRU, once I get a confirmation that my PPA package works.

I'll sponsor this in due course.

Changed in devicekit-disks (Ubuntu Karmic):
assignee: nobody → Martin Pitt (pitti)
status: New → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Sorry, please ignore the previous comment; wrong bug.

Changed in devicekit-disks (Ubuntu Karmic):
assignee: Martin Pitt (pitti) → nobody
status: In Progress → Won't Fix
Revision history for this message
Martin Pitt (pitti) wrote :

Argh. Does it work if you fix my obvious "DKD_PARTITION_SCHEME" typo to "DKD_PARTITION_TABLE_SCHEME"?

Changed in devicekit-disks (Ubuntu):
status: Fix Released → In Progress
Revision history for this message
Dennis Craven (dcraven) wrote : Re: [Bug 474790] Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

On Fri, Nov 13, 2009 at 12:11 PM, Martin Pitt <email address hidden>wrote:

> Argh. Does it work if you fix my obvious "DKD_PARTITION_SCHEME" typo to
> "DKD_PARTITION_TABLE_SCHEME"?
>
>
So I modified your submitted patch as you suggested to this:

 ENV{DKD_PARTITION_TABLE__SCHEME}=="apm", \
  ENV{ID_CDROM}=="?*", ENV{ID_FS_TYPE}=="udf",
ENV{ID_FS_LABEL}=="WD_SmartWare", \
  ENV{DKD_PRESENTATION_HIDE}="1"

And it still does not work.

Just to reiterate, this is the line I'm using in my own instance, and it
does work:

SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{ID_SERIAL}=="WD_Virtual_CD*",
ENV{DKD_PRESENTATION_HIDE}="1"

This has been confirmed on two different machines with two different WD
drives. Both machines using Karmic.

Revision history for this message
Launchpad Janitor (janitor) wrote : Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

This bug was fixed in the package devicekit-disks - 009-1ubuntu3

---------------
devicekit-disks (009-1ubuntu3) lucid; urgency=low

  Upload current Debian git head.

  [ Michael Biebl ]
  * debian/patches/09-reiserfs-support.patch
    - Add support for ReiserFS.

  [ Martin Pitt ]
  * Add debian/local/ubuntu.pkla: Allow passwordless file system operations
    for local foreground admin user sessions on Ubuntu. Install it in
    debian/rules. (LP: #465054)
  * Add 02-allow-simulated-smart.patch: Allow simulated SMART data on
    non-SMART devices. This is both useful for testing DK-disks itself, as
    well as recreating bugs with SMART handling. (fd.o #24772)
  * Add 03-hide-configuration-partition-12.patch: Hide Compaq recovery
    partition type 0x12. (fd.o #24999, LP: #451304)
  * Add 04-hide-wd-smartware-partition.patch: Ignore Western Digital SmartWare
    partitions. (fd.o #25009, LP: #474790)
  * Add 06-guid-partition-flags.patch: Fix setting flags for GUID partitions.
    (fd.o #25034)
  * Add 07-fix-atasmart-crash.patch: Fix common crash when
    devkit-disks-helper-ata-smart-collect succeeds, but returns invalid base64
    data on stdout. (fd.o #25043, LP: #419663)
  * debian/local/apport-hook.py:
    - Drop attaching /etc/fstab; it might contain samba (etc.) passwords which
      need to be filtered out.
    - Collect available ATA SMART blobs; they are very useful in debugging
      libatasmart related problems and do not usually pose a privacy risk.
 -- Martin Pitt <email address hidden> Sat, 14 Nov 2009 16:46:31 -0600

Changed in devicekit-disks (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Sorry, that wasn't meant to be closed again.

> ENV{DKD_PARTITION_TABLE__SCHEME}=="apm", \

You used two underscores here (between TABLE and SCHEME). Can you please remove one and try again?

Thanks!

Changed in devicekit-disks (Ubuntu):
status: Fix Released → Incomplete
Revision history for this message
Dennis Craven (dcraven) wrote : Re: [Bug 474790] Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

On Sun, Nov 15, 2009 at 8:08 AM, Martin Pitt <email address hidden> wrote:

> Sorry, that wasn't meant to be closed again.
>
> > ENV{DKD_PARTITION_TABLE__SCHEME}=="apm", \
>
> You used two underscores here (between TABLE and SCHEME). Can you please
> remove one and try again?
>
>
Oops! My bad. Getting rid of the double underscore typo does work. Sorry.

So, the entry that works is this:

 ENV{DKD_PARTITION_TABLE_SCHEME}=="apm", \
  ENV{ID_CDROM}=="?*", ENV{ID_FS_TYPE}=="udf",
ENV{ID_FS_LABEL}=="WD_SmartWare", \
  ENV{DKD_PRESENTATION_HIDE}="1"

Thanks Martin!

Revision history for this message
In , Martin Pitt (pitti) wrote :

Created an attachment (id=31257)
git formatted patch

This was confirmed to work.

Revision history for this message
Martin Pitt (pitti) wrote : Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

Thanks for testing!

Changed in devicekit-disks (Ubuntu):
status: Incomplete → Fix Committed
Revision history for this message
In , Martin Pitt (pitti) wrote :

Created an attachment (id=31637)
git formatted patch

Updated to current git head for udisks renaming.

Revision history for this message
In , Zeuthen (zeuthen) wrote :

Committed. Thanks!

Changed in devicekit:
status: Confirmed → Fix Released
Revision history for this message
Fabio Marzocca (thesaltydog) wrote : Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

In order to get this working on Karmic, can I just safely copy those lines into /lib/udev/rules.d/95-devkit-disks.rules?

Thanks

Revision history for this message
Martin Pitt (pitti) wrote : Re: [Bug 474790] Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

Fabio Marzocca [2010-01-27 13:46 -0000]:
> In order to get this working on Karmic, can I just safely copy those
> lines into /lib/udev/rules.d/95-devkit-disks.rules?

Yes, that should work fine.

Revision history for this message
Martin Pitt (pitti) wrote : Re: DeviceKit should ignore SmartWare partitions when using Western Digital external drives

This is fixed in lucid now (in udisks)

affects: devicekit-disks (Ubuntu) → udisks (Ubuntu)
Changed in udisks (Ubuntu):
status: Fix Committed → Fix Released
summary: - DeviceKit should ignore SmartWare partitions when using Western Digital
- external drives
+ Should ignore SmartWare partitions when using Western Digital external
+ drives
affects: devicekit → udisks
Revision history for this message
Micah Bucy (micah-bucy) wrote :

Unfortunately this doesn't work for me in Lucid. The relevant code I found is located in /lib/udev/rules.d/80-udisks.rules and not in 95-devkit-disks.rules, which I'm guessing is fine. The code appears as:

# APM recovery/tool partitions which are useless on Linux
ENV{UDISKS_PARTITION_SCHEME}=="apm", \
  ENV{ID_CDROM}=="?*", ENV{ID_FS_TYPE}=="udf", ENV{ID_FS_LABEL}=="WD_SmartWare", \
  ENV{UDISKS_PRESENTATION_HIDE}="1"

Revision history for this message
Micah Bucy (micah-bucy) wrote :

using udevadm test shows no UDISKS_PRESENTATION_HIDE=1

if I switch the code to
ATTRS{vendor}=="WD*", ATTRS{model}=="Virtual CD*", ENV{UDISKS_PRESENTATION_HIDE}="1"

Then I get UDISKS_PRESENTATION_HIDE=1

I think I would need a restart to see the effect in nautilus, which I am not currently prepared to do.

Revision history for this message
Micah Bucy (micah-bucy) wrote :

Actually I figured out I could safely remove and reattach one of the drives. I can confirm the Smartware device is hidden with the code I used. I came across http://tolecnal.net/2007/04/writing-udev-rules/ in which the person had issues using ID_SERIAL for identification. I'm wondering if there was a bug with ID_* matching that has somehow resurfaced.

Changed in udisks:
importance: Unknown → Medium
Changed in udisks:
importance: Medium → Unknown
Changed in udisks:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.