# kioslaves / pmount only mounts as root. [solved] by ntfs-3g

## tipp98

So I'm trying to mount removable usb drives with user access ( write permission ) through KDE media and it's not working. I see dozens and dozens of threads regarding the same/similar issues and wonder, what is making this so difficult? Is it a kernel issue? Is it a portage problem? Is there some rogue file left over from something I previously did? ...

I once had ivman trying to get this to work, it's gone now. I did have the gparted lock file that I've seen mentioned and that has been deleted. This allowed me to mount filesystems by clicking on them in KDE media (but with root:root owner, except for vfat, that gives me kyle:root). I've removed/installed hal, hal-info, dbus, kioslaves, pmount several times in different orders hoping to get it going right, but it works less now than it did before ( now ext3 won't mount, giving me "TODO: have to rethink extra options" ). I am running from kdebase-startkde install and no kdm (although it is installed). KDE starts by mean of /etc/conf.d/local.start as described here. At first I thought well shoot, if kioslaves supposedly uses pmount, and pmount doesn't work right, then I need to get pmount working right. But now, I'm not sure pmount isn't working right. It says it allows normal users to mount filesystems, and it does this for me. So can someone confirm that pmount is doing what it was designed to do, and more importantly if I can/how can I get this setup working the way I want it? 

Also, what's the deal with kioslaves, there are 4 different styles in portage, all with different sizes? Are they all the same or do some provide functionality that others do not?

```
kyle@Falcon ~ $ groups

wheel floppy audio cdrom video cdrw usb users distcc portage kyle plugdev shutdown

```

```
kyle@Falcon ~ $ emerge -pv hal dbus kdebase-kioslaves kdemultimedia-kioslaves pmount udev

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] sys-fs/udev-119  USE="(-selinux)" 0 kB

[ebuild   R   ] sys-apps/dbus-1.1.20  USE="X -debug -doc (-selinux)" 0 kB

[ebuild   R   ] kde-base/kdemultimedia-kioslaves-3.5.9  USE="xinerama -arts -debug -encode -flac -kdeenablefinal -mp3 -vorbis" 0 kB

[ebuild   R   ] sys-apps/hal-0.5.11-r1  USE="X acpi crypt -apm -debug -dell -disk-partition -doc -laptop (-selinux)" 0 kB

[ebuild   R   ] kde-base/kdebase-kioslaves-3.5.9  USE="hal ldap samba xinerama -arts -debug -kdeenablefinal -kdehiddenvisibility -openexr" 0 kB

[ebuild   R   ] sys-apps/pmount-0.9.16  USE="crypt hal" 0 kB

```

```
Falcon ~ # rc-update -s

               acpid |      default

           alsasound | boot

            bootmisc | boot

             checkfs | boot

           checkroot | boot

               clock | boot

         consolefont | boot

                dbus |      default

         distccd-x86 |      default

                hald |      default

            hostname | boot

             keymaps | boot

               local |      default nonetwork

          localmount | boot

             modules | boot

            net.eth0 |      default

              net.lo | boot

            netmount |      default

                 nfs |      default

           rmnologin | boot

           syslog-ng |      default

             urandom | boot

```

Last edited by tipp98 on Wed Jul 23, 2008 5:56 pm; edited 1 time in total

----------

## tgurr

You don't need pmount (anymore) for kde-base/kdebase-kioslaves to work,  USE="hal" should be sufficient. However there are two problems left:

1. udev: USB devices are owned by root:disk so you'll also have to put your users also in the disk group which is not a very good idea since it enables users to do some fancy stuff with your harddrives as well. Another solution to this would be to write your own udev rule for usb devices to put them under control of the plugdev group.

2. hal: hal won't let you mount ntfs stuff anymore, see Bug 205901.

----------

## tipp98

Hmmmm..... very interresting. First off, I grabbed an external ntfs drive, as I will be using these, to verify my stuff won't work, and it indeed does not work with the error that you gave me.

Also, why is it that vfat works, meaning I am the owner and root is the group (silly, as I am not part of root)? And if root:disk owns the drives, the why do the partitions (ext2,3) get mount root:root?

Now for the interresting part. This "TODO: have to rethink extra options" business... I was receiving this on ext3 partitions after trying to ignorantly hack /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi:

