[SOLVED] udev rule launch graphical app

How can I make a udev rule launch a graphical application, like, for instance, feh?
I've tried creating a rule detects when a specific mass storage device is connected and executes a script (/root/.scripts/feh-camera.sh). The script exports DISPLAY and XAUTHORITY and everything seems to work.
However when I restarted a black screen appeared right after Loading Modules (that appears after Starting udev events). Removing the udev rule solved the problem, so I must be doing something wrong.
What's the right way of doing this?
Thanks in advance.
Last edited by Vieira (2010-05-06 22:38:49)

Device was not connected at boot but I'll try what you suggested anyway. Thanks for your help.
EDIT:
It's solved. It turns out the underlying problem was that exporting DISPLAY breaks the udev environment. For future reference solved it with:
45-foobar.rules
ATTRS{product}=="DSLR-A330", ATTR{removable}=="1", ENV{REMOVE_CMD}="/bin/umount /media/camera", RUN+="/bin/mount <bla bla>", RUN+="/bin/su vieira -c '/etc/udev/rules.d/45-foobar.sh'"
and the script, where the problem was, must not export anything, just set inline, i.e.
#!/bin/sh
HOME=/home/vieira DISPLAY=:0 /usr/bin/feh -r /mnt/camera
Last edited by Vieira (2010-05-06 22:35:39)

