Skip to contentSkip to conversation

rules and RUN key

DISCUSSION Mangus 3 participants 4 messages Nov 22, 2005 – Nov 23, 2005

lore
Share & tools
lore

Mangus

author
#0 lore raw

Hi all, I'm trying to study the RUN key of udev rules, but I really don't understand why this rule doesn't work..

BUS=="usb", SYSFS{product}="Sony DSC", KERNEL="sda1", ACTION=="add", SYMLINK+="digitalcamera", RUN="/opt/kde/bin/digikam"

the symlink 'digitalcamera is correctly done in /dev and I can easily mount it but the RUN key seems not executed.
Does the RUN command has to be executed when a rule is matched? what I'm missing or doing wrong??

root@saturno:~# udevtest /sys/block/sda/sda1 usb
main: looking at device '/block/sda/sda1' from subsystem 'usb'
add_to_rules: error parsing SYSFS attribute in 'BUS'
main: opened class_dev->name='sda1'
udev_rules_get_name: add symlink 'digitalcamera'
udev_rules_get_name: reset run list
udev_rules_get_name: rule applied, 'sda1' becomes 'sda1'
create_node: creating device node '/dev/sda1', major = '8', minor = '1', mode 
= '0660', uid = '0', gid = '6'
create_node: creating symlink '/dev/digitalcamera' to 'sda1'
root@saturno:~# udevmonitor
udevmonitor prints the received event from the kernel [UEVENT]
and the event which udev sends out after rule processing [UDEV]

UEVENT[1132699412.958174] add@/devices/pci0000:00/0000:00:03.3/usb1/1-1 UEVENT[1132699413.031376] add@/devices/pci0000:00/0000:00:03.3/usb1/1-1/1-1:1.0 UEVENT[1132699413.038090] add@/class/scsi_host/host3 UEVENT[1132699413.189695] add@/class/usb_device/usbdev1.5 UEVENT[1132699418.191140] add@/devices/pci0000:00/0000:00:03.3/usb1/1-1/1-1:1.0/host3/target3:0:0/3:0:0:0 UEVENT[1132699418.250136] add@/block/sda
UEVENT[1132699418.308443] add@/block/sda/sda1 UEVENT[1132699418.354008] add@/class/scsi_device/3:0:0:0

thanks for hints and explanations

Signature · 3 lines
Fede
Be cool - get Slack.
--
#1 lore raw
Quoted 5 lines · Mangus

Hi all, I'm trying to study the RUN key of udev rules, but I really don't understand why this rule doesn't work..

BUS="usb", SYSFS{product}="Sony DSC", KERNEL="sda1", ACTION="add", SYMLINK+="digitalcamera", RUN="/opt/kde/bin/digikam"

You don't want to run root level programs from udev to show up in your desktop session. This also can't work, cause digikam has no X display.

Usually a process in your user session subscribes to device events from HAL and starts applications as the logged-in user.

Kay

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#2 lore raw
In reply to Mangus
Quoted 9 lines · Kay Sievers
Quoted 5 lines · Mangus

Hi all, I'm trying to study the RUN key of udev rules, but I really don't understand why this rule doesn't work..

BUS="usb", SYSFS{product}="Sony DSC", KERNEL="sda1", ACTION="add", SYMLINK+="digitalcamera", RUN="/opt/kde/bin/digikam"

Quoted 8 lines

You don't want to run root level programs from udev to show up in your desktop session. This also can't work, cause digikam has no X display.

Usually a process in your user session subscribes to device events from HAL and starts applications as the logged-in user.

Kay

Also RUN+= would be better.

-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_idv28&alloc_id845&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

author
#3 lore raw
In reply to Mangus

Alle 00:18, mercoledì 23 novembre 2005, Kay Sievers ha scritto:

Quoted 10 lines · Mangus
Quoted 5 lines

Hi all, I'm trying to study the RUN key of udev rules, but I really don't understand why this rule doesn't work..

BUS=="usb", SYSFS{product}="Sony DSC", KERNEL="sda1", ACTION=="add", SYMLINK+="digitalcamera", RUN="/opt/kde/bin/digikam"

You don't want to run root level programs from udev to show up in your desktop session. This also can't work, cause digikam has no X display.

yeah, that's right, my fault , thanks

Quoted 4 lines

Usually a process in your user session subscribes to device events from HAL and starts applications as the logged-in user.

Kay

ok, but the RUN key is intended to run external script as root, isn't it? like modprobe commands or whethever
so why this rule don't execute the command?
BUS=="usb", SYSFS{product}=="Sony DSC", KERNEL=="sda1", ACTION=="add", SYMLINK+="digitalcamera", RUN+="/sbin/modprobe fuse"

fuse module for example is not loaded
is my version of udev too old?
it's udev64

thanks

Signature · 3 lines
Fede
Be cool - get Slack.
--