```
      <!-- allow these mount options for ext3 -->

      <match key="volume.fstype" string="ext3">

        <append key="volume.mount.valid_options" type="strlist">acl</append>

        <append key="volume.mount.valid_options" type="strlist">user_xattr</append>

#         <append key="volume.mount.valid_options" type="strlist">uid=0</append>

#         <append key="volume.mount.valid_options" type="strlist">gid=100</append>

#         <append key="volume.mount.valid_options" type="strlist">umask=0777</append>

        <append key="volume.mount.valid_options" type="strlist">data=</append>

      </match>

```

I've removed these lines and my ext3 works, but now I can't help but wonder if there is something in this file we can alter to get ntfs working ??? And on another observation, I noticed that the bug was opened on 1/14/08 and it is now 7/18/08 and I have a different version than the one that the bug was originally posted to. So what about this comment by ZITTA "Perhaps it could be masked to let the author "rethink"  :Smile: " Anyway, how dangerous is it to go back to a working version?

----------

## tipp98

Well, I don't have write access to ext2/3, as I haven't looked at the udev rules yet, but I managed to get ntfs accessible and writable. And that is good enough for me, for now.

```
emerge -av1 "<hal-0.5.10"     - to fix ntfs , before developer started thinking :p

emerge -u ntfsprogs           - write support on by default
```

Oh, and I had to recompile my kernel with ntfs write support as I was using ntfs-3g.

Thanks for the help tgurr!

----------

## tipp98

So I lied. Instead of actually writing anything I was just looking at the permissions. If I try to write something I receive an "Access denied." error.

Apparently, udev rules have nothing to do with the way kioslaves mounts drives. I added the following rule for the firewire interface.

```
SUBSYSTEMS=="ieee1394", GROUP="plugdev", MODE="770"
```

and I get the following as expected.

```
brwxrwx--- 1 root plugdev   8,  96 2008-07-22 23:46 sdg

brwxrwx--- 1 root plugdev   8,  97 2008-07-22 23:46 sdg1
```

But, when it gets mounted...

```
drwx------ 1 kyle root 12288 2008-07-21 20:17 BACKUPS
```

From /etc/mtab

```
/dev/sdg1 /media/BACKUPS ntfs rw,nosuid,nodev,uid=1000,utf8 0 0
```

From /proc/config.gz

```
CONFIG_NTFS_FS=y

CONFIG_NTFS_RW=y
```

From /usr/share/hal/fdi/policy/10osvendor/20-storage-methods.fdi

```
<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">

  <device>

    <match key="info.udi" string="/org/freedesktop/Hal/devices/computer">

      <append key="info.callouts.add" type="strlist">hal-storage-cleanup-all-mountpoints</append>

    </match>

    <match key="storage.media_check_enabled" bool="true">

      <append key="info.addons" type="strlist">hald-addon-storage</append>

    </match>

    

    <match key="volume.fsusage" string="filesystem">

      <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.Volume</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Mount</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">ssas</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">mount_point fstype extra_options</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-mount</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Unmount</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-unmount</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_names" type="strlist">Eject</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_signatures" type="strlist">as</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_argnames" type="strlist">extra_options</append>

      <append key="org.freedesktop.Hal.Device.Volume.method_execpaths" type="strlist">hal-storage-eject</append>

      <!-- allow these mount options for all file systems -->

      <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="Linux">

        <append key="volume.mount.valid_options" type="strlist">ro</append>

        <append key="volume.mount.valid_options" type="strlist">sync</append>

        <append key="volume.mount.valid_options" type="strlist">dirsync</append>

        <append key="volume.mount.valid_options" type="strlist">noatime</append>

        <append key="volume.mount.valid_options" type="strlist">nodiratime</append>

        <append key="volume.mount.valid_options" type="strlist">noexec</append>

        <append key="volume.mount.valid_options" type="strlist">quiet</append>

        <append key="volume.mount.valid_options" type="strlist">remount</append>

        <append key="volume.mount.valid_options" type="strlist">exec</append>

      </match>

      <!-- allow these mount options for ntfs -->

      <match key="volume.fstype" string="ntfs">

        <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="Linux">

          <append key="volume.mount.valid_options" type="strlist">rw</append>

          <append key="volume.mount.valid_options" type="strlist">uid=</append>

          <append key="volume.mount.valid_options" type="strlist">gid=</append>

          <append key="volume.mount.valid_options" type="strlist">umask=</append>

          <append key="volume.mount.valid_options" type="strlist">locale=</append>

          <append key="volume.mount.valid_options" type="strlist">utf8</append>

        </match>

      </match>

    </match>

  </device>

</deviceinfo>
```