Similar Messages

  • [SOLVED] udev rule no longer working

    I have a udev rule set up to automatically mount an ext4 filesystem when I plug a certain thumb drive in.  It was working fine until yesterday (probably due to updates).  Here is the rule, in file /etc/udev/rules.d/99-gfk.rules:
    KERNEL=="sd?2", SUBSYSTEM=="block", ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ATTRS{serial}=="1C6F654E4041ED601910053F", SYMLINK+="gfshare"
    ACTION=="add", KERNEL=="sd?2", SUBSYSTEM=="block", ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ATTRS{serial}=="1C6F654E4041ED601910053F", RUN+="/bin/mkdir /media/gfshare"
    ACTION=="add", KERNEL=="sd?2", SUBSYSTEM=="block", ATTRS{idVendor}=="0930", ATTRS{idProduct}=="6545", ATTRS{serial}=="1C6F654E4041ED601910053F", RUN+="/bin/mount -t ext4 -o ro,nosuid,nodev,noexec,noatime /dev/gfshare /media/gfshare"
    The symlink and the mkdir command are both working fine, but the mount command is not being run for some reason.  If I manually run the mount command it works fine.  Some possibly helpful output:
    # pacman -Qo $(which udevadm)
    /usr/bin/udevadm is owned by systemd 212-1
    # dmesg |tail -16
    [26458.120628] usb 7-1.3: new high-speed USB device number 7 using ehci-pci
    [26458.223059] usb-storage 7-1.3:1.0: USB Mass Storage device detected
    [26458.223825] scsi10 : usb-storage 7-1.3:1.0
    [26459.311607] scsi 10:0:0:0: Direct-Access Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 4
    [26460.834081] sd 10:0:0:0: [sdd] 15240576 512-byte logical blocks: (7.80 GB/7.26 GiB)
    [26460.834931] sd 10:0:0:0: [sdd] Write Protect is off
    [26460.834935] sd 10:0:0:0: [sdd] Mode Sense: 23 00 00 00
    [26460.835617] sd 10:0:0:0: [sdd] No Caching mode page found
    [26460.835621] sd 10:0:0:0: [sdd] Assuming drive cache: write through
    [26460.839455] sd 10:0:0:0: [sdd] No Caching mode page found
    [26460.839460] sd 10:0:0:0: [sdd] Assuming drive cache: write through
    [26460.860579] sdd: sdd1 sdd2
    [26460.867111] sd 10:0:0:0: [sdd] No Caching mode page found
    [26460.867115] sd 10:0:0:0: [sdd] Assuming drive cache: write through
    [26460.867118] sd 10:0:0:0: [sdd] Attached SCSI removable disk
    [26461.041982] EXT4-fs (sdd2): mounted filesystem with ordered data mode. Opts: (null)
    # udevadm test /sys/bus/usb/devices/7-1.3
    calling: test
    version 212
    This program is for debugging only, it does not run any program
    specified by a RUN key. It may show incorrect results, because
    some values may be different, or not available at a simulation run.
    load module index
    timestamp of '/etc/systemd/network' changed
    timestamp of '/usr/lib/systemd/network' changed
    Parsed configuration file /usr/lib/systemd/network/99-default.link
    Created link configuration context
    timestamp of '/etc/udev/rules.d' changed
    Skipping overridden file: /usr/lib/udev/rules.d/80-net-setup-link.rules.
    read rules file: /usr/lib/udev/rules.d/10-dm.rules
    read rules file: /usr/lib/udev/rules.d/11-dm-lvm.rules
    read rules file: /etc/udev/rules.d/12-android.rules
    read rules file: /usr/lib/udev/rules.d/13-dm-disk.rules
    read rules file: /usr/lib/udev/rules.d/40-hpet-permissions.rules
    read rules file: /usr/lib/udev/rules.d/40-usb-media-players.rules
    read rules file: /usr/lib/udev/rules.d/42-usb-hid-pm.rules
    read rules file: /usr/lib/udev/rules.d/50-firmware.rules
    read rules file: /usr/lib/udev/rules.d/50-udev-default.rules
    read rules file: /usr/lib/udev/rules.d/51-android.rules
    read rules file: /usr/lib/udev/rules.d/60-cdrom_id.rules
    read rules file: /usr/lib/udev/rules.d/60-drm.rules
    read rules file: /usr/lib/udev/rules.d/60-keyboard.rules
    read rules file: /usr/lib/udev/rules.d/60-pcmcia.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-alsa.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-input.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-serial.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-storage-tape.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-storage.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-v4l.rules
    read rules file: /usr/lib/udev/rules.d/60-vboxdrv.rules
    read rules file: /usr/lib/udev/rules.d/61-accelerometer.rules
    read rules file: /usr/lib/udev/rules.d/63-md-raid-arrays.rules
    read rules file: /usr/lib/udev/rules.d/64-btrfs.rules
    read rules file: /usr/lib/udev/rules.d/64-md-raid-assembly.rules
    read rules file: /usr/lib/udev/rules.d/69-cd-sensors.rules
    read rules file: /usr/lib/udev/rules.d/69-dm-lvm-metad.rules
    read rules file: /usr/lib/udev/rules.d/69-libmtp.rules
    read rules file: /usr/lib/udev/rules.d/70-infrared.rules
    read rules file: /usr/lib/udev/rules.d/70-power-switch.rules
    read rules file: /usr/lib/udev/rules.d/70-uaccess.rules
    read rules file: /usr/lib/udev/rules.d/71-seat.rules
    read rules file: /usr/lib/udev/rules.d/73-seat-late.rules
    read rules file: /usr/lib/udev/rules.d/75-net-description.rules
    read rules file: /usr/lib/udev/rules.d/75-probe_mtd.rules
    read rules file: /usr/lib/udev/rules.d/75-tty-description.rules
    read rules file: /usr/lib/udev/rules.d/78-sound-card.rules
    read rules file: /usr/lib/udev/rules.d/80-drivers.rules
    read rules file: /etc/udev/rules.d/80-net-setup-link.rules
    read rules file: /usr/lib/udev/rules.d/80-udisks.rules
    read rules file: /usr/lib/udev/rules.d/80-udisks2.rules
    read rules file: /usr/lib/udev/rules.d/85-usbmuxd.rules
    read rules file: /usr/lib/udev/rules.d/90-alsa-restore.rules
    read rules file: /usr/lib/udev/rules.d/95-cd-devices.rules
    read rules file: /usr/lib/udev/rules.d/95-dm-notify.rules
    read rules file: /usr/lib/udev/rules.d/95-udev-late.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-dell.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-fujitsu.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-gateway.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-ibm.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-lenovo.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-toshiba.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-csr.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-hid.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-wup.rules
    read rules file: /etc/udev/rules.d/99-gfk.rules
    read rules file: /usr/lib/udev/rules.d/99-systemd.rules
    read rules file: /usr/lib/udev/rules.d/kino.rules
    rules contain 98304 bytes tokens (8192 * 12 bytes), 22360 bytes strings
    10092 strings (88570 bytes), 8317 de-duplicated (67986 bytes), 1776 trie nodes used
    IMPORT builtin 'usb_id' /usr/lib/udev/rules.d/50-udev-default.rules:9
    IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/50-udev-default.rules:9
    MODE 0664 /usr/lib/udev/rules.d/50-udev-default.rules:37
    GROUP 1002 /usr/lib/udev/rules.d/51-android.rules:387
    MODE 0660 /usr/lib/udev/rules.d/51-android.rules:387
    RUN '/usr/share/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass} vboxusers' /usr/lib/udev/rules.d/60-vboxdrv.rules:6
    PROGRAM '/usr/lib/udev/mtp-probe /sys/devices/pci0000:00/0000:00:1a.7/usb7/7-1/7-1.3 7 7' /usr/lib/udev/rules.d/69-libmtp.rules:1204
    starting '/usr/lib/udev/mtp-probe /sys/devices/pci0000:00/0000:00:1a.7/usb7/7-1/7-1.3 7 7'
    '/usr/lib/udev/mtp-probe /sys/devices/pci0000:00/0000:00:1a.7/usb7/7-1/7-1.3 7 7'(out) '0'
    '/usr/lib/udev/mtp-probe /sys/devices/pci0000:00/0000:00:1a.7/usb7/7-1/7-1.3 7 7' [24644] exit with return code 0
    IMPORT builtin 'path_id' /usr/lib/udev/rules.d/71-seat.rules:43
    RUN 'uaccess' /usr/lib/udev/rules.d/73-seat-late.rules:15
    handling device node '/dev/bus/usb/007/007', devnum=c189:774, mode=0660, uid=0, gid=1002
    preserve permissions /dev/bus/usb/007/007, 020660, uid=0, gid=1002
    preserve already existing symlink '/dev/char/189:774' to '../bus/usb/007/007'
    ACTION=add
    BUSNUM=007
    DEVNAME=/dev/bus/usb/007/007
    DEVNUM=007
    DEVPATH=/devices/pci0000:00/0000:00:1a.7/usb7/7-1/7-1.3
    DEVTYPE=usb_device
    DRIVER=usb
    ID_BUS=usb
    ID_DRIVE_THUMB=1
    ID_FOR_SEAT=usb-pci-0000_00_1a_7-usb-0_1_3
    ID_MODEL=DataTraveler_2.0
    ID_MODEL_ENC=DataTraveler\x202.0
    ID_MODEL_FROM_DATABASE=Kingston DataTraveler 102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick
    ID_MODEL_ID=6545
    ID_PATH=pci-0000:00:1a.7-usb-0:1.3
    ID_PATH_TAG=pci-0000_00_1a_7-usb-0_1_3
    ID_REVISION=0100
    ID_SERIAL=Kingston_DataTraveler_2.0_1C6F654E4041ED601910053F
    ID_SERIAL_SHORT=1C6F654E4041ED601910053F
    ID_USB_INTERFACES=:080650:
    ID_VENDOR=Kingston
    ID_VENDOR_ENC=Kingston
    ID_VENDOR_FROM_DATABASE=Toshiba Corp.
    ID_VENDOR_ID=0930
    MAJOR=189
    MINOR=774
    PRODUCT=930/6545/100
    SUBSYSTEM=usb
    TAGS=:seat:uaccess:
    TYPE=0/0/0
    USEC_INITIALIZED=26452326568
    adb_user=yes
    run: '/usr/share/virtualbox/VBoxCreateUSBNode.sh 189 774 00 vboxusers'
    run: 'uaccess'
    unload module index
    Unloaded link configuration context
    # udevadm test /sys/bus/usb/devices/7-1.3:1.0
    calling: test
    version 212
    This program is for debugging only, it does not run any program
    specified by a RUN key. It may show incorrect results, because
    some values may be different, or not available at a simulation run.
    load module index
    timestamp of '/etc/systemd/network' changed
    timestamp of '/usr/lib/systemd/network' changed
    Parsed configuration file /usr/lib/systemd/network/99-default.link
    Created link configuration context
    timestamp of '/etc/udev/rules.d' changed
    Skipping overridden file: /usr/lib/udev/rules.d/80-net-setup-link.rules.
    read rules file: /usr/lib/udev/rules.d/10-dm.rules
    read rules file: /usr/lib/udev/rules.d/11-dm-lvm.rules
    read rules file: /etc/udev/rules.d/12-android.rules
    read rules file: /usr/lib/udev/rules.d/13-dm-disk.rules
    read rules file: /usr/lib/udev/rules.d/40-hpet-permissions.rules
    read rules file: /usr/lib/udev/rules.d/40-usb-media-players.rules
    read rules file: /usr/lib/udev/rules.d/42-usb-hid-pm.rules
    read rules file: /usr/lib/udev/rules.d/50-firmware.rules
    read rules file: /usr/lib/udev/rules.d/50-udev-default.rules
    read rules file: /usr/lib/udev/rules.d/51-android.rules
    read rules file: /usr/lib/udev/rules.d/60-cdrom_id.rules
    read rules file: /usr/lib/udev/rules.d/60-drm.rules
    read rules file: /usr/lib/udev/rules.d/60-keyboard.rules
    read rules file: /usr/lib/udev/rules.d/60-pcmcia.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-alsa.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-input.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-serial.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-storage-tape.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-storage.rules
    read rules file: /usr/lib/udev/rules.d/60-persistent-v4l.rules
    read rules file: /usr/lib/udev/rules.d/60-vboxdrv.rules
    read rules file: /usr/lib/udev/rules.d/61-accelerometer.rules
    read rules file: /usr/lib/udev/rules.d/63-md-raid-arrays.rules
    read rules file: /usr/lib/udev/rules.d/64-btrfs.rules
    read rules file: /usr/lib/udev/rules.d/64-md-raid-assembly.rules
    read rules file: /usr/lib/udev/rules.d/69-cd-sensors.rules
    read rules file: /usr/lib/udev/rules.d/69-dm-lvm-metad.rules
    read rules file: /usr/lib/udev/rules.d/69-libmtp.rules
    read rules file: /usr/lib/udev/rules.d/70-infrared.rules
    read rules file: /usr/lib/udev/rules.d/70-power-switch.rules
    read rules file: /usr/lib/udev/rules.d/70-uaccess.rules
    read rules file: /usr/lib/udev/rules.d/71-seat.rules
    read rules file: /usr/lib/udev/rules.d/73-seat-late.rules
    read rules file: /usr/lib/udev/rules.d/75-net-description.rules
    read rules file: /usr/lib/udev/rules.d/75-probe_mtd.rules
    read rules file: /usr/lib/udev/rules.d/75-tty-description.rules
    read rules file: /usr/lib/udev/rules.d/78-sound-card.rules
    read rules file: /usr/lib/udev/rules.d/80-drivers.rules
    read rules file: /etc/udev/rules.d/80-net-setup-link.rules
    read rules file: /usr/lib/udev/rules.d/80-udisks.rules
    read rules file: /usr/lib/udev/rules.d/80-udisks2.rules
    read rules file: /usr/lib/udev/rules.d/85-usbmuxd.rules
    read rules file: /usr/lib/udev/rules.d/90-alsa-restore.rules
    read rules file: /usr/lib/udev/rules.d/95-cd-devices.rules
    read rules file: /usr/lib/udev/rules.d/95-dm-notify.rules
    read rules file: /usr/lib/udev/rules.d/95-udev-late.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-dell.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-fujitsu.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-gateway.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-ibm.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-lenovo.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-battery-recall-toshiba.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-csr.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-hid.rules
    read rules file: /usr/lib/udev/rules.d/95-upower-wup.rules
    read rules file: /etc/udev/rules.d/99-gfk.rules
    read rules file: /usr/lib/udev/rules.d/99-systemd.rules
    read rules file: /usr/lib/udev/rules.d/kino.rules
    rules contain 98304 bytes tokens (8192 * 12 bytes), 22360 bytes strings
    10092 strings (88570 bytes), 8317 de-duplicated (67986 bytes), 1776 trie nodes used
    IMPORT builtin 'hwdb' /usr/lib/udev/rules.d/50-udev-default.rules:11
    RUN 'kmod load $env{MODALIAS}' /usr/lib/udev/rules.d/80-drivers.rules:5
    ACTION=add
    DEVPATH=/devices/pci0000:00/0000:00:1a.7/usb7/7-1/7-1.3/7-1.3:1.0
    DEVTYPE=usb_interface
    DRIVER=usb-storage
    ID_MODEL_FROM_DATABASE=Kingston DataTraveler 102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick
    ID_VENDOR_FROM_DATABASE=Toshiba Corp.
    INTERFACE=8/6/80
    MODALIAS=usb:v0930p6545d0100dc00dsc00dp00ic08isc06ip50in00
    PRODUCT=930/6545/100
    SUBSYSTEM=usb
    TYPE=0/0/0
    USEC_INITIALIZED=452326811
    run: 'kmod load usb:v0930p6545d0100dc00dsc00dp00ic08isc06ip50in00'
    unload module index
    Unloaded link configuration context
    Last edited by bentglasstube (2014-04-03 20:51:36)

    I see.  That is somewhat aggravating but I will find another way to achieve what I wanted I suppose.
    Thank you.  Should I mark this is solved or unsolvable or something?  Sorry, I'm new to posting on these forums.
    Edit:  I was able to achieve what I wanted with udevil as recommended by the wiki.
    Last edited by bentglasstube (2014-04-03 20:55:45)

  • [SOLVED] udev rules: cannot run command

    I want to run a scipt everytime I plug in my external harddrive. I read the documentation and create a file called /etc/udev/rules.d/extern_hd.rules:
    SUBSYSTEMS=="usb", SYSFS{serial}=="33504D315647585A", SYMLINK+="ExternHD", RUN+="/root/scripts/test.sh"
    The symlink "ExternHD" gets created. The permissions of test.sh are rwxr-xr-x root root, but it never gets executed. What am I doing wrong?
    Last edited by Kei (2007-09-18 11:30:35)

    Solution was easy... Udev doesn't want to start anything from within /root, so I put a hardlink to /usr/local/bin/ and now everything works fine.

  • [Solved] udev rules: serial for persistent device naming disappeared

    Hello,
    since the latest upgrade of udev and kmod I cant't mount my external e-SATA hard disk with my working udev rules.
    This is my udev rule:
    $ cat /etc/udev/rules.d/66-persistent_esata.rules
    KERNEL=="sd?1", SUBSYSTEMS=="block", ENV{ID_SERIAL_SHORT}=="S1VSJ1LS301247", NAME="aluguard"
    When plugged in, I could decrypt and mount it with "sudo cryptsetup luksOpen /dev/aluguard aluguard && mount /mnt/aluguard".
    Since the update above I get "Device /dev/aluguard doesn't exist or access denied."
    While I re-checked https://wiki.archlinux.org/index.php/Ma … _with_udev, I discovered, that the serial entry in the output of udevadm has vanished:
    $ udevadm info -a -p $(udevadm info -q path -n /dev/sdg)
    Udevadm info starts with the device specified by the devpath and then
    walks up the chain of parent devices. It prints for every device
    found, all possible attributes in the udev rules key format.
    A rule to match, can be composed by the attributes of the device
    and the attributes from one single parent device.
    looking at device '/devices/pci0000:00/0000:00:09.0/host3/target3:0:0/3:0:0:0/block/sdg':
    KERNEL=="sdg"
    SUBSYSTEM=="block"
    DRIVER==""
    ATTR{range}=="16"
    ATTR{ext_range}=="256"
    ATTR{removable}=="0"
    ATTR{ro}=="0"
    ATTR{size}=="1953525168"
    ATTR{alignment_offset}=="0"
    ATTR{discard_alignment}=="0"
    ATTR{capability}=="50"
    ATTR{stat}==" 96 24 762 780 0 0 0 0 0 780 780"
    ATTR{inflight}==" 0 0"
    ATTR{events}==""
    ATTR{events_async}==""
    ATTR{events_poll_msecs}=="-1"
    looking at parent device '/devices/pci0000:00/0000:00:09.0/host3/target3:0:0/3:0:0:0':
    KERNELS=="3:0:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS=="sd"
    ATTRS{device_blocked}=="0"
    ATTRS{type}=="0"
    ATTRS{scsi_level}=="6"
    ATTRS{vendor}=="ATA "
    ATTRS{model}=="SAMSUNG HD103SI "
    ATTRS{rev}=="1AG0"
    ATTRS{state}=="running"
    ATTRS{timeout}=="30"
    ATTRS{iocounterbits}=="32"
    ATTRS{iorequest_cnt}=="0xa2"
    ATTRS{iodone_cnt}=="0x98"
    ATTRS{ioerr_cnt}=="0xc"
    ATTRS{evt_media_change}=="0"
    ATTRS{queue_depth}=="31"
    ATTRS{queue_ramp_up_period}=="120000"
    ATTRS{queue_type}=="simple"
    looking at parent device '/devices/pci0000:00/0000:00:09.0/host3/target3:0:0':
    KERNELS=="target3:0:0"
    SUBSYSTEMS=="scsi"
    DRIVERS==""
    looking at parent device '/devices/pci0000:00/0000:00:09.0/host3':
    KERNELS=="host3"
    SUBSYSTEMS=="scsi"
    DRIVERS==""
    looking at parent device '/devices/pci0000:00/0000:00:09.0':
    KERNELS=="0000:00:09.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="ahci"
    ATTRS{vendor}=="0x10de"
    ATTRS{device}=="0x0554"
    ATTRS{subsystem_vendor}=="0x1849"
    ATTRS{subsystem_device}=="0x0554"
    ATTRS{class}=="0x010601"
    ATTRS{irq}=="23"
    ATTRS{local_cpus}=="00000000,00000003"
    ATTRS{local_cpulist}=="0-1"
    ATTRS{numa_node}=="0"
    ATTRS{dma_mask_bits}=="64"
    ATTRS{consistent_dma_mask_bits}=="64"
    ATTRS{enable}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{msi_bus}==""
    looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
    What is the reason for this strange behaviour, and how can I get back the serial entry?
    Thank in advance!
    Last edited by indianahorst (2012-01-31 13:03:20)

    $ udevadm info -q all -n /dev/sdg1
    P: /devices/pci0000:00/0000:00:09.0/host3/target3:0:0/3:0:0:0/block/sdg/sdg1
    N: sdg1
    S: disk/by-id/ata-SAMSUNG_HD103SI_S1VSJ1LS301247-part1
    S: disk/by-id/scsi-SATA_SAMSUNG_HD103SIS1VSJ1LS301247-part1
    S: disk/by-id/wwn-0x50024e900136a03e-part1
    S: disk/by-path/pci-0000:00:09.0-scsi-3:0:0:0-part1
    S: disk/by-uuid/bb024e1b-78a5-4ed0-9e80-aaa7633aa493
    E: DEVLINKS=/dev/disk/by-id/ata-SAMSUNG_HD103SI_S1VSJ1LS301247-part1 /dev/disk/by-id/scsi-SATA_SAMSUNG_HD103SIS1VSJ1LS301247-part1 /dev/disk/by-id/wwn-0x50024e900136a03e-part1 /dev/disk/by-path/pci-0000:00:09.0-scsi-3:0:0:0-part1 /dev/disk/by-uuid/bb024e1b-78a5-4ed0-9e80-aaa7633aa493
    E: DEVNAME=/dev/sdg1
    E: DEVPATH=/devices/pci0000:00/0000:00:09.0/host3/target3:0:0/3:0:0:0/block/sdg/sdg1
    E: DEVTYPE=partition
    E: ID_ATA=1
    E: ID_ATA_DOWNLOAD_MICROCODE=1
    E: ID_ATA_FEATURE_SET_AAM=1
    E: ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=254
    E: ID_ATA_FEATURE_SET_AAM_ENABLED=1
    E: ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=254
    E: ID_ATA_FEATURE_SET_APM=1
    E: ID_ATA_FEATURE_SET_APM_ENABLED=0
    E: ID_ATA_FEATURE_SET_HPA=1
    E: ID_ATA_FEATURE_SET_HPA_ENABLED=1
    E: ID_ATA_FEATURE_SET_PM=1
    E: ID_ATA_FEATURE_SET_PM_ENABLED=1
    E: ID_ATA_FEATURE_SET_PUIS=1
    E: ID_ATA_FEATURE_SET_PUIS_ENABLED=0
    E: ID_ATA_FEATURE_SET_SECURITY=1
    E: ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
    E: ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=194
    E: ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=194
    E: ID_ATA_FEATURE_SET_SMART=1
    E: ID_ATA_FEATURE_SET_SMART_ENABLED=1
    E: ID_ATA_SATA=1
    E: ID_ATA_SATA_SIGNAL_RATE_GEN1=1
    E: ID_ATA_SATA_SIGNAL_RATE_GEN2=1
    E: ID_ATA_WRITE_CACHE=1
    E: ID_ATA_WRITE_CACHE_ENABLED=1
    E: ID_BUS=ata
    E: ID_FS_TYPE=crypto_LUKS
    E: ID_FS_USAGE=crypto
    E: ID_FS_UUID=bb024e1b-78a5-4ed0-9e80-aaa7633aa493
    E: ID_FS_UUID_ENC=bb024e1b-78a5-4ed0-9e80-aaa7633aa493
    E: ID_FS_VERSION=1
    E: ID_MODEL=SAMSUNG_HD103SI
    E: ID_MODEL_ENC=SAMSUNG\x20HD103SI\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
    E: ID_PART_ENTRY_TYPE=0x83
    E: ID_PART_TABLE_TYPE=dos
    E: ID_PATH=pci-0000:00:09.0-scsi-3:0:0:0
    E: ID_PATH_TAG=pci-0000_00_09_0-scsi-3_0_0_0
    E: ID_REVISION=1AG01131
    E: ID_SCSI_COMPAT=SATA_SAMSUNG_HD103SIS1VSJ1LS301247
    E: ID_SERIAL=SAMSUNG_HD103SI_S1VSJ1LS301247
    E: ID_SERIAL_SHORT=S1VSJ1LS301247
    E: ID_TYPE=disk
    E: ID_WWN=0x50024e900136a03e
    E: ID_WWN_WITH_EXTENSION=0x50024e900136a03e
    E: MAJOR=8
    E: MINOR=97
    E: PART_ENTRY_DISK=8:96
    E: PART_ENTRY_NUMBER=1
    E: PART_ENTRY_OFFSET=63
    E: PART_ENTRY_SCHEME=dos
    E: PART_ENTRY_SIZE=1953520002
    E: SUBSYSTEM=block
    E: UDEV_LOG=3
    E: UDISKS_PARTITION=1
    E: UDISKS_PARTITION_ALIGNMENT_OFFSET=0
    E: UDISKS_PARTITION_NUMBER=1
    E: UDISKS_PARTITION_OFFSET=32256
    E: UDISKS_PARTITION_SCHEME=mbr
    E: UDISKS_PARTITION_SIZE=1000202241024
    E: UDISKS_PARTITION_SLAVE=/sys/devices/pci0000:00/0000:00:09.0/host3/target3:0:0/3:0:0:0/block/sdg
    E: UDISKS_PARTITION_TYPE=0x83
    E: UDISKS_PRESENTATION_NOPOLICY=0
    E: USEC_INITIALIZED=6897248001
    OK, there is the serial.... but the problem persists - udev doesn't execute the rule and doesn't create /dev/aluguard.

  • [solved] udev-rules for bluetooth PCMCIA

    My plan:
    get my bluetooth-PCMCIA card to work:
    CONCEPTONIC CBT100C
    Problem:
    I have to issue the following command for it to work:
    #hciattach ttyS0 bcsp
    Therefor I wrote following udev-rule that doesn't work:
    ##/etc/udev/rules.d/05-bluez-pcmcia-support.rules
    SUBSYSTEMS=="pcmcia", ATTRS{prod_id2}=="Bluetooth Card", RUN+="/usr/sbin/hciattach ttyS0 bcsp"
    My Question:
    Could someone explain to me why this rule does not work?
    Info:
    #pccardctl info
    PRODID_1="PCMCIA"
    PRODID_2="Bluetooth Card"
    PRODID_3=""
    PRODID_4=""
    MANFID=0279,950b
    FUNCID=2
    after #hciattach ttyS0 bcsp
    #udevinfo -a -p /sys/devices/pci0000\:00/0000\:00\:1e.0/0000\:06\:09.0/0.0/tty/ttyS0/
    KERNEL=="ttyS0"
    SUBSYSTEM=="tty"
    DRIVER==""
    ATTR{dev}=="4:64"
    looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:09.0/0.0/tty':
    KERNELS=="tty"
    SUBSYSTEMS==""
    DRIVERS==""
    looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:09.0/0.0':
    KERNELS=="0.0"
    SUBSYSTEMS=="pcmcia"
    DRIVERS=="serial_cs"
    ATTRS{modalias}=="pcmcia:m0279c950Bf02fn00pfn00pa281F1C5Dpb7664FB1Dpc00000000pd00000000"
    ATTRS{prod_id2}=="Bluetooth Card"
    ATTRS{prod_id1}=="PCMCIA"
    ATTRS{card_id}=="0x950b"
    ATTRS{manf_id}=="0x0279"
    ATTRS{func_id}=="0x02"
    ATTRS{pm_state}=="on"
    ATTRS{function}=="0x00"
    looking at parent device '/devices/pci0000:00/0000:00:1e.0/0000:06:09.0':
    KERNELS=="0000:06:09.0"
    SUBSYSTEMS=="pci"
    DRIVERS=="yenta_cardbus"
    ATTRS{msi_bus}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{enable}=="2"
    ATTRS{modalias}=="pci:v00001180d00000476sv0000144Dsd0000C01Ebc06sc07i00"
    ATTRS{local_cpus}=="f"
    ATTRS{irq}=="16"
    ATTRS{class}=="0x060700"
    ATTRS{subsystem_device}=="0xc01e"
    ATTRS{subsystem_vendor}=="0x144d"
    ATTRS{device}=="0x0476"
    ATTRS{vendor}=="0x1180"
    looking at parent device '/devices/pci0000:00/0000:00:1e.0':
    KERNELS=="0000:00:1e.0"
    SUBSYSTEMS=="pci"
    DRIVERS==""
    ATTRS{msi_bus}=="1"
    ATTRS{broken_parity_status}=="0"
    ATTRS{enable}=="1"
    ATTRS{modalias}=="pci:v00008086d00002448sv00000000sd00000000bc06sc04i01"
    ATTRS{local_cpus}=="f"
    ATTRS{irq}=="0"
    ATTRS{class}=="0x060401"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{device}=="0x2448"
    ATTRS{vendor}=="0x8086"
    looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""
    ATTRS{uevent}==""
    #dmesg
    pccard: PCMCIA card inserted into slot 0
    cs: memory probe 0xb4000000-0xb40fffff: excluding 0xb4000000-0xb400ffff
    pcmcia: registering new device pcmcia0.0
    ttyS0: detected caps 00000700 should be 00000100
    0.0: ttyS0 at I/O 0x400 (irq = 3) is a 16C950/954
    Last edited by mehldutt (2007-08-07 18:04:37)

    I called it
    05-bluez-pcmcia-support.rules
    I rebooted but still no success.
    I also tried this:
    ACTION=="add", SUBSYSTEMS=="pcmcia", ATTRS{prod_id2}=="Bluetooth Card", RUN+="aplay /usr/share/sounds/phone.wav"
    But still no success

  • [SOLVED] udev-rules

    My plan is to write a udev-rule that automatically starts a backup script as soon as I plugin a specific usb-harddrive.
    For testing purposes I'm trying to run /usr/bin/gedit and create the symlink /dev/backup-drive
    here's my rule:
    ## /etc/udev/rules.d/95-backup.rules
    SUBSYSTEM=="usb", ATTRS{serial}=="100", SYMLINK="backup_drive", RUN+="/usr/bin/gedit"
    The symlink works fine.  However, gedit does not start.
    What am I missing?
    Last edited by mehldutt (2007-04-26 18:12:44)

    here some more information:
    # udevinfo -a -p $(udevinfo -q path -n /dev/sdb)
    Udevinfo starts with the device specified by the devpath and then
    walks up the chain of parent devices. It prints for every device
    found, all possible attributes in the udev rules key format.
    A rule to match, can be composed by the attributes of the device
    and the attributes from one single parent device.
      looking at device '/block/sdb':
        KERNEL=="sdb"
        SUBSYSTEM=="block"
        DRIVER==""
        ATTR{stat}=="      69      193     1022      352       14        4      144       68        0      332      420"
        ATTR{size}=="156301488"
        ATTR{removable}=="0"
        ATTR{range}=="16"
        ATTR{dev}=="8:16"
      looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4/5-4:1.0/host2/target2:0:0/2:0:0:0':
        KERNELS=="2:0:0:0"
        SUBSYSTEMS=="scsi"
        DRIVERS=="sd"
        ATTRS{ioerr_cnt}=="0x0"
        ATTRS{iodone_cnt}=="0x5a"
        ATTRS{iorequest_cnt}=="0x5a"
        ATTRS{iocounterbits}=="32"
        ATTRS{timeout}=="30"
        ATTRS{state}=="running"
        ATTRS{rev}=="AD00"
        ATTRS{model}=="MK8032GAX       "
        ATTRS{vendor}=="TOSHIBA "
        ATTRS{scsi_level}=="3"
        ATTRS{type}=="0"
        ATTRS{queue_type}=="none"
        ATTRS{queue_depth}=="1"
        ATTRS{device_blocked}=="0"
        ATTRS{max_sectors}=="240"
      looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4/5-4:1.0/host2/target2:0:0':
        KERNELS=="target2:0:0"
        SUBSYSTEMS==""
        DRIVERS==""
      looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4/5-4:1.0/host2':
        KERNELS=="host2"
        SUBSYSTEMS==""
        DRIVERS==""
      looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4/5-4:1.0':
        KERNELS=="5-4:1.0"
        SUBSYSTEMS=="usb"
        DRIVERS=="usb-storage"
        ATTRS{interface}=="Mass Storage Class"
        ATTRS{modalias}=="usb:v04CFp8818dB008dc00dsc00dp00ic08isc05ip50"
        ATTRS{bInterfaceProtocol}=="50"
        ATTRS{bInterfaceSubClass}=="05"
        ATTRS{bInterfaceClass}=="08"
        ATTRS{bNumEndpoints}=="02"
        ATTRS{bAlternateSetting}==" 0"
        ATTRS{bInterfaceNumber}=="00"
      looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5/5-4':
        KERNELS=="5-4"
        SUBSYSTEMS=="usb"
        DRIVERS=="usb"
        ATTRS{serial}=="100"
        ATTRS{product}=="USB Mass Storage Device"
        ATTRS{manufacturer}=="Myson Century, Inc."
        ATTRS{maxchild}=="0"
        ATTRS{version}==" 2.00"
        ATTRS{devnum}=="2"
        ATTRS{speed}=="480"
        ATTRS{bMaxPacketSize0}=="64"
        ATTRS{bNumConfigurations}=="1"
        ATTRS{bDeviceProtocol}=="00"
        ATTRS{bDeviceSubClass}=="00"
        ATTRS{bDeviceClass}=="00"
        ATTRS{bcdDevice}=="b008"
        ATTRS{idProduct}=="8818"
        ATTRS{idVendor}=="04cf"
        ATTRS{bMaxPower}==" 10mA"
        ATTRS{bmAttributes}=="c0"
        ATTRS{bConfigurationValue}=="1"
        ATTRS{bNumInterfaces}==" 1"
        ATTRS{configuration}=="USB Mass Storage"
      looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb5':
        KERNELS=="usb5"
        SUBSYSTEMS=="usb"
        DRIVERS=="usb"
        ATTRS{serial}=="0000:00:1d.7"
        ATTRS{product}=="EHCI Host Controller"
        ATTRS{manufacturer}=="Linux 2.6.20-ARCH ehci_hcd"
        ATTRS{maxchild}=="8"
        ATTRS{version}==" 2.00"
        ATTRS{devnum}=="1"
        ATTRS{speed}=="480"
        ATTRS{bMaxPacketSize0}=="64"
        ATTRS{bNumConfigurations}=="1"
        ATTRS{bDeviceProtocol}=="01"
        ATTRS{bDeviceSubClass}=="00"
        ATTRS{bDeviceClass}=="09"
        ATTRS{bcdDevice}=="0206"
        ATTRS{idProduct}=="0000"
        ATTRS{idVendor}=="0000"
        ATTRS{bMaxPower}=="  0mA"
        ATTRS{bmAttributes}=="e0"
        ATTRS{bConfigurationValue}=="1"
        ATTRS{bNumInterfaces}==" 1"
        ATTRS{configuration}==""
      looking at parent device '/devices/pci0000:00/0000:00:1d.7':
        KERNELS=="0000:00:1d.7"
        SUBSYSTEMS=="pci"
        DRIVERS=="ehci_hcd"
        ATTRS{msi_bus}==""
        ATTRS{broken_parity_status}=="0"
        ATTRS{enable}=="1"
        ATTRS{modalias}=="pci:v00008086d0000265Csv0000144Dsd0000C01Ebc0Csc03i20"
        ATTRS{local_cpus}=="f"
        ATTRS{irq}=="19"
        ATTRS{class}=="0x0c0320"
        ATTRS{subsystem_device}=="0xc01e"
        ATTRS{subsystem_vendor}=="0x144d"
        ATTRS{device}=="0x265c"
        ATTRS{vendor}=="0x8086"
      looking at parent device '/devices/pci0000:00':
        KERNELS=="pci0000:00"
        SUBSYSTEMS==""
        DRIVERS==""

  • [SOLVED] udev rules for U2F FIDO Plug-up key

    I just received a cheap U2F FIDO key (http://www.amazon.com/Plug-up-Internati … 00OGPO3ZS/) but couldn't use it under Chrome 38. I had to add the following rule to /etc/udev/rules.d/45-u2f.rules
    SUBSYSTEM=="hidraw", MODE="0666", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="f1d0"
    and then issued a
    # sudo udevadm trigger
    Should work with other vendors assuming you change the idVendor and idProduct.
    Have fun!

    LukeHandle wrote:Was thinking about the same device, what are you thoughts on it so far? I was mostly concerned with the price and how that translated to the quality, or lack thereof.
    The device for which I sent a link for is cheap one and when you receive it actually looks cheap but does the job. Initially I thought I needed to install the FIDO U2F Chrome extension https://chrome.google.com/webstore/deta … ionmgcdmne but it works just fine without it assuming you are using Chrome or Chromium 38+ and the above udev rule on ArchLinux (not required on Windows and MAC OS).
    Use case is fairly limited so far since it can only be used on Google account. I tried to use this Plug-Up U2F dongle on Yubico U2F demo page http://demo.yubico.com/start/u2f/neo but it doesn't work and thus even with the FIDO U2F Chrome extension...Weird since I thought all U2F will all be compatible. Since the protocol is open I hope other use cases will arise such as more major supported websites, easy integration in existing frameworks such as Wordpress, Roundcube... but also alternative uses such as 2nd factor authentication for disk encryption (LUKS).

  • [SOLVED] Udev rule to hibernate my laptop at certain battery level

    Hi!
    I'm needing this kind of udev rule, to have my laptop automatically hibernate when battery level is about 3% (or 5, it doesn't matter).
    I don't want to have a little script running in the background that every eg 5 seconds polls my battery level, because i find it a really rough system.
    I guess i can use udev to reach what i want.
    udevadm info --path=/sys/class/power_supply/BAT0
    P: /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
    E: DEVPATH=/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
    E: POWER_SUPPLY_CHARGE_FULL=4800000
    E: POWER_SUPPLY_CHARGE_FULL_DESIGN=4800000
    E: POWER_SUPPLY_CHARGE_NOW=4800000
    E: POWER_SUPPLY_CURRENT_NOW=0
    E: POWER_SUPPLY_CYCLE_COUNT=0
    E: POWER_SUPPLY_MANUFACTURER=SANYO
    E: POWER_SUPPLY_MODEL_NAME=AS07B32
    E: POWER_SUPPLY_NAME=BAT0
    E: POWER_SUPPLY_PRESENT=1
    E: POWER_SUPPLY_SERIAL_NUMBER= 7210
    E: POWER_SUPPLY_STATUS=Full
    E: POWER_SUPPLY_TECHNOLOGY=Li-ion
    E: POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
    E: POWER_SUPPLY_VOLTAGE_NOW=16142000
    E: SUBSYSTEM=power_supply
    Any help?
    Thank you very much!
    Last edited by nierro (2012-09-21 20:36:45)

    It is indeed udev, displaying device info from its database in response to a query - that's what 'udevadm info' does. But you can't write a udev rule against that info - you need a uevent.
    man udev wrote:The udev daemon, systemd-udevd.service(8), receives device uevents directly from the kernel whenever a device is added or removed from the system, or it changes its state. When udev receives a device event, it matches its configured set of rules against various device attributes to identify the device. Rules that match may provide additional device information to be stored in the udev database or to be used to create meaningful symlink names.
    If you run cybertorture's 'udevadm monitor' command above, as your battery is running down, you will not see any uevents. If you connect or disconnect your AC adapter, you will see uevents - in fact, you're using those ones already, to trigger your powersave script. So although the general description I've quoted mentions kernel uevents generated when a device "changes its state", this does not cover all possible changes, and in this particular case, it does not cover changes in battery charge level.

  • [Solved] udev rule not working

    Hi!
    I'm trying to set my trackpoint sensitivity and speed using an udev rule:
    [jeroen@zechs ~]$ ls -l /etc/udev/rules.d/
    total 4
    -rw-r--r-- 1 root root 113 Sep 14 01:54 10-trackpoint.rules
    [jeroen@zechs ~]$ cat /etc/udev/rules.d/10-trackpoint.rules
    # Set trackpoint option
    KERNEL=="serio2", ATTR{speed}="180", ATTR{sensitivity}="255", RUN+="touch /tmp/udevtest"
    When I test the rule, everything seems to be working as planned:
    [jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/speed
    97
    [jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
    128
    [jeroen@zechs ~]$ sudo udevadm test /sys/devices/platform/i8042/serio1/serio2/
    calling: test
    version 216
    timestamp of '/etc/udev/rules.d' changed
    Reading rules file: /etc/udev/rules.d/10-trackpoint.rules
    ATTR '/sys/devices/platform/i8042/serio1/serio2/speed' writing '180' /etc/udev/rules.d/10-trackpoint.rules:2
    ATTR '/sys/devices/platform/i8042/serio1/serio2/sensitivity' writing '255' /etc/udev/rules.d/10-trackpoint.rules:2
    RUN 'touch /tmp/udevtest' /etc/udev/rules.d/10-trackpoint.rules:2
    ACTION=add
    DEVPATH=/devices/platform/i8042/serio1/serio2
    DRIVER=psmouse
    MODALIAS=serio:ty05pr00id00ex00
    SERIO_EXTRA=00
    SERIO_ID=00
    SERIO_PROTO=00
    SERIO_TYPE=05
    SUBSYSTEM=serio
    USEC_INITIALIZED=284056746
    run: 'touch /tmp/udevtest'
    run: 'kmod load serio:ty05pr00id00ex00'
    unload module index
    Unloaded link configuration context.
    [jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
    255
    [jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/speed
    180
    But when I boot the system, the rule has not been applied
    [BOOT]
    [jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/speed
    97
    [jeroen@zechs ~]$ cat /sys/devices/platform/i8042/serio1/serio2/sensitivity
    128
    [jeroen@zechs ~]$ sudo udevadm trigger
    [jeroen@zechs ~]$ ls -l /tmp/udevtest
    ls: cannot access /tmp/udevtest: No such file or directory
    So the rule runs fine when I do `udevadm test` but fails to run on boot or `udevadm trigger`
    Any hints or ideas, or probably some basic stuff I missed, to get this working?
    Thank you for reading this far!
    Last edited by jeroentbt (2014-10-07 11:42:58)

    There is not much to go with.
    I'll try adding the 'description' attribute maybe.
    $ udevadm info -a -p /sys/devices/platform/i8042/serio1/serio2
    Udevadm info starts with the device specified by the devpath and then
    walks up the chain of parent devices. It prints for every device
    found, all possible attributes in the udev rules key format.
    A rule to match, can be composed by the attributes of the device
    and the attributes from one single parent device.
    looking at device '/devices/platform/i8042/serio1/serio2':
    KERNEL=="serio2"
    SUBSYSTEM=="serio"
    DRIVER=="psmouse"
    ATTR{resolution}=="200"
    ATTR{rate}=="100"
    ATTR{bind_mode}=="auto"
    ATTR{resync_time}=="0"
    ATTR{jenks}=="135"
    ATTR{reach}=="10"
    ATTR{speed}=="180"
    ATTR{ztime}=="38"
    ATTR{draghys}=="255"
    ATTR{description}=="Synaptics pass-through"
    ATTR{mindrag}=="20"
    ATTR{ext_dev}=="1"
    ATTR{skipback}=="0"
    ATTR{upthresh}=="255"
    ATTR{resetafter}=="5"
    ATTR{thresh}=="8"
    ATTR{protocol}=="TPPS/2"
    ATTR{press_to_select}=="0"
    ATTR{sensitivity}=="255"
    ATTR{inertia}=="6"
    ATTR{firmware_id}==""
    looking at parent device '/devices/platform/i8042/serio1':
    KERNELS=="serio1"
    SUBSYSTEMS=="serio"
    DRIVERS=="psmouse"
    ATTRS{resolution}=="200"
    ATTRS{rate}=="80"
    ATTRS{bind_mode}=="auto"
    ATTRS{resync_time}=="0"
    ATTRS{description}=="i8042 AUX port"
    ATTRS{resetafter}=="5"
    ATTRS{protocol}=="SynPS/2"
    ATTRS{firmware_id}=="PNP: LEN0015 PNP0f13"
    looking at parent device '/devices/platform/i8042':
    KERNELS=="i8042"
    SUBSYSTEMS=="platform"
    DRIVERS=="i8042"
    looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""
    EDIT:
    tried with these two rules, no dice:
    KERNEL=="serio2", ATTR{description}=="Synaptics pass-through", ATTR{speed}="180", ATTR{sensitivity}="255", RUN+="touch /tmp/udevtest"
    ATTR{description}=="Synaptics pass-through", ATTR{speed}="180", ATTR{sensitivity}="255", RUN+="touch /tmp/udevtest"
    Last edited by jeroentbt (2014-09-14 21:23:33)

  • Solved: Udev rules not working

    I have file called "/etc/udev/rules.d/99-monitor-hotplug.rules" with this rule:
    ACTION=="change", SUBSYSTEM=="drm", RUN+="/root/scripts/hotPlugMonitor.sh"
    But hotPlugMonitor.sh-script is not ran even thought it has permission to be ran and
    udevadm monitor --property
    gives:
    KERNEL[69983.904205] change /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0 (drm)
    ACTION=change
    DEVNAME=/dev/dri/card0
    DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0
    DEVTYPE=drm_minor
    HOTPLUG=1
    MAJOR=226
    MINOR=0
    SEQNUM=1885
    SUBSYSTEM=drm
    UDEV [69983.905420] change /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0 (drm)
    ACTION=change
    DEVNAME=/dev/dri/card0
    DEVPATH=/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0
    DEVTYPE=drm_minor
    HOTPLUG=1
    ID_FOR_SEAT=drm-pci-0000_01_00_0
    ID_PATH=pci-0000:01:00.0
    ID_PATH_TAG=pci-0000_01_00_0
    MAJOR=226
    MINOR=0
    SEQNUM=1885
    SUBSYSTEM=drm
    TAGS=:seat:uaccess:
    USEC_INITIALIZED=6
    when I detach my monitor.
    Last edited by oilgame (2013-08-31 09:10:08)

    You got the command slightly wrong. See the right command:
    udevadm control --reload
    From:
    $ udevadm control --help | grep reload
    --reload reload rules and databases

  • [SOLVED]system fails to boot since adding udev rules for automounting

    Hello
    I have recently been trying to use udev rules to automount, and putting together stuff from the wiki, forums and general googling around have produced the following set of rules:
    # automounts usb hdd and pendrives as usbhd-sdx; no messing around with
    # volume labels or other confusing stuff
    # matches all sdx devices except the internal hdd, sda
    KERNEL=="sd[b-z]", NAME="%k", SYMLINK+="usbhd-%k", GROUP="users", OPTIONS="last_rule"
    # imports filesystem information
    ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p %N"
    # creates mount points and sets up symlinks
    ACTION=="add", KERNEL=="sd[b-z][0-9]", SYMLINK+="usbhd-%k", GROUP="users", NAME="%k"
    ACTION=="add", KERNEL=="sd[b-z][0-9]", RUN+="/bin/mkdir -p /media/usbhd-%k"
    ACTION=="add", KERNEL=="sd[b-z][0-9]", RUN+="/bin/ln -s /media/usbhd-%k /mnt/usbhd-%k"
    # global mount options
    ACTION=="add", ENV{mount_options}="relatime"
    # filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat)
    ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111,utf8"
    # automount ntfs filesystem with ntfs-3g driver
    ACTION=="add", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k /media/usbhd-%k", OPTIONS="last_r$
    # automount all other file systems
    ACTION=="add", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k /media/usbhd-%k", OPTIONS="last_rule"
    # unmounts and removes the mount points
    ACTION=="remove", KERNEL=="sd[b-z][0-9]", RUN+="/bin/rm -f /mnt/usbhd-%k"
    ACTION=="remove", KERNEL=="sd[b-z][0-9]", RUN+="/bin/umount -l /media/usbhd-%k"
    ACTION=="remove", KERNEL=="sd[b-z][0-9]", RUN+="/bin/rmdir /media/usbhd-%k", OPTIONS="last_rule"
    This seemed to be working very well unitl I tried to boot this morning and the boot process stopped at "processing UDev events" with the following message:
    iTCO_wdt: Unexpected close, not stopping watchdog!
    It pauses at this point for 10-15 seconds and then reboots.
    Having searched a bit, I found the following similar post on the forums:  http://bbs.archlinux.org/viewtopic.php?pid=459375
    Which suggests that the problem might lie with this line:
    ACTION=="add", IMPORT{program}="/sbin/blkid -o udev -p %N"
    I have renamed the file so that it no longer has the udev .rules extension and now the system boots fine.  Does anyone have any suggestions as to why the above rules might be causing this behaviour and how I might go about fixing it?
    Thanks
    Last edited by useradded (2010-07-02 22:58:14)

    Hey falconindy
    That was the final kick up the logical a$$ that I needed to get some kind of grip on udev rules.  I now have a fully functional rule that applies only to /dev/sdxy and not to everything else as well, so no more boot trauma, THANK YOU.
    I will mark this thread as solved and post my new rule for the benefit of anyone who might read this.
    New rule (no boot problems):
    # automounts usb hdd and pendrives as label or as usbhd-sdxy if no label present
    # ensures the following is _only_ run for sdxy devices excluding internal hdd, sda
    KERNEL!="sd[b-z][0-9]", GOTO="personal_usb_automount_settings_end"
    # imports filesystem information
    # provides access to following variables:
    # ID_FS_UUID; ID_FS_UUID_ENC; ID_FS_VERSION; ID_FS_TYPE; ID_FS_VERSION; ID_FS_LABEL
    # accessible via ENV{variable}; $env{variable}|%E{variable}
    IMPORT{program}="/sbin/blkid -o udev -p %N"
    # Get a label if present, otherwise name usbhd-%k
    ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
    ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
    # creates mount points and sets up symlinks
    ACTION=="add", SYMLINK+="%E{dir_name}", GROUP="users", NAME="%k"
    ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}"
    ACTION=="add", RUN+="/bin/ln -s /media/%E{dir_name} /mnt/%E{dir_name}"
    # global mount options
    ACTION=="add", ENV{mount_options}="relatime"
    # filesystem-specific mount options (777/666 dir/file perms for ntfs/vfat)
    ACTION=="add", ENV{ID_FS_TYPE}=="vfat|ntfs", ENV{mount_options}="$env{mount_options},gid=100,dmask=000,fmask=111,utf8"
    # automount ntfs filesystem with ntfs-3g driver
    ACTION=="add", ENV{ID_FS_TYPE}=="ntfs", RUN+="/bin/mount -t ntfs-3g -o %E{mount_options} /dev/%k /media/%E{dir_name}", OPTIONS="last_rule"
    # automount all other file systems
    ACTION=="add",ENV{ID_FS_TYPE}!="ntfs", RUN+="/bin/mount -t auto -o %E{mount_options} /dev/%k /media/%E{dir_name}", OPTIONS="last_rule"
    # unmounts and removes the mount points
    ACTION=="remove", RUN+="/bin/rm -f /mnt/%E{dir_name}"
    ACTION=="remove", RUN+="/bin/umount -l /media/%E{dir_name}"
    ACTION=="remove", RUN+="/bin/rmdir /media/%E{dir_name}", OPTIONS="last_rule"
    # exit
    LABEL=="personal_usb_automount_settings_end"
    Last edited by useradded (2010-07-02 22:59:20)

  • [Solved] Auto-open a file manager after mounting with udev rules

    Hellooooo,
    I followed the udev Wiki for auto mounting USBs and it now works great.
    The only problem is: how can I automatically open a file manager of the mounted directory? I tried putting this at the end of the "ACTION=="add"," section in "/etc/udev/rules.d/11-media-by-label-auto-mount.rules" but for some reason nothing happens:
    , RUN+="/usr/bin/dolphin /media/%E{dir_name}"
    Even if I just try to open dolphin with the "ACTION=="add"," section nothing happens either way.
    So what am I doing wrong?
    Last edited by algorythm (2011-05-05 12:35:56)

    In that case, the best choice in my opinion is to use Automounting UDisks Wrappers :
    devmon is a script developed by IgnorantGuru. He left Arch Linux, but the package in AUR is still there and is the last version. For a future new release, it should be available at his blog site. The script is distro independent.
    My udisksvm script, in its default state, doesn't launch a file manager after automounting, but it is not a big thing to let the automounting be done and then manually open a file manager (a new entry in the traydevice right-click menu can also be added for that).
    If you can do without automounting, there is also the bashmount script from jnguyen.
    All these scripts don't require writing any udev rules, they use udisks instead.
    I hope you could find something you like and which will suit your wishes.

  • Writing udev rules [SOLVED]

    Hi guys.
    I'm on a mission to run win7 on QEMU, and I also want to be able to use my USB-ports. Now, archwiki tells me to do this:
    $ qemu-system-i386 -usbdevice host:vendor_id:product_id disk_image
    You can find vendor_id and product_id of your device with lsusb command.
    Note: If you encounter permission errors when running QEMU, see Udev#Writing udev rules for information on how to set permissions of the device.
    I then made a file called 10-adm.rules both in, /etc/udev/rules.d and /usr/lib/udev/rules.d
    In it I wrote:
    KERNEL=="sdc[0-9]*",  GROUP="storage"
    My user with wich i lauch QEMU is in the group storage, and my usb always turns out as sdc*.
    But it still gives me the permission erros.
    Last edited by kimbo (2014-11-28 14:06:24)

    now I renamed the files to 99 instead of 10, and I even overkilled it with the GROUP:= instead of GROUP=
    tried:
    udevadm control --reload-rules
    udevadm trigger
    But it still doesnt work
    lsusb gives me:
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 002 Device 004: ID 18a5:0302 Verbatim, Ltd Flash Drive
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 002: ID 04f2:b23b Chicony Electronics Co., Ltd
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 004 Device 002: ID 04ca:3002 Lite-On Technology Corp.
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    And my qemu-launch-commad it:
    qemu-system-x86_64 -m 1G -enable-kvm -cpu host -usbdevice host:18a5:0302 win7
    oh, I dont really undestand what you by ' the group that /dev/sdc* ends up having'
    Last edited by kimbo (2014-11-13 23:04:47)

  • [solved] /etc/udev/rules.d/10-network.rules ignored

    Hi.
    I have 4 nics (eth0, eth1, eth2, eth3) mapped to MAC addresses in  /etc/udev/rules.d/10-network.rules.
    Some months ago, I had to symlink /etc/udev/rules.d/80-net-name-slot.rules to /dev/null in order to use these static names.
    Now it doesn't work anymore (again and again and again) after a full update (kernel and I assume systemd).  The "nic-names" are completely wrong.  You call this "predictable". I call this "unpredictable". The only thing which is predictable is that after a kernel update, the network will stop working. It has been that way for months and months ... fortunately I don't update other machines anymore.
    Was this non sense really necessary?
    Anyway, if you could tell me what to do now to get my network rules applied again, I would really appreciate.
    Right now all ethX/MAC are wrong and none of them gets an IP (had to set an IP manually to post here).
    * I know what "predictable Network Interface Names" is about. I don't want this bullshit. It's much worse as it used to be. Keep it simple, folks!
    Last edited by Agnelo de la Crotche (2013-03-27 07:14:05)

    tomegun wrote:To narrow down the problem you are experiencing: What do you mean when you say that the names are "wrong"? Are they still eth0, eth1,... just in the wrong order, or are you actually seeing the "weird" new names given by udev?
    To answer this question more precisely.
    * with  /etc/udev/rules.d/80-net-name-slot.rules => /dev/nul and /etc/udev/rules.d/10-network.rules posted earlier  (in #4)
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: eth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:0a:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    3: eth1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:06:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    4: eth2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:24:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    5: eth3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:1b:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT
    link/ether 66:64:b3:6a:26:61 brd ff:ff:ff:ff:ff:ff
    The rules are ignored.
    * after deleting   /etc/udev/rules.d/80-net-name-slot.rules
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: enp6s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:0a:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    3: enp6s1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:06:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    4: enp2s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:24:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    5: enp4s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:1b:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT
    link/ether a2:ee:ec:d1:65:2d brd ff:ff:ff:ff:ff:ff
    The rules don't apply.
    * with  /etc/udev/rules.d/80-net-name-slot.rules => /dev/nul and after replacing eth0, eth1, eth2, eth3 with arbitrary names net0, net1, net2, net3 in  /etc/udev/rules.d/10-network.rules
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: net1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:24:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    3: net3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:0a:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    4: net2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:06:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    5: net0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000
    link/ether 00:1b:XX:XX:XX:XX brd ff:ff:ff:ff:ff:ff
    6: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT
    link/ether ea:63:09:b7:1b:1b brd ff:ff:ff:ff:ff:ff
    But the rules were applied in this case!
    It solved the problem described originally.  I think I was hit by the race condition after upgrating to kernel 3.8.4-1. This was actually my first 3.8 kernel.
    With kernel 3.7, the rules were working even if the devices were named eth0, eth1, etc.
    Those names don't work anymore, at least in my case.
    Further I  created this file for static ips:
    # cat /etc/systemd/system/network.service
    [Unit]
    Description=Wired Static IP Connectivity
    Wants=network.target
    Before=network.target
    BindsTo=sys-subsystem-net-devices-net0.device
    After=sys-subsystem-net-devices-net0.device
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/sbin/ip link set dev net0 up
    ExecStart=/sbin/ip addr add 192.168.101.9/24 dev net0
    ExecStart=/sbin/ip link set dev net1 up
    ExecStart=/sbin/ip addr add 192.168.102.9/24 dev net1
    ExecStart=/sbin/ip link set dev net2 up
    ExecStart=/sbin/ip addr add 192.168.104.9/24 dev net2
    ExecStart=/sbin/ip link set dev net3 up
    ExecStart=/sbin/ip addr add 192.168.105.9/24 dev net3
    ExecStart=/sbin/ip route add default via 192.168.101.1
    ExecStop=/sbin/ip addr flush dev net0
    ExecStop=/sbin/ip link set dev net0 down
    ExecStop=/sbin/ip addr flush dev net1
    ExecStop=/sbin/ip link set dev net1 down
    ExecStop=/sbin/ip addr flush dev net2
    ExecStop=/sbin/ip link set dev net2 down
    ExecStop=/sbin/ip addr flush dev net3
    ExecStop=/sbin/ip link set dev net3 down
    [Install]
    WantedBy=multi-user.target
    I disabled netcfg and enabled network.service.
    Problem is solved now.

  • [solved] dwm rule to launch IPython with a specific tag

    I'm customizing rules for dwm in config.h, but I'm having trouble getting a rule to work with IPython3 qt console. I launched the app with "ipython3 qtconsole" (from dmenu), ran the shell script from dwm's site (http://dwm.suckless.org/customisation/rules) to get the properties:
    xprop |awk '
    /^WM_CLASS/{sub(/.* =/, "instance:"); sub(/,/, "\nclass:"); print}
    /^WM_NAME/{sub(/.* =/, "title:"); print}'
    which gives me these properties:
    title: "IPython"
    instance: ""
    class: ""
    I set my rule in config.h like this:
    static const Rule rules[] = {
    { "IPython", NULL, NULL, 1 << 3, False, -1 },
    rebuilt dwm, and restarted my X-server. But, when I launch "ipython3 qtconsole", the console shows up on the currently viewed tag, not tag 4. Is this the correct rule? I've tried variations like IPython3, Ipython, ipython3, etc. to no avail.
    Last edited by pythonscript (2013-10-12 12:42:35)

    Have you tried it using the title field?
    { NULL, NULL, "IPython", 1 << 3, False, -1 },

Maybe you are looking for

  • CUCM 8.6, UnityCon 8.6 and Presence 8.6 on ESXi 5 C200 web interface lag

    When trying to bring up any web interfaces or even vSphere it is so slow as to also not be usable.. Brand new install on 2 C200 UCS servers. Before you ask. Yes LRO is disabled according to Cisco's instructions and confirmed. I have CUCM and Presence

  • F110 : Proposal not generated

    Hi, i've carried out a Vendor payment with Tcode F110 and after executing the proposal i have this status : Status Parameters have been entered Proposal has been released 04.03.09 11:39:51 Please what does mean ? i actualize the status but it gives t

  • Convert PDF to Microsoft Powerpoint

    I cant find where to comvert PDF to Powerpoint, I have word and excel

  • Error in displaying pivot table

    Hi everyone, I have't seen any thread that gives me an answer to my problem. I have OBI SE 10.1.3.4 on Windows Server 2003. In physical layer i've table REQUEST: Pack varchar, Seg varchar, State varchar, SUM_ACT double, SUM_PRE double. I mapped REQUE

  • How to migrate instances with exact ownership to destination BO system

    Hi BO expert, We met some technical issue when import instances to destination BO prod system, the situation is as below: In source BO system, there is one report, and 2 users A and B scheduled instances based on this report. In destination BO system