# kde, hal, udev-rules, and seeing desktop devices .. [SOLVED]

## rsa4046

I know there was a similar posting to the following. I've got the following built:

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

[ebuild   R   ] sys-apps/dbus-0.62-r1  USE="X mono python qt3 qt4 -debug -doc -gtk (-selinux)" 0 kB

[ebuild   R   ] sys-apps/hal-0.5.7-r3  USE="acpi crypt -debug -dmi -doc -pcmcia (-selinux)" 0 kB

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

```

From the results of

```
# udevinfo -a -p `udevinfo -q path -n /dev/sdc` | grep ATTRS{serial}

    ATTRS{serial}=="DEF1031F45F0"

    ATTRS{serial}=="0000:00:02.1"

# udevinfo -a -p `udevinfo -q path -n /dev/sdc` | grep ATTRS{product}

    ATTRS{product}=="USB2.0 Storage Device"

    ATTRS{product}=="EHCI Host Controller" 
```

I made the following udev rule

```
# cat /etc/udev/rules.d/10-udev.rules

BUS=="usb", ATTRS{serial}=="DEF1031F45F0", NAME="%k", KERNEL=="sd*", SYMLINK+="usbdrive"
```

In fstab, the mountpoint appears as

```
/dev/usbdrive           /media/usbdrive vfat noauto,user        0 0
```

After turning the drive on, I have

```
$ ls /dev/usbdrive

lrwxrwxrwx 1 root root 4 2006-12-09 16:16 /dev/usbdrive -> sdc1
```

and I can successfully mount it as user

```
$ mount /media/usbdrive
```

but it  shows on the desktop only as an "Removable Drive (unmounted)", and konqueror spins endlessly trying to see drive contents in media://.  Anybody point me to my mistake?

----------

## mikers456

Ummm... Permissions on that device?  Is the user part of a group that can actually mount devices?  You can set permissions on the device with udev rules.

What does dmesg say?

----------

## rsa4046

mikers456, Thanks for the tip. I got it working by adding a user declaration 

```
BUS=="usb", ATTRS{serial}=="DEF1031F45F0", NAME="%k", KERNEL=="sd*", SYMLINK+="usbdrive", GROUP="plugdev"
```

and adding myself. With hald running, it creates a mount entry under /media automatically, the device pops up, and is then user-mountable from the desktop and browsable in konqueror under media://.  :Very Happy: 

EDIT, Added: emerging pmount also cured problems with unmounting from the desktop.

----------

## mikers456

groovy

----------

## lost_soul

Hmmm. Having almost the same problem.. But still I cannot resolve it..

Here is my info:

```

$ grep -i usbhdd /etc/fstab

/dev/usbhdd   /media/f  auto            rw,user,uid=1000,gid=100                 0 0

$ cat /etc/udev/rules.d/my-udev.rules

# pass all events to the HAL daemon

# unmount block devices when they are removed

SYSFS{model}=="00JB-22KFA0", KERNEL=="sd*1", SYMLINK+="usbhdd", GROUP="plugdev"

$ ls -al /dev/usbhdd

lrwxrwxrwx 1 root root 4 Дек 11 06:03 /dev/usbhdd -> sda1

$ ls -al /dev/sda1

brw-rw---- 1 root plugdev 8, 1 Дек 11 06:03 /dev/sda1

$ id

uid=1000(hell) gid=100(users) groups=5(tty),6(disk),10(wheel)

,12(mail),15(man),16(cron),18(audio),19(cdrom),

27(video),35(games),80(cdrw),85(usb),100(users),

245(locate),250(portage),440(dhcp),442(vmware)

,443(plugdev),445(haldaemon)

$ emerge -pv hal dbus udev kde

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

Calculating dependencies... done!

[ebuild   R   ] sys-apps/hal-0.5.7-r3  USE="acpi crypt dmi pcmcia -debug -doc (-selinux)" 0 kB

[ebuild   R   ] sys-apps/dbus-0.62-r1  USE="X gtk python qt3 qt4 -debug -doc -mono (-selinux)" 0 kB

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

[ebuild   R   ] kde-base/kde-3.5.5  USE="-accessibility" 0 kB

```

I can mount the drive through the console like a:

```
mount /media/f
```

Also It is mounting the device if it's specified in fstab as sda1 not a Udev Symlink like a:

```
$ grep -i sda1 /etc/fstab

/dev/sda1   /media/f  auto            rw,user,uid=1000,gid=100                 0 0
```

But when I'm trying to mount this device with fstab entry as /dev/usbhdd in KDE: It says: "Permission Denied"

----------

## rsa4046

 *lost_soul wrote:*   

> Hmmm. Having almost the same problem.. But still I cannot resolve it.

 

Did you enable hal use flags for kde? That change made a big difference for me:

```
# equery hasuse hal

[ Searching for USE flag hal in all categories among: ]

 * installed packages

[I--] [  ] kde-base/kdebase-kioslaves-3.5.5-r1 (3.5)

# emerge -vp kde-base/kdebase-kioslaves

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

Calculating dependencies... done!

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