Does anybody out there have any more ideas? I just recently switched over to utf8 if that might cause a problem, but I don't know how to go about testing that theory out. Not that I want to....  :Confused: 

----------

## tipp98

Bingo! 

From this top

```
ln -s /bin/ntfs-3g /sbin/mount.ntfs
```

The irony here is that this post is the one that lead me down the ntfsprogs path...   :Evil or Very Mad:   I wasn't able to get that working.

----------

## d2_racing

The best thing to do is this :

```

# echo 'sys-fs/ntfsprogs fuse' ­­>> /etc/portage/package.use 

# emerge -v ntfsprogs 

 
```

And then mount your partition by hand with the root account.

```

# ntfsmount /dev/sdb1 /media -o ro 

 
```

After that, the user can acces the /media without any problem.

----------

## mamac

Hi,

I worked with ntfs-3g and decided to give a try to ntfsmount but it gives me errors, ntfs-3g does it well (but manually) for me.

Still no way for ntfs partitions to be mounted automatically under KDE? What about the bug?

----------

## mamac

Hi,

Someone found a fix for the bug, you can now mount your ntfs external usb drive with r/w access.

Just need to modify hal ebuild and emerge the instable ntfs-3g with hal flag.

Enjoy!

----------

## d2_racing

Can you post the exact solution plz ?

----------

## mamac

I'd say:

1. fetch only hal package

```

# emerge -f hal

```

2. unpack sources

```

# ebuild /usr/portage/sys-apps/hal-[your_version_of_hal].ebuild unpack

```

3. Now you will find a file in the work directory in /var/tmp/portage/sys-apps/hal_etc... a directory called 'tools' and in this directory a file called 'hal-storage-mount.c'. Edit the file and find the following lines, add the lines marked with a ++ (of course don't add the '++'!):

```

      if (strcmp (libhal_volume_get_fstype (volume), "vfat") != 0 &&

+          strcmp (libhal_volume_get_fstype (volume), "ntfs") != 0 &&

+          strcmp (libhal_volume_get_fstype (volume), "ntfs-3g") != 0 &&

           strcmp (libhal_volume_get_fstype (volume), "iso9660") != 0 &&

           strcmp (libhal_volume_get_fstype (volume), "hfs") != 0 &&

           strcmp (libhal_volume_get_fstype (volume), "udf") != 0) {

```

4. hal source is now changed, we need to merge it:

```

# ebuild /usr/portage/sys-apps/hal-[your_version_of_hal].ebuild merge

```

5. hal is now merged with the fix, restart it

```

# /etc/init.d/hald restart

```

6. if you want read access, make sure ntfs support is enabled in you kernel and that should be enough. If you want write access, you need to use unstable ntfs-3g emerged with hal flag. Add ntfs-3g to your keyword file to get the latest version and make sure it's build with hal flag.

You should now be able to plug your usb ntfs drive and use it normally.

----------

## d2_racing

I guess that this little problem will be solve in a near futur officially ?

----------

## mamac

I think it will be officially fixed when the fix for hal will be published in its stable version, and when ntfs3g-1.2531-r1 will be declared as stable as it's the first version to have 'hal' USE flag.

I have no idea how long it could take.

----------

## d2_racing

No problem, for now I use NTFS-PROG and I mount my partition with root, and after that it automagically works with my user.

When I do that, I see a new icone on my KDE desktop and everything works like the old time.

----------

## renrutal

 *mamac wrote:*   

> You should now be able to plug your usb ntfs drive and use it normally.

 

Ahhhh it works! Thank you!

----------

## Sevein

 *mamac wrote:*   

> I'd say:
> 
> [...]
> 
> You should now be able to plug your usb ntfs drive and use it normally.

 

mamac, your solution worked for me! unstable ntfs-3g, hal patched, kde, or whatever, finally mounts!

THANKS!!

----------

