hald not parsing policies under /etc/hal/fdi/policy on kubuntu feisty

Bug #115768 reported by Adriano Provvisiero
16
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Fix Released
Undecided
Martin Pitt
ntfs-config (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: hal

Hello,

recently i installed ntfs-config, a package that attempts to tell hal to mount ntfs partitions using the ntfs-3g (read/write) driver.
ntfs-config tries to achieve so by symlinking one of its policy files under /etc/hal/fdi/policy. The file gets blatantly ignored (even if the hald cache gets invalidated if any modifications are made to such file, judging from the output of hald --daemon=no --verbose=yes, therefore hald is picking that file up). The driver hald tries to use when mounting the partition is still the read only ntfs driver.

The same policy file, nevertheless, works like a charm if placed under /usr/share/hal/fdi/policy/10osvendor, where all of the other standard policy files already reside. Is this a mistake on ntfs-config's side (ie the /etc directory isn't parsed by design by hal), or is this not intentional and somehow hald is skipping out that directory ?

here's the policy file:

--

<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">

<!-- file created by ntfs-config -->
<!-- mount ntfs volume with the ntfs-3g driver to enable write support -->

    <device>
        <match key="volume.fstype" string="ntfs">
                    <match key="@block.storage_device:storage.hotpluggable" bool="true">
                            <merge key="volume.fstype" type="string">ntfs-3g</merge>
                <merge key="volume.policy.mount_filesystem" type="string">ntfs-3g</merge>
                            <append key="volume.mount.valid_options" type="strlist">locale=</append>
                </match>
            </match>
    </device>

</deviceinfo>

--

and a few more infos:

hal package version: 0.5.9-1ubuntu2~feisty1
ntfs-config version: Version: 0.5.5-0ubuntu1
uname -r: 2.6.20-15-generic
the distribution is Kubuntu Feisty 7.04

Thanks for your time.
nuu

Tags: patch
Revision history for this message
Nikolay Pavlov (qpadla-deactivatedaccount) wrote :

The error is not in hal. The problem is that there is no policykit in kubuntu/ubuntu distributions. Try to watch you .xsession-errors while plug in ntfs-3g device and you'll see something like this:
kded: ERROR: mount failed for /org/freedesktop/Hal/devices/volume_uuid_2EE506BF000932C2: org.freedesktop.Hal.Device.PermissionDeniedByPolicy - hal-storage-removable-mount-all-opti
ons refused uid 1000
kded: ERROR: mounting /org/freedesktop/Hal/devices/volume_uuid_2EE506BF000932C2 returned hal-storage-removable-mount-all-options refused uid 1000
MediaManager::slotMediumAdded: sdb1_1

Revision history for this message
Adriano Provvisiero (nuu) wrote :

excuse me if I insist, but something's still unclear to me: why does the absence of polkit impair hal's ability to parse a perfectly valid path, such as /etc/hal/fdi/policy, for policy files ?
And why does hald cache get invalidated but the policy skipped altogether ?
I still don't get it..

nuu

Revision history for this message
Nikolay Pavlov (qpadla-deactivatedaccount) wrote :

Are you sure that it is not parsed here is the end of my hald output when i am inserting usb storage:

13:28:22.797 [I] device_info.c:1530: *** Matched file /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi
13:28:22.798 [I] device_info.c:1530: *** Matched file /etc/hal/fdi/policy/20-ntfs-config-write-policy.fdi

But nevertheless it's not mounted due to this:

kded: ERROR: mount failed for /org/freedesktop/Hal/devices/volume_uuid_2EB92C743887D7D3: org.freedesktop.Hal.Device.PermissionDeniedByPolicy - hal-storage-removable-mount-all-opti
ons refused uid 1000
kded: ERROR: mounting /org/freedesktop/Hal/devices/volume_uuid_2EB92C743887D7D3 returned hal-storage-removable-mount-all-options refused uid 1000
MediaManager::slotMediumAdded: sdb1
kded: ERROR: mount failed for /org/freedesktop/Hal/devices/volume_uuid_2EB92C743887D7D3: org.freedesktop.Hal.Device.PermissionDeniedByPolicy - hal-storage-removable-mount-all-opti
ons refused uid 1000
kded: ERROR: mounting /org/freedesktop/Hal/devices/volume_uuid_2EB92C743887D7D3 returned hal-storage-removable-mount-all-options refused uid 1000

