Programming :: Udev Rules - Pass ATTRS{*} Values To The RUN Command?

Sep 24, 2010

I'm modifying a working udev rule which runs a script that mounts a USB HDD and synchronises files to it.The USB HDDs have been troublesome, losing many files and even losing file systems a couple of timesTo investigate,I want to log the USB HDD product name and serial number so would like to pass ATTRS{product} and ATTRS{serial} values to the script.This may not be possible; I cannot see anything about how to do it in either the udev man page nor Daniel Drake's "Writing udev rules" Version 0.74 but it seems such an obvious thing to want to do, I'm wondering if I've overlooked something.

View 8 Replies


ADVERTISEMENT

Programming :: Grep Multiple Values In Single Pass Through Log File?

Nov 13, 2010

I have a huge binary log file. There are lets say 4 id's that I want to find in a log file. I know that those 4 id's will be present in the log file and I also know in what order they will be present. I want to find 1st id from the log then 2nd id and then third id and so on..

Simple/inefficient solution is: Loop through the id's and then grep in the log file. Problem with this solution is for each id grep will search from the beginning of the file.

Better/efficient solution would be: Sine I know the order in which id's will be present in the log file. Loop through id's, grep 1st id and then move on to grep 2nd id and so on...this way I can grep all id's in one pass. Is this solution possible ?

I have 500000 + values to find in log files and I have to find efficient solution for it.

View 2 Replies View Related

Ubuntu :: Can't Create File /etc/udev/rules.d/70-android.rules?

Jun 19, 2011

I need to create filename 70-android.rules in the directory /etc/udev/rules.d/I have Adm privileges in my user account properties, but when I use sudo to create this file the Ubuntu OS does not allow me the privilege... I am running Ubuntu 10.04 LTS and here's the Terminal output below:daddy@gatomon-laptop:/etc/udev/rules.d$ sudo cat > 70-android.rulesbash: 70-android.rules: Permission denieddaddy@gatomon-laptop:/etc/udev$ ls -ltotal 8drwxr-xr-x 2 root root 4096 2011-03-16 18:03 rules.d-rw-r--r-- 1 root root 218 2010-04-19 04:30 udev.conf

View 2 Replies View Related

General :: Pass Two / Three Values To Grep?

Sep 22, 2010

Is there any way i can pass two / three values to grep. Basically i want to list the lines in the file with three different values. Currently I'm using three grep to get my work done.

EG: more Filename | grep text1 | grep text2 | grep text3
BRs

View 2 Replies View Related

Programming :: Using Expr Command To Read Values From Two Different Files?

Mar 20, 2011

I have an assignment where I have to use an expr command to read values from File1.txt and File2.txtHeres the assignment:Create two files.File1 has one line with the value of 5.ile2 has one line with the value of 100.Edit your new file using Gedit or VI and change it so it performs the following actions:Read the values from the files above (file1 and file2)Divide the value from file2 by the value in file1.utput the result of this calculation to a new file called file3. My .scr file is week3prog3_george, in file1 I put var1=5, file2 is var1=20.Then, I put in my .scr file this:

#!/bin/bash
expr File2.txt / File1.txt

It returns an error message stating "non-integer argument."And...how do you point the .scr file to read values from two different files, and the book my school has provided does not contain the info I need.

View 1 Replies View Related

Ubuntu :: Add A File To /lib/udev/rules?

Sep 28, 2010

I tried searching for an explanation on howto add a file but couldn't find anything.

View 5 Replies View Related

Hardware :: Listing Udev Rules Currently Used?

Apr 24, 2010

I am trying to list udev rules for devices ( similar to lshal ). lsdev is not listing what i want. trying to write udev rule for ALSP touchpad. Upon reading the guide at this site, I am not seeing the ../10_local.rules which is indicated as the correct pat to save user defined udev rules.

Code:

ls /etc/udev/rules.d

Would I be correct in assuming that I save my rule as

Code:

/etc/udev/rules.d/mouse.rule

Device ID:I am confused also as to which device is actually being used! running

Code:

cat /proc/bus/input/devices

i get a return with these entries:

Code:

I: Bus=0017 Vendor=0001 Product=0001 Version=0100
N: Name="Macintosh mouse button emulation"
P: Phys=

[code]....

I have followed howtos as listed here, here, and here. Am I not pointing my mouse.rules to the correct location? Maybe my issue is that I followed howtos from varied sources.the mouse.rules i put in /etc/udev/rules.d/mouse.rules had no effect.