Total size of downloads: 0 kB
```

Not sure how you've got kde set up in terms of split ebuilds, but check your USE flags. Actually, in the end in found it easiest to forgo writing my own udev rules, and instead just emerged pmount (together with udev-103, dbus, and hal). This made the whole issue of mount points and permissions, etc., moot, with only a few tweaks to get everything right (adding users to plugdev group and creating a /media folder).

----------

## lost_soul

Sure.

Here it is:

```
[ebuild   R   ] kde-base/kdebase-3.5.5-r1  USE="arts cups hal ieee1394 java lm_sensors logitech-mouse opengl pam ssl -debug -kdeenablefinal -kdehiddenvisibility -ldap -openexr -samba -xcomposite -xinerama -xscreensaver -zeroconf" 0 kB
```

and pmount also:

```
$ emerge -pv pmount

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

Calculating dependencies... done!

[ebuild   R   ] sys-apps/pmount-0.9.9  USE="crypt" 0 kB
```

```
$ equery hasuse hal

[ Searching for USE flag hal in all categories among: ]

 * installed packages

[I--] [ -] app-emulation/wine-0.9.22 (0)

[I--] [  ] gnome-base/gnome-vfs-2.14.2-r1 (2)

[I--] [M~] media-sound/bmpx-0.20.3 (0)

[I--] [  ] app-cdr/k3b-0.12.14 (0)

[I--] [  ] kde-base/kdebase-3.5.5-r1 (3.5)
```

I dunno why it doesnt work..

----------

## rsa4046

 *lost_soul wrote:*   

> Sure.
> 
> Here it is:
> 
> ```
> ...

 Sorry list_soul, I think I got you sidetracked, didn't read your first post carefully. Is udev creating the symlink successfully? Please turn drive on and test by posting results of 

```
# udevinfo -a -p `udevinfo -q path -n /dev/sda` | grep ATTRS{model}
```

or

```
# udevinfo -a -p `udevinfo -q path -n /dev/sda` | grep ATTRS{serial}
```

and also 

```
# ls -l /dev/usb*
```

----------

## lost_soul

Sure.

```
~ $ ls -al /dev/usbhdd

lrwxrwxrwx 1 root root 4 Дек 11 06:21 /dev/usbhdd -> sdb1

~ $ ls -al /dev/sdb1

brw-rw---- 1 root plugdev 8, 17 Дек 11 06:21 /dev/sdb1

~ $ udevinfo -a -p `udevinfo -q path -n /dev/sdb` | grep ATTRS{serial}

    ATTRS{serial}=="BC30CD"

    ATTRS{serial}=="0000:00:1d.7"

~ $ udevinfo -a -p `udevinfo -q path -n /dev/sdb` | grep ATTRS{model}

    ATTRS{model}=="00JB-22KFA0     "
```

----------

## rsa4046

 *lost_soul wrote:*   

> Sure.
> 
> ```
> ~ $ ls -al /dev/usbhdd
> 
> ...

 

lost_soul: First, I'm not sure about the order udev rules are evaluated in with respect to their filenames, but I'd rename yours to start with a low prefix like 10, e.g., 10-udev.rules (but this may be a trivial detail). In any event, your symlink does seems to get created, but it maps to sdb1, not sda1 (or has the order changed from your initial post?). What about if you substitute for your existing rule:

```
BUS=="usb", ATTRS{serial}=="BC30CD", NAME="%k", KERNEL=="sd*", SYMLINK+="usbhdd", GROUP="plugdev"
```

And make sure a /media folder exists. Turn the device off, and restart udev:

```
# udevstart
```

and make sure dbus and hald services are running. Check that the symlink is created successfully and maps to the correct device. Edit fstab per

```
/dev/usbhdd   /media/usbhdd  auto  rw,user,uid=1000,gid=100                 0 0
```

Does that change any behavior?

----------

## lost_soul

 *rsa4046 wrote:*   

> 
> 
>  (or has the order changed from your initial post?)
> 
> 

 

Yes, the order was changed.

 *rsa4046 wrote:*   

> 
> 
> . What about if you substitute for your existing rule:
> 
> ```
> ...

 

Same effect with your rule.. 

Sure, /media folder exists  :Smile: 

dbus and hald are running

I'm applying new rules for udev with: 

```
udevcontrol reload_rules
```

.

It's not a udev related thing, I think this is a KDE shit.. Because in older version of KDE it works like a charm.. in 3.5.2

----------

## lost_soul

Yeah, forgot to tell you:

If i specify a /dev/sda1 (real device address) in fstab instead of /dev/usbhdd it works as magic, so it's not a UDEV/HAL/DBUS related thing..

it's a bug in KDE:

http://www.mail-archive.com/debian-kde@lists.debian.org/msg26150.html

 *Quote:*   

> > And now:
> 
> >
> 
> > ls -l /dev/persousb /dev/fuji
> ...

 

----------

## lost_soul

Are you really got this working against symlink in fstab? I dont believe really.

btw, dude, can you post your emerge --info and kde-version? Maybe that bug exists only in kdebase package.. And fixed in a separate version of kioslaves..

----------