Revision history for this message
Adriano Provvisiero (nuu) wrote :

I believe we are discussing two different problems here. The error you get is indicative of the absence of polkit, as you correctly observed, and it is an error I get even without ntfs-config (and I thought about reporting it at the time, but eventually forgot about it since i could fix the ntfs-3g automounting as of my first post, and after that it slipped my mind).
This bug report is about the ntfs-config (and supposedly any other) policy file not being parsed under the /etc-based hal policy directory tree. If you move that very same policy file under the /usr/share-based hal policy directory tree, the policy kicks in as soon as you plug the device in, and the ntfs partition gets mounted flawlessly and instantly.

From your output, it looks like you have the ntfs-config policy file under /etc/hal/fdi/policy. What happens if you issue a "sudo mv /etc/hal/fdi/policy/20-ntfs-config-write-policy.fdi /usr/share/hal/fdi/policy/10osvendor" ? On my system, that gets rid of the polkit-related errors, and as i reported in my first post, mounts the partition finely, using the ntfs-3g driver.

nuu

Revision history for this message
Nikolay Pavlov (qpadla-deactivatedaccount) wrote :

I can confirm that i don't see any .xsession-errors, but removable usb storage device is still not functional. Are you sure that we are talking about exactly removable devices, because my fixed ntfs-3g HDD partition works? I want to try to build policykit manually and see if it fix my problem.

Revision history for this message
Adriano Provvisiero (nuu) wrote :

Yes, I am sure. In my case, it's an external 40gb 2.5" USB Disk, with only one partition on it, formated as NTFS. The policy contains precisely the data I pasted in my first post. The partition automounts finely using the ntfs-3g driver. I only have the ntfs-3g and ntfs-config packages installed, from the official repos. I don't have pmount installed. If you need any more infos, just ask.

nuu

Revision history for this message
Nikolay Pavlov (qpadla-deactivatedaccount) wrote :

Could you please send me lshal dump regarding this device i want to compare it with mine. I am using 1Gb usb stick by the way.

Revision history for this message
Adriano Provvisiero (nuu) wrote :

There it is:

udi = '/org/freedesktop/Hal/devices/volume_uuid_A23072FA3072D4AF'
  block.device = '/dev/sdb1' (string)
  block.is_volume = true (bool)
  block.major = 8 (0x8) (int)
  block.minor = 17 (0x11) (int)
  block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_IC25N040_ATCS04_0_0_0' (string)
  info.capabilities = {'volume', 'block'} (string list)
  info.category = 'volume' (string)
  info.interfaces = {'org.freedesktop.Hal.Device.Volume'} (string list)
  info.parent = '/org/freedesktop/Hal/devices/storage_serial_IC25N040_ATCS04_0_0_0' (string)
  info.product = 'USB40' (string)
  info.udi = '/org/freedesktop/Hal/devices/volume_uuid_A23072FA3072D4AF' (string)
  linux.hotplug_type = 3 (0x3) (int)
  linux.sysfs_path = '/sys/block/sdb/sdb1' (string)
  org.freedesktop.Hal.Device.Volume.method_argnames = {'mount_point fstype extra_options', 'extra_options', 'extra_options'} (string list)
  org.freedesktop.Hal.Device.Volume.method_execpaths = {'hal-storage-mount', 'hal-storage-unmount', 'hal-storage-eject'} (string list)
  org.freedesktop.Hal.Device.Volume.method_names = {'Mount', 'Unmount', 'Eject'} (string list)
  org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'} (string list)
  storage.model = '' (string)
  volume.block_size = 512 (0x200) (int)
  volume.fstype = 'ntfs-3g' (string)
  volume.fsusage = 'filesystem' (string)
  volume.fsversion = '3.1' (string)
  volume.ignore = false (bool)
  volume.is_disc = false (bool)
  volume.is_mounted = true (bool)
  volume.is_mounted_read_only = false (bool)
  volume.is_partition = true (bool)
  volume.label = 'USB40' (string)
  volume.linux.is_device_mapper = false (bool)
 volume.mount.valid_options = {'locale=', 'ro', 'sync', 'dirsync', 'noatime', 'nodiratime', 'noexec', 'quiet', 'remount', 'exec'} (string list)
  volume.mount_point = '/media/USB40' (string)
  volume.num_blocks = 78140097 (0x4a852c1) (int)
  volume.partition.flags = {} (string list)
  volume.partition.label = '' (string)
  volume.partition.media_size = 40007761920 (0x950a60000) (uint64)
  volume.partition.number = 1 (0x1) (int)
  volume.partition.scheme = 'mbr' (string)
  volume.partition.start = 32256 (0x7e00) (uint64)
  volume.partition.type = '0x07' (string)
  volume.partition.uuid = '' (string)
  volume.policy.mount_filesystem = 'ntfs-3g' (string)
  volume.size = 40007729664 (0x950a58200) (uint64)
  volume.unmount.valid_options = {'lazy'} (string list)
  volume.uuid = 'A23072FA3072D4AF' (string)

nuu

Revision history for this message
Nikolay Pavlov (qpadla-deactivatedaccount) wrote :

Adriano i want to confirm the original behavior described in this bug report. I've reinstalled my kubuntu 7.04 and found that ntfs-3g works only if 20-ntfs-config-write-policy.fdi is located under /usr/share/hal/fdi/policy/10osvendor directory. If it's located in the /etc/hal/fdi/policy then hald is spamming .xsession-errors with this messages:

kded: ERROR: mount failed for /org/freedesktop/Hal/devices/volume_uuid_2EB92C743887D7D3: org.freedesktop.Hal.Device.PermissionDeniedByPolicy - hal-storage-removable-mount-all-opti
 ons refused uid 1000
 kded: ERROR: mounting /org/freedesktop/Hal/devices/volume_uuid_2EB92C743887D7D3 returned hal-storage-removable-mount-all-options refused uid 1000
 MediaManager::slotMediumAdded: sdb1
 kded: ERROR: mount failed for /org/freedesktop/Hal/devices/volume_uuid_2EB92C743887D7D3: org.freedesktop.Hal.Device.PermissionDeniedByPolicy - hal-storage-removable-mount-all-opti
 ons refused uid 1000
 kded: ERROR: mounting /org/freedesktop/Hal/devices/volume_uuid_2EB92C743887D7D3 returned hal-storage-removable-mount-all-options refused uid 1000

Revision history for this message
Adriano Provvisiero (nuu) wrote :

OK, thanks for all your time and help.

nuu

Changed in hal:
status: New → Confirmed
Revision history for this message
Cláudio Silva (gphoenixpower) wrote :

Has anyone ever tried to add the user to the disk group?

Revision history for this message
Adriano Provvisiero (nuu) wrote :

I tried, but that doesn't solve the problem. The policy is still ignored. I suppose you intended to fix the permission problem when automounting with the default ntfs driver, but that didn't work either on my laptotp.

nuu

Revision history for this message
Basilio Kublik (sourcercito) wrote :

is by any chance your user in the plugdev group?,

Revision history for this message
Nikolay Pavlov (qpadla-deactivatedaccount) wrote :

Yup. This is the default.

Revision history for this message
Assid (assid) wrote :

i can confirm this.. copying the file across works fine. can we make this a permanent and global change for gutsy? I now have to update this on my other laptop incase i forget

Revision history for this message
Drew Woodard (drew-woodard) wrote :

I can also confirm this. Using Kubuntu Gutsy beta. Doing a:
sudo cp "/etc/hal/fdi/policy/20-ntfs-config-write-policy.fdi" "/usr/share/hal/fdi/policy/10osvendor/"

as mentioned by Nikolay Pavlov seems to have resolved the issue for me.

Revision history for this message
Drew Woodard (drew-woodard) wrote :

I should say as mentioned by Adriano Provvisiero and Nikolay Pavlov.

I have also tried this on a second machine with a different ntfs external drive that was experiencing the same problem and it resolved the issue in that case as well.

Revision history for this message
Andreas Ntaflos (daff) wrote :

Hello,

excuse my trying to take advantage of the momentum this bug report seems to still have, but I have a somewhat related issue accessing a removable external SATA (eSATA) disk formatted with Ext3. I am using the latest Kubuntu 7.10 (which by now should be all but properly released) with KDE 3.5.7.

Upon plugging in an external, removable SATA (eSATA) hard disk formatted with Ext3 I get the following messages in .xsession-errors:

kded: ERROR: mount failed for /org/freedesktop/Hal/devices/volume_uuid_6591d79f_e4db_4fb6_9edd_fdc18d5a9731: org.freedesktop.Hal.Device.PermissionDeniedByPolicy - hal-storage-fixed-mount refused uid 1000
kded: ERROR: mounting /org/freedesktop/Hal/devices/volume_uuid_6591d79f_e4db_4fb6_9edd_fdc18d5a9731 returned hal-storage-fixed-mount refused uid 1000

Dolphin (D3lphin) says "hal-storage-fixed-mount refused uid 1000", too.

Manually issuing "pmount /dev/sdb1 /media/mydisk" says:

Error: device /dev/sdb1 is not removable

Which is consistent with the lshal output saying "storage.removable = false (bool)" for that disk.

Manually mounting (i.e. with mount, not pmount) works fine. Creating an entry in /etc/fstab and mounting via that works fine, too, both as a regular user and as root.

I am not sure what exactly the underlying problem is, but I suspect that noone has yet thought of describing a policy for removeable, external SATA disks (formatted Ext3)? What does it take to write a suitable policy? This also seems to be purely a HAL problem, not KDE-, kernel- or even hardware-related. I am attaching the output of lshal as well.

Sorry again for hijacking this thread. I will eventually file a standalone bug report on this problem, but maybe someone here knows how to work around it.

Thanks in advance!

Revision history for this message
Anthony Mercatante (tonio) wrote :

Although this seems to be a hal bug, here is a workarround debdiff to make ntfs-config use of /usr/share/hal in the first place.
Tested here and work.
I won't upload that one to hardy, as this seems to me as a workarround, hal should be able to read fdi files in /etc/hal/policy
Feel free to use the debdiff and upload to hardy if you feel it should/could reach the repos.

Revision history for this message
Anthony Mercatante (tonio) wrote :

The file :)

Revision history for this message
Anthony Mercatante (tonio) wrote :

Fixed debdiff that installs in 10osvendor directly, as even 20thirdparty folder seems to be unread.

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

Please let's not work around this bug in ntfs-config. Hal is supposed to properly read policies from /etc/hal/fdi.

Changed in ntfs-config:
status: New → Invalid
Changed in hal:
assignee: nobody → pitti
milestone: none → ubuntu-8.04-beta
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

This is fixed in current hardy. I created a test file /etc/hal/fdi/policy/test.fdi with

--- snip ---
<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->

<deviceinfo version="0.2">
  <device>
    <match key="block.is_volume" bool="true">
      <merge key="volume.ignore" type="bool">true</merge>
    </match>
  </device>
</deviceinfo>
--- snip ---

When I saved it, hal's inotify magic instantly picked it up: I plugged in my USB stick, and it wasn't mounted (lshal confirmed that volume.ignore was true). I remove it again, unplug/replug, it's mounted again.

So I'd say that /etc/hal/fdi is parsed correctly now.

Changed in hal:
status: In Progress → Fix Released
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.