View 7 Replies View Related

Red Hat :: Creating Raw Device Via Udev Rules

Apr 12, 2010

I have a Linux server that runs the Sybase DB. Sybase suggests using character devices to access raw devices rather than O_DIRECT to block devices, or cooked FS's. So, I went ahead and configured /etc/sysconfig/rawdevices as such:

/dev/raw/raw1 /dev/vg01/tempdb
/dev/raw/raw2 /dev/vg01/testdb
/dev/raw/raw3 /dev/vg01/fakedb ...

This works fine. I set 'chkconfig rawdevices on' and all is well. I read that this method is deprecated and went about trying to accomplish the same via Udev rules. I already use udev rules in /etc/udev/rules.d/60-raw.rules to set permissions on these devices, i.e.
ACTION=="add", KERNEL=="raw*", OWNER=="sybase", GROUP=="sybase", MODE=="0660"

That works fine. I even set symbolic links:
KERNEL=="raw1", SYMLINK+="vg01/rtempdb"
KERNEL=="raw2", SYMLINK+="vg01/rtestdb1"
KERNEL=="raw3", SYMLINK+="vg01/rfakedb2"

But I cannot seem to get the actual device creation piece to work within udev (it only works using rawdevices). I've tried:
ACTION=="add", KERNEL=="vg01/tempdb", RUN+="/bin/raw /dev/raw/raw1 %N"

No errors, but nothing happens. The device just doesn't create. I've also tried doing it by passing major and minor numbers. Is it possible to get all of this into udev rules or am I stuck with rawdevices? I'm also utterly confused as to the future of rawdevices... the raw man page said it was deprecated, and now at v5.5 it has that piece taken out. Also RHEL 5.3 dropped support for rawdevices in initscripts only to add itback in 5.4. I'm an admin, not a DBA, so I cannot say if this is a bad or good way, only that it is the way the vendor supports and recommends, so it is the way that I must go... just trying to make it work as "un-deprecated" and cleanly as possible.

View 1 Replies View Related

Programming :: Pass A Shell Variable To An AWK Command?

Dec 23, 2010

I have the following code :

