udev not running new rules
I am using Debian Etch.
I have the directory in /etc/udev/rules.d
lrwxrwxrwx 1 root root 20 2007-06-19 16:52 020_permissions.rules -> ../permissions.rules
lrwxrwxrwx 1 root root 13 2007-06-19 16:52 udev.rules -> ../udev.rules
-rwxr-xr-x 1 root root 138 2007-07-29 14:28 z19_persistent-anet.rules
lrwxrwxrwx 1 root root 25 2007-06-19 16:52 z20_persistent-input.rules -> ../persistent-input.rules
lrwxrwxrwx 1 root root 19 2007-06-19 16:52 z20_persistent.rules -> ../persistent.rules
-rw-r--r-- 1 root root 1070 2007-06-19 17:09 z25_persistent-cd.rules
lrwxrwxrwx 1 root root 23 2007-06-26 00:57 z25_persistent-net.rules -> ../persistent-net.rules lrwxrwxrwx 1 root root 12 2007-06-19 16:52 z50_run.rules -> ../run.rules lrwxrwxrwx 1 root root 16 2007-06-19 16:52 z55_hotplug.rules -> ../hotplug.rules lrwxrwxrwx 1 root root 29 2007-06-19 16:52 z75_cd-aliases-generator.rules -> ../cd-aliases-generator.rules
Initially, the file ../persistent-net.rules does not exist.
The rule z19_persistent-anet.rules is:
PROGRAM="/var/www/lib/produce_persistent_rules.pl"
The object of the program is to rename one of the NICs, and simply produces a rule SUBSYSTEMS="pci", KERNELS="0000:09:01.0", NAME="ctl"
It runs a Perl program that creates the file ../persistent-net.rules.
After a reboot, the file is created, but udev claims that it doesn't exist.
After a second reboot, udev manages to read the file successfully.
Killing udev and restarting doesn't help.
It seems that udev firstly checks which files exist. How can I get the new rule set to be run as soon as it is created?
Thanks,
Peter
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 1 line · Peter Gordon
Killing udev and restarting doesn't help.
I just do not believe this.
Quoted 1 line
It seems that udev firstly checks which files exist. How can I get the new rule set to be run as soon as it is created?
No, it does not. Do not use a symlink.
Signature · 2 lines
ciao, Marco
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 27 lines · Peter Gordon
I am using Debian Etch.
I have the directory in
/etc/udev/rules.dlrwxrwxrwx 1 root root 20 2007-06-19 16:52 020_permissions.rules -> ../permissions.rules
lrwxrwxrwx 1 root root 13 2007-06-19 16:52 udev.rules -> ../udev.rules
-rwxr-xr-x 1 root root 138 2007-07-29 14:28 z19_persistent-anet.rules
lrwxrwxrwx 1 root root 25 2007-06-19 16:52 z20_persistent-input.rules -> ../persistent-input.rules
lrwxrwxrwx 1 root root 19 2007-06-19 16:52 z20_persistent.rules -> ../persistent.rules
-rw-r--r-- 1 root root 1070 2007-06-19 17:09 z25_persistent-cd.ruleslrwxrwxrwx 1 root root 23 2007-06-26 00:57 z25_persistent-net.rules -> ../persistent-net.rules lrwxrwxrwx 1 root root 12 2007-06-19 16:52 z50_run.rules -> ../run.rules lrwxrwxrwx 1 root root 16 2007-06-19 16:52 z55_hotplug.rules -> ../hotplug.rules lrwxrwxrwx 1 root root 29 2007-06-19 16:52 z75_cd-aliases-generator.rules -> ../cd-aliases-generator.rulesInitially, the file ../persistent-net.rules does not exist.
The rule z19_persistent-anet.rules is:
PROGRAM="/var/www/lib/produce_persistent_rules.pl"
The object of the program is to rename one of the NICs, and simply produces a rule SUBSYSTEMS="pci", KERNELS="0000:09:01.0", NAME="ctl"
It runs a Perl program that creates the file ../persistent-net.rules.
Quoted 7 lines
After a reboot, the file is created, but udev claims that it doesn't exist.
After a second reboot, udev manages to read the file successfully.
Killing udev and restarting doesn't help.
It seems that udev firstly checks which files exist. How can I get the new rule set to be run as soon as it is created?
Rules are just matches/actions for events. Adding or removing rules does nothing to any already existent device. Only the next event would be processed with the new rules. Does that explain your problem?
Kay
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 32 lines · Kay Sievers
Quoted 31 lines · Peter Gordon
I am using Debian Etch.
I have the directory in
/etc/udev/rules.dlrwxrwxrwx 1 root root 20 2007-06-19 16:52 020_permissions.rules -> ../permissions.rules
lrwxrwxrwx 1 root root 13 2007-06-19 16:52 udev.rules -> ../udev.rules
-rwxr-xr-x 1 root root 138 2007-07-29 14:28 z19_persistent-anet.rules
lrwxrwxrwx 1 root root 25 2007-06-19 16:52 z20_persistent-input.rules -> ../persistent-input.rules
lrwxrwxrwx 1 root root 19 2007-06-19 16:52 z20_persistent.rules -> ../persistent.rules
-rw-r--r-- 1 root root 1070 2007-06-19 17:09 z25_persistent-cd.ruleslrwxrwxrwx 1 root root 23 2007-06-26 00:57 z25_persistent-net.rules -> ../persistent-net.rules lrwxrwxrwx 1 root root 12 2007-06-19 16:52 z50_run.rules -> ../run.rules lrwxrwxrwx 1 root root 16 2007-06-19 16:52 z55_hotplug.rules -> ../hotplug.rules lrwxrwxrwx 1 root root 29 2007-06-19 16:52 z75_cd-aliases-generator.rules -> ../cd-aliases-generator.rulesInitially, the file ../persistent-net.rules does not exist.
The rule z19_persistent-anet.rules is:
PROGRAM="/var/www/lib/produce_persistent_rules.pl"
The object of the program is to rename one of the NICs, and simply produces a rule SUBSYSTEMS="pci", KERNELS="0000:09:01.0", NAME="ctl"
It runs a Perl program that creates the file ../persistent-net.rules.
After a reboot, the file is created, but udev claims that it doesn't exist.
After a second reboot, udev manages to read the file successfully.
Quoted 8 lines
Quoted 3 lines
Killing udev and restarting doesn't help.
It seems that udev firstly checks which files exist. How can I get the new rule set to be run as soon as it is created?
Rules are just matches/actions for events. Adding or removing rules does nothing to any already existent device. Only the next event would be processed with the new rules. Does that explain your problem?
I have deleted the soft link as suggested by Marco d'Itri and it didn't help.
I understand about the already existing device.
If the event for a NIC occurs really early in the udev sequence, it would seem that the z19_persistent-anet.rules is being run after the NIC was created.
I moved z19_persistent-anet.rules to 000z19_persistent-anet.rules to force it to be the first rule.
It still creates the file, but doesn't manage to use the file until the following reboot.
So I still don't have a handle on the problem. What would be the best way to get debugging output?
Regards,
Peter
Quoted 1 line
Kay
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 51 lines · Peter Gordon
Quoted 32 lines · Kay Sievers
Quoted 31 lines · Peter Gordon
I am using Debian Etch.
I have the directory in
/etc/udev/rules.dlrwxrwxrwx 1 root root 20 2007-06-19 16:52 020_permissions.rules -> ../permissions.rules
lrwxrwxrwx 1 root root 13 2007-06-19 16:52 udev.rules -> ../udev.rules
-rwxr-xr-x 1 root root 138 2007-07-29 14:28 z19_persistent-anet.rules
lrwxrwxrwx 1 root root 25 2007-06-19 16:52 z20_persistent-input.rules -> ../persistent-input.rules
lrwxrwxrwx 1 root root 19 2007-06-19 16:52 z20_persistent.rules -> ../persistent.rules
-rw-r--r-- 1 root root 1070 2007-06-19 17:09 z25_persistent-cd.ruleslrwxrwxrwx 1 root root 23 2007-06-26 00:57 z25_persistent-net.rules -> ../persistent-net.rules lrwxrwxrwx 1 root root 12 2007-06-19 16:52 z50_run.rules -> ../run.rules lrwxrwxrwx 1 root root 16 2007-06-19 16:52 z55_hotplug.rules -> ../hotplug.rules lrwxrwxrwx 1 root root 29 2007-06-19 16:52 z75_cd-aliases-generator.rules -> ../cd-aliases-generator.rulesInitially, the file ../persistent-net.rules does not exist.
The rule z19_persistent-anet.rules is:
PROGRAM="/var/www/lib/produce_persistent_rules.pl"
The object of the program is to rename one of the NICs, and simply produces a rule SUBSYSTEMS="pci", KERNELS="0000:09:01.0", NAME="ctl"
It runs a Perl program that creates the file ../persistent-net.rules.
After a reboot, the file is created, but udev claims that it doesn't exist.
After a second reboot, udev manages to read the file successfully.
Quoted 8 lines
Quoted 3 lines
Killing udev and restarting doesn't help.
It seems that udev firstly checks which files exist. How can I get the new rule set to be run as soon as it is created?
Rules are just matches/actions for events. Adding or removing rules does nothing to any already existent device. Only the next event would be processed with the new rules. Does that explain your problem?
I have deleted the soft link as suggested by Marco d'Itri and it didn't help.
I understand about the already existing device.
If the event for a NIC occurs really early in the udev sequence, it would seem that the z19_persistent-anet.rules is being run after the NIC was created.
Quoted 8 lines
I moved z19_persistent-anet.rules to 000z19_persistent-anet.rules to force it to be the first rule.
It still creates the file, but doesn't manage to use the file until the following reboot.
So I still don't have a handle on the problem. What would be the best way to get debugging output?
Do you expect to create a rules file and get that file applied immediately to the running event? That doesn't work, rules are parsed in-memory and only read by the daemon not by the event process.
You need to apply the result of the rule creation in the same event, with the same rule that created the rules file for future events. Just look at the standard solution for persistent network interfaces that comes with udev, which probably just solves your problem anyway, or what do you miss from it?
Kay
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 65 lines · Kay Sievers
Quoted 51 lines · Peter Gordon
Quoted 32 lines · Kay Sievers
Quoted 31 lines · Peter Gordon
I am using Debian Etch.
I have the directory in
/etc/udev/rules.dlrwxrwxrwx 1 root root 20 2007-06-19 16:52 020_permissions.rules -> ../permissions.rules
lrwxrwxrwx 1 root root 13 2007-06-19 16:52 udev.rules -> ../udev.rules
-rwxr-xr-x 1 root root 138 2007-07-29 14:28 z19_persistent-anet.rules
lrwxrwxrwx 1 root root 25 2007-06-19 16:52 z20_persistent-input.rules -> ../persistent-input.rules
lrwxrwxrwx 1 root root 19 2007-06-19 16:52 z20_persistent.rules -> ../persistent.rules
-rw-r--r-- 1 root root 1070 2007-06-19 17:09 z25_persistent-cd.ruleslrwxrwxrwx 1 root root 23 2007-06-26 00:57 z25_persistent-net.rules -> ../persistent-net.rules lrwxrwxrwx 1 root root 12 2007-06-19 16:52 z50_run.rules -> ../run.rules lrwxrwxrwx 1 root root 16 2007-06-19 16:52 z55_hotplug.rules -> ../hotplug.rules lrwxrwxrwx 1 root root 29 2007-06-19 16:52 z75_cd-aliases-generator.rules -> ../cd-aliases-generator.rulesInitially, the file ../persistent-net.rules does not exist.
The rule z19_persistent-anet.rules is:
PROGRAM="/var/www/lib/produce_persistent_rules.pl"
The object of the program is to rename one of the NICs, and simply produces a rule SUBSYSTEMS="pci", KERNELS="0000:09:01.0", NAME="ctl"
It runs a Perl program that creates the file ../persistent-net.rules.
After a reboot, the file is created, but udev claims that it doesn't exist.
After a second reboot, udev manages to read the file successfully.
Quoted 8 lines
Quoted 3 lines
Killing udev and restarting doesn't help.
It seems that udev firstly checks which files exist. How can I get the new rule set to be run as soon as it is created?
Rules are just matches/actions for events. Adding or removing rules does nothing to any already existent device. Only the next event would be processed with the new rules. Does that explain your problem?
I have deleted the soft link as suggested by Marco d'Itri and it didn't help.
I understand about the already existing device.
If the event for a NIC occurs really early in the udev sequence, it would seem that the z19_persistent-anet.rules is being run after the NIC was created.
Quoted 8 lines
I moved z19_persistent-anet.rules to 000z19_persistent-anet.rules to force it to be the first rule.
It still creates the file, but doesn't manage to use the file until the following reboot.
So I still don't have a handle on the problem. What would be the best way to get debugging output?
Do you expect to create a rules file and get that file applied immediately to the running event? That doesn't work, rules are parsed in-memory and only read by the daemon not by the event process.
Quoted 6 lines
You need to apply the result of the rule creation in the same event, with the same rule that created the rules file for future events. Just look at the standard solution for persistent network interfaces that comes with udev, which probably just solves your problem anyway, or what do you miss from it?
My problem is this. I need to create the rules file at boot up since the devices available may change from boot to boot, and the PCI addresses are not guaranteed to be the same.
So I need to create the rules file and then get those rules run.
I had a look at the persistent network interfaces but I can't see how that helps, since the rules are already extant.
Peter
Quoted 2 lines
Kay
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines · Peter Gordon
Quoted 10 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
The rule z19_persistent-anet.rules is:
PROGRAM="/var/www/lib/produce_persistent_rules.pl"
The object of the program is to rename one of the NICs, and simply
produces a rule
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
SUBSYSTEMS="pci", KERNELS="0000:09:01.0", NAME="ctl"
It runs a Perl program that creates the file
../persistent-net.rules.
Quoted 5 lines · Kay Siever
Quoted 5 lines
You need to apply the result of the rule creation in the same event, with the same rule that created the rules file for future events. Just look at the standard solution for persistent network interfaces that comes with udev, which probably just solves your problem anyway, or what do you miss from it?
Quoted 8 lines · Peter Gordon
My problem is this. I need to create the rules file at boot up since the devices available may change from boot to boot, and the PCI addresses are not guaranteed to be the same.
So I need to create the rules file and then get those rules run.
I had a look at the persistent network interfaces but I can't see how that helps, since the rules are already extant.
What does your perl program DO to get the info to write into the new rules file? It obviously somehow knows it needs to write "SUBSYSTEMS="pci", KERNELS="0000:09:01.0"" into the file.
Rather than writing that to a file, USE it to name the device.
Have it spit the PCI slot info into an environment variable the way the other persistent rules do then use that var in the naming rule.
Now, I HONESTLY don't know if an environment variable can be used on the right side of an "=" but what I've typed below looks reasonable if it can.
If I'm way off base I'm sure the fine folks on this list will explain a more proper way to use an ENV{VAR} that your perl program has made available. I'm not trying to write the rule, just point in the right direction.
SUBSYSTEMS="pci", KERNELS=ENV{CTLCARD}, NAME="ctl"
If ENV{CTLCARD} can't be used to the right of = then you have to think about what your perl program is using to identify the correct card and use THAT in the rule:
SUBSYSTEMS="pci" ENV{IDENT}={what perl uses to find the card}, NAME="ctl"
You have to find a way to make your perl program write identifying info for all of the cards into the environment the way scsi_id writes drive serial numbers into the environment, then use something from that list to grab the right card. You may have to poke around in the scsi_id source and write something similar for your NIC problem.
All rules are read into memory when udev loads at boot time then never again. Run udevtest against a device to see it in action.
Gerald
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
Minor quibble:
Quoted 2 lines · Gerald V. Livingston II
All rules are read into memory when udev loads at boot time then never again.
Unless your system has support for inotify. Then udevd uses inotify to wait for a rules-file to change, and reloads it. Or at least, that's what it used to do, and I doubt that something as useful as that would have gotten removed.
(That's why having symlinks in the rules.d directory isn't good: udevd can't watch the targets of the links, just the links themselves.) -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGwDvZS5vET1Wea5wRA78CAJ9612UwlfPZZvTVbYXUiNtyLe/rUQCfY4Fk MzhLliKXbdzUEJBkv1rKYic=oWnl
-----END PGP SIGNATURE-----
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines · Bryan Kadzban
Minor quibble:
Quoted 2 lines · Gerald V. Livingston II
All rules are read into memory when udev loads at boot time then never again.
Unless your system has support for inotify. Then udevd uses inotify to wait for a rules-file to change, and reloads it. Or at least, that's what it used to do, and I doubt that something as useful as that would have gotten removed.
Sure, that still works, rules are watched for changes. But only for events which are not already running, only new events will see the new rules. If you write out a new rule/file, the events that are currently running will not include the new rules.
Kay
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel