[SOLVED] automatic usb-backup with udev-rules + script
I would like to have my usb-harddrive automatically start a backup as soon as it is plugged in. And finally a bell is supposed to ring.
I've created an udev-rule and a backup-script as shown below.
However, instead of creating /dev/backup-drive first something strange is happening:
The bell rings 3 times, followed by the backup, followed by a 4th ring.
What's going on?
Here's may udev-rule:
## /etc/udev/rules.d/95-backup.rules
SUBSYSTEMS=="usb", ATTRS {serial}=="100", SYMLINK=="backup-drive", RUN+="/usr/local/bin/backup-thumb.sh"
fstab:
/dev/backup-drive /media/backup ext3 rw,user 0 0
and my script:
#!/bin/bash
sleep 10
rsync -vrtolgh --exclude '/.VirtualBox/' --delete /home/myhome /media/backup-drive
aplay /usr/share/sounds/phone.wav
Last edited by mehldutt (2007-07-03 20:28:27)
The syntax of your udev rule is all wrong - for example after SYMLINK you should use "+=" or ":=". "==" is for comparing to some value.
I think in rsync command line you want -H not -h (help) option. Also -v (verbose) is useless since you'll never see the output.
Another thing which will prevent running rsync properly is /media/backup-drive while you use /media/backup in fstab.
I suggest that you first try running rsync command from the command line "manually" and try if it works at all. After you'll make it work try the below suggestions.
Another problem: what makes the backup drive mounted under /media/backup directory when you plug it into usb slot ? Are you doing it somehow "manually" in the 10 second period after plugging ? Do you use automounter of some kind ?
If you intend to use ext3 as the backup drive filesystem you should also add sync command after rsync to make sure no data stays in RAM cache.
I think you need to read udev manpage first.
I can also advice you to read my udev rules for automounting usb devices (it's for any type of filesystem and any number of partitions):
KERNEL=="sd[b-z]", NAME:="%k", SYMLINK+="usbhd-%k", GROUP:="users", OPTIONS="last_rule"
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"
ACTION=="add", KERNEL=="sd[b-z][0-9]", PROGRAM=="/lib/udev/vol_id -t %N", RESULT=="vfat", RUN+="/bin/mount -t vfat -o rw,noauto,flush,dirsync,noexec,nodev,noatime,dmask=000,fmask=111 /dev/%k /media/
usbhd-%k", OPTIONS="last_rule"
ACTION=="add", KERNEL=="sd[b-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,async,dirsync,noexec,nodev,noatime /dev/%k /media/usbhd-%k", OPTIONS="last_rule"
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"
I think it could be simplified and modified for your backup device like this:
SUBSYSTEMS=="usb", ATTRS(idVendor)=="XXXX", ATTRS(idProduct)=="YYYY", KERNEL=="sd[a-z]", NAME:="%k", SYMLINK:="backupdevice", OPTIONS="last_rule"
SUBSYSTEMS=="usb", ATTRS(idVendor)=="XXXX", ATTRS(idProduct)=="YYYY", ACTION=="add", KERNEL=="sd[a-z]1", SYMLINK:="backuppartition", GROUP:="users", NAME:="%k"
SUBSYSTEMS=="usb", ATTRS(idVendor)=="XXXX", ATTRS(idProduct)=="YYYY", ACTION=="add", KERNEL=="sd[a-z]1", RUN+="/bin/mount -t auto -o rw,noauto,async,dirsync,noexec,nodev,noatime /dev/%k /media/backup-drive"
SUBSYSTEMS=="usb", ATTRS(idVendor)=="XXXX", ATTRS(idProduct)=="YYYY", ACTION=="add", KERNEL=="sd[a-z]1", RUN+="/usr/local/bin/backup-thumb.sh", OPTIONS="last_rule"
SUBSYSTEMS=="usb", ATTRS(idVendor)=="XXXX", ATTRS(idProduct)=="YYYY", ACTION=="remove", KERNEL=="sd[a-z]1", RUN+="/bin/umount -l /media/backup-drive", OPTIONS="last_rule"
assuming that you have a single partition backup drive formatted as ext3 (or at least it's the first partition).
Also another assumption is that idVendor and idProduct are unique to your backup drive. If not you should add some extra ATTRS parameters that will ensure this combination is unique.
The directory /media/backup-drive must already exist (remove your fstab line - it's not needed in this case because mount command is run directly from the udev rule).
Replace all XXXX and YYYY with the values from lsusb for your backup device - plug it in, run lsusb and copy values which look like XXXX:YYYY near to the name of your backup device.
Anyway, you can play with different options and try to modify it yourself. The automounting rules work for me very well for some time (including flush option). The backup rules you need to test yourself :-)
Last edited by lanrat (2007-05-05 17:20:51)
Similar Messages
-
TC wireless failed; Use as USB backup with Netgear R7000 as router?
TC wireless failed. Can TC (500Gb hard drive) be used as USB backup with Netgear R7000 as router or to nearby iMac?
No, you cannot use the USB to access an internal disk in the TC.
If its wireless has failed the rest will not be far behind.. the 500GB is Gen1 or early Gen2.. and they are simply failing in numbers.. you can probably repair it with a power supply, I kind of doubt the wireless itself would die but is symptomatic of failure of the unit as a whole.
If you want a backup just buy a large USB drive and plug it straight into the iMac. Choose the fastest interface you can afford.. ie firewire 800 is still head and shoulders better than usb2.. but usb3 or thunderbolt in the later machines are a big improvement.. with the later costing an arm and leg still, with most of the bits in between. -
[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. -
Problem with udev rule to disable touchpad when USB mouse connects
Hi, I've been running Arch on this laptop, but I can't get this udev rule to work properly.
What I want to happen is: when I plug in my usb mouse, the laptop touchpad is disabled, and the left and right buttons are reversed (I'm left handed)
After following several tutorials, both from the arch wiki and other sites, I've come up with this udev rule:
ACTION=="add", SUBSYSTEM=="input", RUN+="/usr/local/bin/USBMouse.sh"
ACTION=="remove", SUBSYSTEM=="input", RUN+="/usr/local/bin/USBMouse.sh"
And here's the script it links to (USBMouse.sh):
#!/bin/bash
export DISPLAY=:0.0
synclient TouchPadOff=$(/usr/bin/lsusb | grep "Microsoft Corp.\
Nano Transceiver v1.0 for Bluetooth" | wc -l)
if [[ $(/usr/bin/lsusb | grep "Microsoft Corp.\
Nano Transceiver v1.0 for Bluetooth" | wc -l) == 1 ]]
then
xmodmap -e 'pointer = 3 2 1'
fi
if [[ $(/usr/bin/lsusb | grep "Microsoft Corp.\
Nano Transceiver v1.0 for Bluetooth" | wc -l) == 0 ]]
then
xmodmap -e 'pointer = 1 2 3'
fi
Running the script from a terminal returns no errors and works as expected. The problem is when I plug/unplug the mouse from the usb port, nothing happens.
I appreciate any insight you might have about how to fix this, and thank you in advanceThis has already been done. And another relevant thread.
-
[Solved] Cannot detect camera with udev, only with HAL.
I have removed HAL as I realize it is being deprecated and HAL also created issues with frequent 2-3 second HDD access. I have managed to get udev and pcmanfm to detect and mount pen drives using the udev wiki and new rules.
However, my digital camera is not detected, nor even assigned a device name (unless I use HAL).
Output from "tail -f /var/log/messages.log" after insertion of camera:
Jul 31 15:49:02 eagle kernel: usb 1-4: new high speed USB device using ehci_hcd and address 9
Note udev does NOT assign even a device name. The camera is also not detected via "lsusb". Therefore, without a device name I cannot use:
# udevadm info -a -p $(udevadm info -q path -n [device name])
to even begin writing udev rules.
EDIT and PS: I have copied the /lib/gphoto ruleset file to /etc/udev/rules.d and restarted udev to no effect as well.
EDIT(2): This problem is now "partly" solved. I can detect the camera using "gphoto2" command line, but only as root, so the problem appears to be a udev permission problem, which for some reason HAL did not have.
EDIT(3): Added myself to "camera" group, copied permissions line to libgphoto rules in /etc/udev/rules.d as per camera wiki and problem solved.
It seems that changing over to udev at the moment is not exactly straight forward. I still cannot get automounting of CDROM drive either - but will get there eventually. (I hope udev becomes more user friendly than HAL, because at the moment HAL wins on that front!).
Last edited by lagagnon (2010-07-31 23:55:51)Search the forums. There is already a thread on this today.
https://bbs.archlinux.org/viewtopic.php?id=180443 -
Replace chmod 666 /dev/dri/card0 with udev rule [Solved]
Hello everyone ! , im configuring my xorg.conf to use 3d, i have a S3 Unichrome Pro (K8M800) chip , and i have it working right now , but in the manual that i read to do this theres a hack that i want to do the right way:
Link
a. First, the permission issue. This is a dirty hack, but I have not taken any time to learn the innards of udev. As root, type "chmod 666 /dev/dri/card0". This will enable a regular user to use dri. I know I should fix it via udev's config, and I intend on figuring that out in the near future and posting an update to this HOWTO. For now, I put this command after "modprobe via" in my /etc/rc.d/rc.local file.
So i was wondering if maybe someone can help me to do the udev trick, as i have in my rc.local the line but if this can be done via udev i want to do it that way.
I was reading the udev article at the wiki but with all that KERNEL %k %n and that stuff i have no idea how to do it, if u think that its better for me to learn this the hard way maybe some usefull link will be good
Thank you.Starting with /dev/hdd, there is already a rule for this in the default ruleset:
BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", SYSFS{media}=="cdrom*", NAME="%k", GROUP="optical"
This creates /dev/hdd as follows:
brw-rw---- 1 root optical 22, 64 2006-08-10 19:11 /dev/hdd
so all you need to do is add yourself to the optical group. I don't use gnomebaker myself, but the underlying setup is the same for all burning apps.
I was going to post a similar answer for your dri problem as well, because we do have this rule by default:
KERNEL=="card[0-9]*", NAME="dri/%k", GROUP="video"
which should create /dev/dri/cardN with root:video ownership, but I can't verify that - for some reason, my laptop has
crw-rw---- 1 root root 226, 0 2006-09-08 09:11 /dev/dri/card0
instead i.e. GROUP="video" is not applied. If yours shows up as root:video, however, just add yourself to the video group as well. -
I am trying to develop a Mail run script and I am running into problems. The Rule is being trigger because I have a change my color rule action and a script action. The color changes but the script does not appear to trigger at all. His is the script.
using terms from application "Mail"
on perform mail action with messages theMessages
tell application "Finder" to set pathToAttachments to (path to desktop folder as string)
tell application "Mail"
repeat with theMessage in theMessages
set theText to content of theMessage
if theMessage's mail attachments is not {} then
repeat with theAttachment in theMessage's mail attachments
set theFileName to pathToAttachments & theAttachment's name
try
save theAttachment in theFileName
on error errnum
end try
tell application "Preview" to open file theFileName
tell application "Finder" to delete file theFileName
end repeat
end if
end repeat
end tell
end perform mail action with messages
end using terms from
tell application "Mail"
set myMessages to selection
tell me to perform mail action with messages myMessages
end tell
Notice the tell block at the end. If I uncomment that, select a mail message and execute that in a script editor, all is fine.
With that block commented out and try to execute it using the *Apply Rules* nothing seems to happens. Even if I put a Beep statement inside the "on perform mail action with messages theMessages" block, That does not even sound off.
Anyone see why this would execute as a rule?Camelot wrote:
The logic of whether to invoke the rule is not within the script.
You tell Mail.app to run the script when certain conditions are met (e.g. sender address, recipient address, or one of several other conditions). Once Mail.app has decided the messages matches the conditions it calls your script.
I realize that is the theory behind mail.app, but it has been my experience with Rule settings that they do NOT run "automagically" when conditions in them are met.
This is clearly illustrated by a number of cases I have where by simply "adding a rule," any rule, that says anything, and then clicking the resulting "apply" button (which only is available when you add or subtract a rule), all the existing rule(s) are processed and mail is sorted according to those rules which had previously been sitting in the inbox. (In my case they are a bunch of "junk" filters).
There is either some bug in mail's triggering mechanism, or some inherently "different" mechanism in use when "auto triggered" vs when "applied." In either case, there is no documentation about it. -
Udev rules and group / permission errors [solved] [outdated]
Latest udev is a miracle to me. It ignores every group ore permission settings. Anyone else having same experiences?
Last edited by Moo-Crumpus (2008-09-29 05:17:40)Let's assume that you have two files with udev rules. The basic udev.rules and 00.udev.rules (with custom rules).
Udev first reads all rules from 00 file and then rules from the basic file.
This means that if you have a custom rule for a given device you should copy all rules that apply to it from the basic file to the 00 file (not only lines with GROUP). This is because with OPTIONS="last_rule" udev will stop processing rules for this device.
All rules are read and then applied in the order from the top to bottom except SUBSYTEM which is applied as the last rule (kind of held in a buffer). This is the reason why my cd burner /dev/hdc had permissions for disk group and not optical.
This is my 00.udev.rules (it still needs some cosmetic changes but it works and of course I don't have all the devices):
SUBSYSTEM="video4linux", GROUP="users"
SUBSYSTEM="sound", GROUP="users"
SUBSYSTEM="printer", GROUP="users"
SUBSYSTEM="block", GROUP="disk"
BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", SYMLINK="%c{1} %c{2}"
BUS="ide", KERNEL="hdc", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", GROUP="users", SYMLINK="nagrywarka dvd cdrw", OPTIONS="last_rule"
BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", GROUP="users", OPTIONS="last_rule"
BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-floppy.sh %k", RESULT="floppy", NAME{all_partitions}="%k", GROUP="users", OPTIONS="last_rule"
BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}"
BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", NAME="scd%n", GROUP="users", OPTIONS="last_rule"
BUS="scsi", KERNEL="sg[0-9]*", SYSFS{type}="5", NAME="%k", GROUP="users", OPTIONS="last_rule"
KERNEL="fd[0-9]*", NAME="fd%n", GROUP="users", SYMLINK="floppy/%n fd%nu1440 fd%nu720 fd%nh1200 fd%nu360", OPTIONS="last_rule"
BUS="usb", SYSFS{serial}="CN16J1Q3HWSX", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="users", SYMLINK="drukarka_hp_845c drukarka", OPTIONS="last_rule"
BUS="usb", KERNEL="sd*", PROGRAM="/etc/udev/usb-storage.sh %k", RESULT="1", NAME="%k", GROUP="users", OPTIONS="last_rule"
KERNEL="rtc", NAME="misc/%k", SYMLINK="%k", GROUP="users", MODE="0664", OPTIONS="last_rule"
KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" GROUP="users", OPTIONS="last_rule"
KERNEL="nvidia*", GROUP="users", OPTIONS="last_rule"
KERNEL="fb[0-9]*", NAME="fb/%n", GROUP="users", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="card[0-9]*", NAME="dri/%k", GROUP="users", OPTIONS="last_rule"
KERNEL="3dfx*", NAME="%k", GROUP="users", OPTIONS="last_rule"
KERNEL="dvb*", PROGRAM="/etc/udev/dvb.sh %k", NAME="%c", GROUP="users", OPTIONS="last_rule"
KERNEL="video[0-9]*", NAME="v4l/video%n", GROUP="users", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="users", SYMLINK="radio%e", OPTIONS="last_rule"
KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", GROUP="users", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="users", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="controlC[0-9]*", NAME="snd/%k", OPTIONS="last_rule"
KERNEL="hw[CD0-9]*", NAME="snd/%k", OPTIONS="last_rule"
KERNEL="pcm[CD0-9cp]*", NAME="snd/%k", OPTIONS="last_rule"
KERNEL="midi[CD0-9]*", NAME="snd/%k", OPTIONS="last_rule"
KERNEL="timer", NAME="snd/%k", OPTIONS="last_rule"
KERNEL="seq", NAME="snd/%k", OPTIONS="last_rule"
KERNEL="audio*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="dmmidi*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="admmidi*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="dsp*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="adsp*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="midi*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="amidi*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="mixer*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="sequencer*", NAME="sound/%k", SYMLINK="%k", OPTIONS="last_rule"
KERNEL="pktcdvd", NAME="pktcdvd/control", GROUP="users", MODE="0660", OPTIONS="last_rule"
KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="users", MODE="0660", OPTIONS="last_rule"
The problem with /dev/hdc was that first udev (version 057) was reading a rule from my 00 file (BUS="ide", KERNEL="hdc"...) with GROUP=users. Then it was reading SUBSYSTEM="block", GROUP="disk" rule from the basic file (but it wasn't executed at that time). And then it was reading BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1"... with GROUP=optical. Then it was executing SUBSYTEM rule (hdc is a block device). That's why only disk group had an access to /dev/hdc (with OPTIONS="last_rule" in the basic file in the GROUP="optical" line it would ignore SUBSYSTEM rule).
There are also other rules that you should add (IMO) to your custom rules if you are changing something. In my case it's for example BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/cdsymlinks.sh %k"... which creates symlinks for cd drives. This rule must be above other rules (the number of the symlinks is now unlimited - previously it was 5 IIRC).
So now the rules are mixed together in the lexical order (except SUBSYTEM rules which are executed at the end) unless OPTIONS="last_rule" is used or second (and other) rule has a NAME filed (only one rule for a given device can have NAME filed. Every other rule for the same device with NAME field is ignored IIRC). It also means you can now split rules for a device into several rules - only one of them can have NAME filed and the last should have OPTIONS="last_rule".
Since in your case you have custom rules only for a well defined usb devices (not /dev/sd*) IMO it should work as you think (only add OPTIONS="last_rule").
I hope it's now perfectly clear 8) -
Sybase Control Center 3.2.7 -Automatic schedule Backups/Logs
Hello Experts,
I have 2 queries which need to be discussed with you people.
1.I am currently working with Sybase database 15.7.0.122 and with Windows environment .It has also been released a sap note by sap that we sybase central has vanished and the customer's are forced to move to Sybase Control Center.Is there any way or plug ins that we can install and use sybase central.
2.I have downloaded and configured the Sybase Control center 3.2.7 which came with Sybase database 15.7.0.122 software and able to launch ,configure the user database as well as took the backup successfully and it seem's the web gui interface looks good but sometimes clock revolves which is some time annoying.
My question and requirement is to schedule the automatic backups with retention through scripts which I was able to do in Sybase central and Dbacockpit but here don't find any option.However , I see that in Sybase 16.0 business suite there is TASK MANAGEMENT option in Sybase control center where you have option to schedule the jobs.May be I am not able to find in the current version .Appreciate your guidance in fixing it.
Thanks
AsimHi Asim,
For your 1st query refer SAP note
1991153 - Sybase Central Unavailable on ASE 15.7 SP101 how to add it back
For 2nd Query,
It looks be possible system resource issue due to which you see the clock symbol.
Once the sybase central is restored back you may schedule job using the same.
Hope this helps.
Regards,
Deepak Kori -
[SOLVED] How to automatically mount USB drives with custom mount point
edit:
Original title was : 'Unable to mount USB disk via /etc/rc.local', but got changed since the /etc/rc.local problem isn't relevant for me anymore.
Hello,
Since I am new to this forum, I'll start off with this :
Thanks to archlinux, its founder and all its contributors, cause this is the operating system (flavour) that annoys me the least.
The root problem :
I want to automount USB storage devices to other places than /media/ and without the need for programs that depend on gnome and the like. As I tried some stuff with hald and such, I didn't really get to a nice and easy to configure solution. Any hints in that direction are always welcome.
For now, automount of known USB storages devices during boot, will do.
So the things I tried and didnt work :
1.
Provide the disk info to /etc/fstab (via the disks UUID and 'auto' filesystem)
Add 'mount /mountpoint' to /etc/rc.local
Result : the mount command in rc.local says '... specify filesystem'
However, after boot, running /etc/rc.local mounts the USB disks correctly.
2.
Provide the disk info to /etc/fstab (via the disks UUID and the correct filesystem)
Add 'mount /mountpoint' to /etc/rc.local
Result : pc doesn't get through boot process and gives me the 'ctrl-d to reboot or root passwd for maintenance'
3.
Provide no disk info in /etc/fstab
Add the full mount line to /etc/rc.local (mount -t fs /dev/disks/by-uuid/MyUUID /MyMountpoint )
Result : don't remember the output of the mount execution, but well, it didn't mount
However, after boot, running /etc/rc.local mounts the USB disks correctly.
Is there something that isn't loaded at the time of rc.local execution that I need for mounting of USB devices ? Or why else is this failing ?
Regards,
BasiK
Last edited by BasiK (2009-08-28 07:22:50)Thanks for the hint hunterthomson, but the pc I will be using it on, is an own-built HTPC/home file server, so there is no way I want to use a graphical file manager to get the usb disks mounted.
I tried to figure out a little about udev rules, and I got to do what I wanted to do, so thx for pointing me in that direction Mr.Elendig.
Btw, I am indeed also using auto-sleep/park disks, but this udev way works perfectly.
I added two rules files to /etc/udev/rules.d/ :
The first for a known usb disk (with its volume uuid), with a named mountpoint under my media dir /symbiosis/ :
[basik@plox ~]$ cat /etc/udev/rules.d/80-usb-utopia.rules
ACTION=="add", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_UUID}=="a59332c2-07ba-4c52-afb5-20e361bdf71a",SYMLINK+="usb-%n", GROUP="storage", NAME="%k"
ACTION=="add", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_UUID}=="a59332c2-07ba-4c52-afb5-20e361bdf71a",RUN+="/bin/mkdir -p /symbiosis/utopia"
ACTION=="add", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_UUID}=="a59332c2-07ba-4c52-afb5-20e361bdf71a", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /symbiosis/utopia", OPTIONS="last_rule"
ACTION=="remove", KERNEL=="sd[b-z][0-9]", ENV{ID_FS_UUID}=="a59332c2-07ba-4c52-afb5-20e361bdf71a", RUN+="/bin/umount -l /symbiosis/utopia", OPTIONS="last_rule"
The second for unknown usb disks, to mount under the same dir. This is simply taken from the archwiki http://wiki.archlinux.org/index.php/Ude … .26_Tricks
Make sure these rules are executed after the ones for specific usb disks.
[basik@plox ~]$ cat /etc/udev/rules.d/usb-disks.rules
KERNEL=="sd[a-z]", NAME="%k", SYMLINK+="usb%m", GROUP="storage", OPTIONS="last_rule"
ACTION=="add", KERNEL=="sd[a-z][0-9]", SYMLINK+="usb%n", GROUP="storage", NAME="%k"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mkdir -p /symbiosis/usb%n"
ACTION=="add", KERNEL=="sd[a-z][0-9]", RUN+="/bin/mount -t auto -o rw,noauto,sync,dirsync,noexec,nodev,noatime /dev/%k /symbiosis/usb%n", OPTIONS="last_rule"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/umount -l /symbiosis/usb%n"
ACTION=="remove", KERNEL=="sd[a-z][0-9]", RUN+="/bin/rmdir /symbiosis/usb%n", OPTIONS="last_rule"
These may not be the nicest looking udev rules, but it works for what I wanted to do with it. -
[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 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) -
UDev rules not working for MidiSport 2x2 usb midi device
I installed arch a couple of months ago and am loving it so far. Any problems I've had so far have already been solved in the forums, but this one's really got me. I have a MidiSport 2x2 that I want the firmware to be loaded on everytime I plug it in. I installed (there's not an arch package) a package that is supposed to do just that. (It's called midisport-firmware-1.2.tar.gz). However, the package seems to be out of date (2006) and I even had to modify a couple places in the configure script to get it to work with current program revisions. However, once installed, it does nothing. It installed firmware files and udev rules for the device into a couple of directories. When I run the command that is supposed to load the firmware, it works fine. But for some reason, (I even checked the udev kernel log) it's like the event isn't even being triggered. Here's part of the original file that came with the package that's supposed to load the firmware:
# midisport-firmware.rules - udev rules for loading firmware into MidiSport devices
# DEVPATH=="/*.0" selects interface 0 only
# (some udev versions don't work with SYSFS{bInterfaceNumber})
# MidiSport 2x2
ACTION=="add", SUBSYSTEM=="usb", DEVPATH=="/*.0", ENV{PRODUCT}=="763/1001/*", RUN+="/sbin/fxload -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport2x2.ihx"
# vim: ft=conf
And here's what I modified it to in an attempt to make it work:
# MidiSport 2x2
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0763", ATTR{idProduct}=="1001", RUN+="/sbin/fxload -D /dev/%k -s /usr/local/share/usb/maudio/MidiSportLoader.ihx -I /usr/local/share/usb/maudio/MidiSport2x2.ihx"
I would really appreciate help from anyone who knows about this kind of thing, as I can't figure out what's going wrong. If it's something wrong with the config, please let me know. Actually, some HAL events popped up when I was testing this out. Is it possible HAL is blocking the udev event somehow?Hi,
The firmware files must be put in /lib/firmware so they can be found by the kernel. Are they being put there? -
Calling shell script from udev rule
Hello,
I've encrypted partition with key stored on usb drive. I created udev rule:
SYSFS{size}=="....", SYSFS{serial}=="....", ACTION=="add", SYMLINK+="pendrive", RUN=="/bin/sh /home/kamil/bin/cryptsetup.sh"
as You can see I would like to call cryptsetup.sh when pendrive has been inserted. This script looks like:
/bin/mount /media/pendrive
/usr/sbin/cryptsetup luksOpen /dev/sda7 enc1 -d /media/pendrive/key.txt
/bin/mount /mnt/enc1
The idea is to create /dev/mapper/enc1 and mount it automatically without any user action. My problem is that second line of this script (cryptsetup command) hangs for a long time - minute or two.
Here, if it helps, is the listing of processess when cryptsetup hangs:
ps ax | grep crypt
1379 ? S< 0:00 [kcryptd/0]
6418 ? S< 0:00 [kcryptd/1]
8046 ? S< 0:00 /usr/bin/perl /home/kamil/bin/cryptsetup.sh
8049 ? S<L 0:01 /usr/sbin/cryptsetup luksOpen /dev/sda8 enc2 -d /media/pendrive/key.txt
8098 pts/2 S+ 0:00 grep crypt
Notice status of command /usr/bin/cryptsetup... - it's S<L. I don't know if it is connected to the problem.
When I comment out this udev rule, connect the pendrive and than manually call cryptsetup.sh I have no problem and everything works fine.
Any ideas how to fix that?
Thanks, best regards
KamilHi,
Requirements
* CREATE JOB (10g Rel.1)
* CREATE EXTERNAL JOB (10g Rel.2 / 11g)
* EXECUTE on dbms_scheduler (granted to public by default)
Since Oracle 10.2.0.2 the commands are executed as user nobody.
Code:
--Create a Program for dbms_scheduler
exec DBMS_SCHEDULER.create_program('RDS2008','EXECUTABLE','c:\ WINDOWS\system32\cmd.exe /c echo 0wned >> c:\rds3.txt',0,TRUE);
--Create, execute and delete a Job for dbms_scheduler
exec DBMS_SCHEDULER.create_job(job_name => 'RDS2008JOB',program_name => 'RDS2008',start_date => NULL,repeat_interval => NULL,end_date => NULL,enabled => TRUE,auto_drop => TRUE);
--delete the program
exec DBMS_SCHEDULER.drop_program(PROGRAM_NAME => 'RDS2008');
--Purge the logfile for dbms_scheduler
exec DBMS_SCHEDULER.PURGE_LOG;
This is one way as suggested by Trent.
We can also achieve as follows.
http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm
Calling OS Commands from Plsql
I think the above solutions may useful to you.
Let me know if you are facing any problem.
Thanks and Regards
Maheswara -
[SOLVED]Mounting usb drives "not authorized" with thunar-volman (XFCE)
Hi,
I'm new to Arch (even though I must be approximately at my 15th try at installing it properly) and I have a problem with thunar-volman.
Whenever I log in as user, and try to mount a usb drive with thunar, let's say I want to plug a drive labeled Ext3_8Go, I get the same message in a pop-up window : "Failed to mount Ext3_8Go (or anything close, not in English in the text), not authorized (that part is in English)"
My install is :
- net install
- partitions : 9Go for /, no swap, no separate /home
- packages : base and base-devel. The only modifications in the package list is that I remove ppp, pcmciautils, and xfsprogs.
- config : at the install stage I only modify rc.conf to change LOCALE and HOSTNAME, and pacman's mirrorlist to allow all French mirrors in addition to the one at the top.
When the usb installation is over, I run this script :
"installation_xfce.sh" (there may be some errors left, I modify this script as I learn) :
#!/bin/bash
# expected environment : freshly installed archlinux, login : root.
echo "Are you connected to internet ? If not, please Ctrl+C and reload this script when connected"
echo "Otherwise, press ENTER to continue installation"
read var_dummy
echo "Creation of the user : please type in your user name :"
read var_username
useradd -u 1000 -g users -G audio,lp,storage,optical,video,wheel,games,power,network -d /home/$var_username/ -s /bin/bash -m $var_username
echo "You will now be asked to create the password for this user:"
passwd $var_username
# Add servers for pacman to find packages
cat >> /etc/pacman.conf << EOF
[multilib]
Include = /etc/pacman.d/mirrorlist
[archlinuxfr]
Server = http://repo.archlinux.fr/\$arch
[catalyst]
Server = http://catalyst.apocalypsus.net/repo/catalyst/\$arch
EOF
# Install packages
pacman -Syyu
pacman -S acpi acpid alsa-oss alsa-plugins alsa-utils catalyst catalyst-utils cpufrequtils cups dbus gstreamer0.10-base-plugins iptables laptop-mode-tools mesa net-tools netcfg ntp pm-utils rfkill rsync sudo ttf-dejavu vim wireless_tools xf86-input-evdev xorg-server xorg-utils xorg-xinit xorg-xinput yaourt conky gamin gnome-icon-theme gnome-keyring gvfs-afc network-manager-applet networkmanager slim slim-themes archlinux-themes-slim hicolor-icon-theme xfce4 xfce4-goodies
# If pacman failed, better stop the script here, and wait for a network connection
if [[ $?!=0 ]]
then
echo : failed to install packages - check your network connection, or review script
exit 1
fi
# Fix sound issue
cat > /home/$var_username/.asoundrc << EOF
pcm.!default{
type hw
card 1
device 0
ctl.!default{
type hw
card 1
device 0
EOF
chown $var_username:users /home/$var_username/.asoundrc
# Configure video settings for X to use Catalyst
if [[ ! -e /etc/X11/xorg.conf.d ]]
then
mkdir /etc/X11/xorg.conf.d
fi
cat > /etc/X11/xorg.conf.d/20-fglrx.conf << EOF
Section "Monitor"
Identifier "aticonfig-Monitor[0]-0"
Option "VendorName" "ATI Proprietary Driver"
Option "ModelName" "Generic Autodetecting Monitor"
Option "DPMS" "true"
EndSection
Section "Device"
Identifier "aticonfig-Device[0]-0"
Driver "fglrx"
EndSection
EOF
sed -e 's/top_left/bottom_right/' -e '/alignment/i\double_buffer yes' -e '/CPU Usage/a\${color lightgrey}Temperatures:' -e '/CPU Usage/a\ CPU:$color ${hwmon 0 temp 1}°C' </etc/conky/conky.conf >/home/$var_username/.conkyrc
chown $var_username:users /home/$var_username/.conkyrc
# Install clickpad support
yaourt -S xf86-input-synaptics-clickpad
# Add french keyboard to X
sed '/MatchIsKeyboard/a\\tOption "XkbLayout" "fr"' </etc/X11/xorg.conf.d/10-evdev.conf >/etc/X11/xorg.conf.d/10-evdev.conf.new
mv -f /etc/X11/xorg.conf.d/10-evdev.conf.new /etc/X11/xorg.conf.d/10-evdev.conf
# Add new daemons, remove old ones, disable hwclock and remove netfs since I don't use it. add it if you need it
sed '/DAEMONS=/c\DAEMONS=(!hwclock dbus syslog-ng networkmanager laptop-mode acpid @alsa @cupsd @cpufrequtils ntpd crond)' </etc/rc.conf >/etc/rc.conf.new
mv -f /etc/rc.conf.new /etc/rc.conf
# Slim login manager ; change theme
mv /usr/share/slim/themes/archlinux-darch-grey /tmp/
mv /usr/share/slim/themes/default /tmp/
rm -r /usr/share/slim/themes/*
mv /tmp/archlinux-darch-grey /usr/share/slim/themes
mv /tmp/default /usr/share/slim/themes
sed '/^current_theme/c\current_theme archlinux-darch-grey' </etc/slim.conf >/etc/slim.conf
# XFCE login, and thunar launched as a daemon
sed '/^# exec/c\' </etc/skel/.xinitrc >/tmp/.xinitrc
sed '/^# .../c\' </tmp/.xinitrc >/home/$var_username/.xinitrc
cat >> /home/$var_username/.xinitrc << EOF
exec ck-launch-session startxfce4
thunar --daemon &
EOF
chown $var_username:users /home/$var_username/.xinitrc
# Boot to runlevel 5 now, and run slim then
sed -e 's/id:3/#id:3/' -e 's/#id:5/id:5/' -e 's|x:5:respawn:/usr/bin/xdm|#x:5:respawn:/usr/bin/xdm|' -e 's|#x:5:respawn:/usr/bin/slim|x:5:respawn:/usr/bin/slim|' </etc/inittab >/etc/inittab.new
mv -f /etc/inittab.new /etc/inittab
# Add colored prompt to user and root
sed '/^PS1/c\' </etc/skel/.bashrc >/root/.bashrc
cat >> /root/.bashrc << EOF
PS1='\[\e[0;32m\]\u@\h\[\e[m\] \[\e[0;35m\]\w\[\e[m\] \[\e[m\] \[\e[0;32m\]\t -\[\e[m\] \[\e[1;31m\]\$ \[\e[m\] '
EOF
cp /root/.bashrc /home/$var_username/.bashrc
chown $var_username:users /home/$var_username/.bashrc
# How does one do that automatically ?
# Manually add user to sudoers
EDITOR="vim" visudo
# Reboot, because it's quick and I'm too lazy to learn how to start all the daemons and others.
reboot
I can mount as a user, no password asked, with :
udisks --mount /dev/sdb2
but the GUI method tells me "not authorized".
"groups user" outputs :
lp wheel games network video audio optical storage power users
the command "ck-list-sessions" outputs :
Session2:
unix-user = '1000'
realname = ''
seat = 'Seat1'
session-type = ''
active = TRUE
x11-display = ':0.0'
x11-display-device = '/dev/tty7'
display-device = ''
remote-host-name = ''
is-local = TRUE
on-since = '2011-08-15T08:56:03.716103Z'
login-session-id = '1'
Session1:
unix-user = '1000'
realname = ''
seat = 'Seat2'
session-type = ''
active = FALSE
x11-display = ':0.0'
x11-display-device = ''
display-device = ''
remote-host-name = ''
is-local = TRUE
on-since = '2011-08-15T08:56:03.573029Z'
login-session-id = '1'
For those who don't have time to read the installation script, DBUS is in the DAEMONS list of rc.conf, and .xinitrc launches : exec ck-launch-session startxfce4
Any idea ?
Last edited by choubbi (2011-08-15 15:05:04)Thanks a lot !
That worked !
I stumbled across this part of the wiki several times before, but didn't really understand so I had not tried.
If anyone's interested in the script, here's the corrected version :
#!/bin/bash
# expected environment : freshly installed archlinux, login : root.
echo "Are you connected to internet ? If not, please Ctrl+C and reload this script when connected"
echo "Otherwise, press ENTER to continue installation"
read var_dummy
echo "Creation of the user : please type in your user name :"
read var_username
useradd -u 1000 -g users -G audio,lp,storage,optical,video,wheel,games,power,network -d /home/$var_username/ -s /bin/bash -m $var_username
echo "You will now be asked to create the password for this user:"
passwd $var_username
# Add servers for pacman to find packages
cat >> /etc/pacman.conf << EOF
[multilib]
Include = /etc/pacman.d/mirrorlist
[archlinuxfr]
Server = http://repo.archlinux.fr/\$arch
[catalyst]
Server = http://catalyst.apocalypsus.net/repo/catalyst/\$arch
EOF
# Install packages
pacman -Syyu
pacman -S acpi acpid alsa-oss alsa-plugins alsa-utils catalyst catalyst-utils cpufrequtils cups dbus gstreamer0.10-base-plugins iptables laptop-mode-tools mesa net-tools netcfg ntp pm-utils rfkill rsync sudo ttf-dejavu vim wireless_tools xf86-input-evdev xorg-server xorg-utils xorg-xinit xorg-xinput yaourt conky gamin gnome-icon-theme gnome-keyring gvfs-afc network-manager-applet networkmanager slim slim-themes archlinux-themes-slim hicolor-icon-theme xfce4 xfce4-goodies
# If pacman failed, better stop the script here, and wait for a network connection
if [[ $?!=0 ]]
then
echo : failed to install packages - check your network connection, or review script
exit 1
fi
# Fix sound issue
cat > /home/$var_username/.asoundrc << EOF
pcm.!default{
type hw
card 1
device 0
ctl.!default{
type hw
card 1
device 0
EOF
chown $var_username:users /home/$var_username/.asoundrc
# Configure video settings for X to use Catalyst
if [[ ! -e /etc/X11/xorg.conf.d ]]
then
mkdir /etc/X11/xorg.conf.d
fi
cat > /etc/X11/xorg.conf.d/20-fglrx.conf << EOF
Section "Monitor"
Identifier "aticonfig-Monitor[0]-0"
Option "VendorName" "ATI Proprietary Driver"
Option "ModelName" "Generic Autodetecting Monitor"
Option "DPMS" "true"
EndSection
Section "Device"
Identifier "aticonfig-Device[0]-0"
Driver "fglrx"
EndSection
EOF
sed -e 's/top_left/bottom_right/' -e '/alignment/i\double_buffer yes' -e '/CPU Usage/a\${color lightgrey}Temperatures:' -e '/CPU Usage/a\ CPU:$color ${hwmon 0 temp 1}°C' </etc/conky/conky.conf >/home/$var_username/.conkyrc
chown $var_username:users /home/$var_username/.conkyrc
# Install clickpad support
yaourt -S xf86-input-synaptics-clickpad
# Add french keyboard to X
sed '/MatchIsKeyboard/a\\tOption "XkbLayout" "fr"' </etc/X11/xorg.conf.d/10-evdev.conf >/etc/X11/xorg.conf.d/10-evdev.conf.new
mv -f /etc/X11/xorg.conf.d/10-evdev.conf.new /etc/X11/xorg.conf.d/10-evdev.conf
# Add new daemons, remove old ones, disable hwclock and remove netfs since I don't use it. add it if you need it
sed '/DAEMONS=/c\DAEMONS=(!hwclock dbus syslog-ng networkmanager laptop-mode acpid @alsa @cupsd @cpufrequtils ntpd crond)' </etc/rc.conf >/etc/rc.conf.new
mv -f /etc/rc.conf.new /etc/rc.conf
# Slim login manager ; change theme
mv /usr/share/slim/themes/archlinux-darch-grey /tmp/
mv /usr/share/slim/themes/default /tmp/
rm -r /usr/share/slim/themes/*
mv /tmp/archlinux-darch-grey /usr/share/slim/themes
mv /tmp/default /usr/share/slim/themes
sed '/^current_theme/c\current_theme archlinux-darch-grey' </etc/slim.conf >/etc/slim.conf
# XFCE login, and thunar launched as a daemon (note that the part with 'if [ -d /etc/X11/xinit/xinitrc.d ]" is not present, to avoid mounting problems when logged as regular user)
cat > /home/$var_username/.xinitrc << EOF
#!/bin/sh
# ~/.xinitrc
# Executed by startx (run your window manager from here)
exec ck-launch-session startxfce4
thunar --daemon &
EOF
chown $var_username:users /home/$var_username/.xinitrc
# Boot to runlevel 5 now, and run slim then
sed -e 's/id:3/#id:3/' -e 's/#id:5/id:5/' -e 's|x:5:respawn:/usr/bin/xdm|#x:5:respawn:/usr/bin/xdm|' -e 's|#x:5:respawn:/usr/bin/slim|x:5:respawn:/usr/bin/slim|' </etc/inittab >/etc/inittab.new
mv -f /etc/inittab.new /etc/inittab
# Add colored prompt to user and root
sed '/^PS1/c\' </etc/skel/.bashrc >/root/.bashrc
cat >> /root/.bashrc << EOF
PS1='\[\e[0;32m\]\u@\h\[\e[m\] \[\e[0;35m\]\w\[\e[m\] \[\e[m\] \[\e[0;32m\]\t -\[\e[m\] \[\e[1;31m\]\$ \[\e[m\] '
EOF
cp /root/.bashrc /home/$var_username/.bashrc
chown $var_username:users /home/$var_username/.bashrc
# How does one do that automatically ?
# Manually add user to sudoers
EDITOR="vim" visudo
# Reboot, because it's quick and I'm too lazy to learn how to start all the daemons and others.
reboot
The important part of the script to solve the problem is :
cat > /home/$var_username/.xinitrc << EOF
#!/bin/sh
# ~/.xinitrc
# Executed by startx (run your window manager from here)
exec ck-launch-session startxfce4
thunar --daemon &
EOF
chown $var_username:users /home/$var_username/.xinitrc
Maybe you are looking for
-
PS 2013 - Autofilter in SQL Reporting Services Reports
Hi, Is it possible to have an autofilter option on the columns of a Reporting Services table in BI? I am using Project Server 2013 and Reporting Services 2013. Thank you. Best regards, Ricardo Segawa - Segawas Projetos / Microsoft Partner
-
How to do validation on multi record block at run time...
Dear Friends, I have to do validation at run time on multi record block. If user tries to enter and save two or more records in same multi record block with same data at run time, it should not allow it and display a message like, " error : Records a
-
Calling secured web service, cross domain security
Hey all, I am trying to call a secured service, for which i need to enable cross domain security. I have followed the steps described in http://download.oracle.com/docs/cd/E15523_01/web.1111/e13707/domain.htm#i1176046 i.e. enabling trust between webl
-
Hi, I renewed my Offline Root CA and now trying to publish the CRL to AD on my Sub Issuing CA with the Certutil -dspublish command, however I get a 'Certutil: A referral was returned from the server' error. Kinda makes sense cause the Offline Root C
-
How to save entries in Cash Journal with status 'Posted'?
Hi all, I has been asked to create entries in a Cash Journal with status 'POSTED'. Obviously, FM 'BAPI_CASHJOURNALDOC_CREATE' only saves entry (status 'SAVED'), but didn't change its status to 'POSTED'. After some investigation of different FM in a C