Code:
E_BADARGS=65
if [ $# -ne 2 ] ; then

[code]...

View 1 Replies View Related

Debian Hardware :: Udev Rules For Partitoned Usb?

Apr 23, 2011

I am using Debian Squeeze on my laptop an now I want to write udev rules. I bought an USB enclosure for my old Desktop HDD drive (Debian lenny ). But when I plug it in only the first primary partition gets mounted so I can not copy the data from my old desktop to the laptop. the output of mount shows that the following disk was mounted/dev/sdb1 on /media/disk type ext3 (rw,nosuid,nodev,uhelper=hal)

I can cd into /media/disk/etc and cat fstab shows the following:
# /etc/fstab: static file system information.
#

[code]...

View 1 Replies View Related

Fedora :: Udev Rules For Using USB Device Not As Root

Oct 15, 2010

Having finally made the switch from Windows (7 Professional) to Linux (Fedora 13) on my laptop, I'm now trying to get all my devices working, specifically an Olympus VN-4100PC Digital Voice Recorder. I've installed odvr and it works in root, but not as a normal user. The installation instructions say: odvr *requires* access to the user-space USB interface.

It is recommended to place "41-odvr.rules" into "/etc/udev/rules.d" or setup your own udev rules rather than running odvr as root. After changing udev rules, don't forget to run "udevcontrol reload_rules" and to replugin your DVR. Again, root privileges are required unless udev is properly setup. The file "41-odvr.rules" (designed for Ubuntu) has the following content:
SUBSYSTEM=="usb", SYSFS{idVendor}=="07b4", SYSFS{idProduct}=="020d", ACTION=="add", GROUP="audio", MODE="0664"

I tried just doing what it said and copying it to "/etc/udev/rules.d" but it didn't seem to work. Looking at other files, I then changed it to:
SUBSYSTEM=="usb", ATTR{idVendor}=="07b4", ATTR{idProduct}=="020d", ACTION=="add", GROUP="audio", MODE="0664"

And now if I do "ls -l /dev/bus/usb/002", I get:
crw-rw-r--. 1 root audio 189, 134 Oct 15 01:21 007

Which seems to suggest that it is running the "41-odvr.rules" file, since lsusb gives:
Bus 002 Device 007: ID 07b4:020d Olympus Optical Co., Ltd Digital Voice Recorder VN-240PC

But odvr still doesn't work as a normal user, giving:
Failed to open Olympus device: couldn't claim interface

View 2 Replies View Related

Ubuntu :: Udev Rules For Multiple USB GSM Modem?

Oct 20, 2010

I have a question related on udev rules. I have a SMS Gateway project using multiple usb gsm modem. I use huawei modem for this project. My goal are every time I plug in huawei devices on my ubuntu box it automatically mounts on specific ttyUSB port

e.g.
huawei 1 -> ttyUSB1
huawei 2 -> ttyUSB2

My problem are to meet this goal i must find unique data between different huawei devices (e.g. productID, vendorID, serial). In huawei product this information are the same with all devices.There is only one unique on every huawei devices. That is IMEI value. How can use this value or find this value for udev rules.

View 1 Replies View Related

Software :: New UDev Rules Set Breaking Functions

Jul 9, 2010

On my Sid box, I did an update and it appears it also updates udev's rule set that doesn't like the notion of dm-crypt or LVM. For example:

Code:
trilarian@Debian-Desktop:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/dm-1 9.9G 2.4G 7.1G 26% /
tmpfs 438M 0 438M 0% /lib/init/rw
udev 10M 192K 9.9M 2% /dev
tmpfs 438M 0 438M 0% /dev/shm
/dev/md0 94M 83M 12M 88% /boot
/dev/dm-2 1008M 630M 328M 66% /var
/dev/dm-3 600G 291G 310G 49% /home
When I used to run df I would get lvm/dm name instead of number, like:
Code:
/dev/mapper/raid-root 9.9G 2.4G 7.1G 26% /
What I need to change in udev to restore the old function?

View 1 Replies View Related

Networking :: Ubuntu 10.04 Ignores Eth Udev Rules

Jan 6, 2011

For some reason, Ubuntu keeps assigning my network interface wrong MAC address. This happens only after fresh boot (I have dual boot with WinXP, if I start Windows first and then restart to Ubuntu without switching computer off, the MAC is correct). Contents of /etc/udev/rules.d/70-persistent-net.rules:

Code:

# PCI device 0x10ec:0x8136 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:22:19:ef:1c:3d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x168c:0x001c (ath5k_pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:17:c4:78:f4:f8", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

[code]....

EDIT: I made a workaround by adding

Code:

auto eth0
iface eth0 inet dhcp
hwaddress ether 00:f3:f5:ef:fe:56

to /etc/network/interfaces and it works. However, I'd still like to know why Ubuntu ignores my udev rules, regardless whether the workaround happens to work or not...

View 1 Replies View Related

General :: Udev Rules Aimed For USB Drives Only?

Mar 14, 2011

I have written a udev rule as follows:Code:RUN+=/.../.../example.shWhenever i plug in a USB drive, this rule is executed, however it is also done when i plug in a dongle for WiFi. How do i make this udev rule specific for USB drives only. In other words this script should be run for USB devices only.

View 3 Replies View Related

Red Hat :: 50-udev.rules Causes Start_udev To Hang On Boot?

Aug 14, 2010

I've been having problems with start_udev on my machine post kernel 2.6.18-162 on my CentOS machine. A previous install would work on the old kernelut not the newer ones. I recently did a completely fresh install of CentOS 5.5o see if maybe there was a orruption in my install when it upgraded,t I still have the problem of udev hanging on startup.Using the rescue option on the disk, I've managed to track the problem down to the 50-udev.rules file. Through trial and error, I moved all the .rules files out of the rules.d directory, and added them back one at a time to see which one(s) caused the system to hang, and which ones it carried on booting as normal with. The only one that causes it to hang is the 50-udev.rules.

From what I can tell, this rules file is responsible for letting udev check various pieces of hardware. I think that it is failing whent runs modprobe on a pci device address.Only problem is I don't understand the rules file syntax, so I don't know if I can simply comment out or change a line in this file to skip the device that its looking for.Can anybody help me track down the specific device/line that is doing this?(I've kept the file out of the folder for now and my system appears to continue operating, but I get the occasional problem that for all I know could be due to udev not having a complete start up).

View 6 Replies View Related

Programming :: Pass An Expect Command Result Into A Variable And Then Use It Again?

May 4, 2010

I'm trying to create a program that would locate the oldest file of a certain type on a server. Here's the commands:

OLDEST_PATH=`find -L / -depth -maxdepth 6 -mindepth 6 -type d | sort -f | head -1`
OLDEST_FILE=`find -L $OLDEST_PATH | grep .mp3 | sort -f | head -1`
ls -al $OLDEST_FILE

I'm writing this all in expect but I'm having problems. The main problem I have is whenever I try to run the first command, I can't seem to isolate the result of the OLDEST_PATH so that the 2nd command will work. There always seems to be a newline in the variable and the result is only "find -L" command running and it bypasses the variable. If I can just figure out how to get the 1st and 2nd command to work, then I can figure out the 3rd. Here's some code:

Code:
send "find -L / -depth -maxdepth 6 -mindepth 6 -type d | sort -f | head -1
"
sleep 20
expect -re "(.*)

[Code]....

I know there is a better way to write this. I've tried multiple ways and this just happens to be the last way I've tried it. If you try running this, you'll notice that there is still carriage returns after the result of OLDEST_PATH and it prevents the 2nd "find" command from working properly.

View 2 Replies View Related

Programming :: Pass Carriage Return To Command Through Script

Feb 18, 2011

How can I pass carriage return to a command in the shell script. I am writing a shell script whcih generates ssh key pair. It ask for input from user three times. I want to pass carriage return (i.e., press Enter button) to this command.

View 2 Replies View Related

Debian Configuration :: Udev / Systemd Change Some Rules In 8.0

Apr 18, 2016

I have SSD drives without SCT support, because of this I want to tune /sys/block/device-name/device/timeout in order to force mdadm put these drives offline. So, I can see my drive like this:

/dev/disk/by-id/ata-OCZ-SABER1000_A22MJ061512000074.

Where can I tune /sys/block/device-name/device/timeout from 30 to 7 sec only for these drive? I don't want to use rc.local.

Can I create right udev rules for it in /etc/udev/rules.d?

I want to avoid any conflict with /lib/udev/rules.d.

Code: Select all# udevadm monitor --environment --udev
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing

UDEV  [9302.549485] add      /devices/pci0000:00/0000:00:01.2/0000:03:00.0/host0/target0:0:0 (scsi)
ACTION=add
DEVPATH=/devices/pci0000:00/0000:00:01.2/0000:03:00.0/host0/target0:0:0
DEVTYPE=scsi_target
SEQNUM=5210
SUBSYSTEM=scsi

[Code] ....

View 0 Replies View Related

Debian Configuration :: Udev Rules To Change R/W Permissions?

Mar 28, 2011

I'm trying to allow non-root account to use avrdude to program mucrocontrollers. There are many articles online about how to do that, but it seems not to work for me. Every time i try to execute avrdude it says "permission denied". Here's "$ udevadm info --name=/dev/bus/usb/002/011 --attribute-walk" says looking at device '/devices/pci0000:00/0000:00:1d.1/usb2/2-1':

KERNEL=="2-1"
SUBSYSTEM=="usb"
DRIVER=="usb"
ATTR{configuration}==""

[code]....

However, after restarting udev, replugging the device, even rebooting the computer I still get "permission denied". The Vendor and Product match, so what's the problem?

View 7 Replies View Related

Fedora :: Udev Rules: Hide Arrays From Nautilus?

Aug 19, 2010

In the not so distant past, I was able to hide arrays/encrypted arrays from nautilus with udev rules as follows:

Code:

## HIDE Encrypted "dm" partitions from nautilus
SUBSYSTEM=="block", KERNEL=="dm-*", ENV{ID_FS_USAGE}=="crypto", ENV{DKD_PRESENTATION_HIDE}="1"
## NOTE: not needed by Fedora

[code]....

View 1 Replies View Related

Debian :: Custom Udev Rules Not Taking Place?

Mar 20, 2011

I'm trying to write udev rules to make it easier to recognize the network cards in my server. After a reboot it doesn't seem to take place, what am I doing wrong? I'm running Debian Squeeze stable.

Code:
$ uname -a
Linux debian 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64 GNU/Linux
Code:
# ls -l /etc/udev/rules.d/
total 4

[Code]...

View 3 Replies View Related

Debian :: Reset/remove Udev Persistent-net-rules?

Apr 30, 2011

I should create a sqeeze image and install it on other computers.Udev should detect network card (NIC) module and load it automatically at startup.How I understand /lib/udev/rules.d/75-persistent-net-generator.rules runs when udev starts, then writes to /etc/udev/rules.d/70-persistent-net.rules.The problem is, udev searches for this NIC on other hardware and the network cannot start.I can solve this problem easily using a startup script to delete /etc/udev/rules.d/70-persistent-net.rules file.

View 2 Replies View Related

General :: Udev Rules To Automatically Apply 666 Permission?

Apr 3, 2010

my linux box the device node for my printer is by default setup as the following: crw-rw---- 1 root lp 189, 1 Apr 3 07:45 /dev/bus/usb/001/002 This causes cups to not print at all. The Hp backend (HPLIP) fails because of these permissions. How do I change it so that it's crw-rw--rw 1 root lp 189, 1 Apr 3 07:45 /dev/bus/usb/001/002. Ie I would like 666 file permission on that node.

View 2 Replies View Related

Ubuntu :: Udev Rules Suddenly Stopped Working In 9.10?

Aug 10, 2010

Recently I had made some udev rules to communicate with a few devices using USB ports. For some odd reason, they suddenly stopped working. Here are my rules:

Code:

ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK="HCS12"
ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK="Driver12"
ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0109", SYMLINK="Driver34"

According to the documentation, all that is needed to write proper rules is one match operator (relevant info) and one assignment operator (name of port). I am running kernel 2.6.31-22, so udev rules are valid for use (they require at least 2.6.15). My only guess is to include something that identifies the serial port.

View 1 Replies View Related

Programming :: Write Scripts To Pass 2 Different Variables To Find Command

Aug 18, 2010

i am trying to write scripts to pass 2 different variables to find command.

find . -name $var1 -exec grep -H $var2
find . -name CDR_2010-07-21 -exec grep -H 9892614477 {} ;

1st variable CDR_2010-07-21(passed by var1) is the file name inside which i am trying to search string 9892614477(passed by var2). i have tried following script

[code]...

View 9 Replies View Related

Debian :: Write Udev Rules In Order To Automount Usb Pendrive?

Oct 9, 2010

im using Debian (lenny) with 2.6.26 kernel, I'm trying to write udev rules in order to automount my usb pendrive, so I added this rules in udev:

SUBSYSTEM=="block", SUBSYSTEMS=="scsi",ATTRS{vendor}=="OTi ",
ATTRS{model}=="Flash Disk ", NAME="penna128M",RUN="/usr/bin/
pmount /dev/penna128M"

I use pmount to install the device as normal user If i connect my device to the usb port I don't see nothing in /media/penna128M, BUT giving at the prompt cat /etc/mtab the last line is:

/dev/penna128M /media/penna128M vfat rw,noexec,nosuid,nodev 0 0

The line in fstab about this pendrive is:

/dev/penna128M /media/penna128Mvfatdefaults,user,owner,auto00

View 5 Replies View Related

Debian Configuration :: Synaptics Udev Rules Ignored After Yesterdays Upgrade?

Apr 14, 2010

After yesterdays upgrade of Squeeze, my Synaptics touchpad's udev configuration is ignored on my EeePC. It was working fine before. Are there any changes in how it is supposed to be configured or is it just broken?

View 3 Replies View Related

Ubuntu Servers :: Udev Rules To Check If File Exists?

Jun 9, 2011

Is it possible to set up a udev rule that will check if a file exists on a USB drive?

I've got a few ubuntu servers in environments with some very not-techy peoples. Im hoping to get to the point where I can give them a few USB sticks with scripts on them, and if they plus one of these sticks in it will be mounted in, say, /media/special (rather than /media/usb0..7) and then the script would be run. But if a usb drive without special.sh is inserted, it should be mounted to /media/usb0..7 as normal.

I've been googeling for udev rules, and it seems simple enough to specify a mount point based on brand/model/serialnumber/etc... but i havent been able to find anything about checking for the existance of a file.

Tho the more i think about it, the more im starting to think its not going to be that straight forward. Can udev check for a file on a drive before that drive is mounted? Is it going to be a case of mounting every drive to /media/usb0..7 then having a script run that will check for the file, and if its there change the mount point before running special.sh?

View 1 Replies View Related

Software :: SLES11 / Udev Rules / Tape Media Changer?

Oct 1, 2009

at our SLES11 server there is an iscsi tape roboter from OVERLAND attached. From this great forum we learnt to use udev rules in order to fix the device name for the media changer /dev/sgN where N is altering after each reboot. Here is the udevinfo output of our tape changer:

#udevinfo -a -p $(udevinfo -q path -n /dev/sg5)
looking at device
'/devices/platform/host4/session1/target4:0:0/4:0:0:2/scsi_generic/sg5':
KERNEL=="sg5"

[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved