Skip to contentSkip to conversation

Make rule generator switchable

PATCH Matthias Schwarzott 4 participants 9 messages Jul 27, 2007 – Aug 2, 2007

lore
Share & tools
lore
#0 lore raw

Hi there!

I thought about making rule generator/persistent-net user switchable. As this was not possible yet, I implemented one possibility. This reads udev.conf from write_(cd|net)_rules and aborts if there is:
persistent_cd_generator="disabled"

Is there a better method to do this? If not, how about including this, and perhaps commented out part for config file.

#Disable generation of persistent-rules for cd devices #persistent_cd_generator="disabled"

# Disable generation of persistent-rules for network devices #persistent_net_generator="disabled"

Matthias

Signature · 1 line
Matthias Schwarzott (zzam)
extras/rule_generator/write_cd_rules +5 -0
index bd951c5..21b48e9 100644
@@ -14,6 +14,11 @@
 RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules"
 
 . /lib/udev/rule_generator.functions
+[ -r /etc/udev/udev.conf ] && . /etc/udev/udev.conf
+
+if [ "$persistent_cd_generator" = "disabled" ]; then
+	exit 1
+fi
 
 find_next_available() {
 	raw_find_next_available "$(find_all_rules 'SYMLINK+=' $1)"
extras/rule_generator/write_net_rules +5 -0
index b873b5b..37c0130 100644
@@ -19,6 +19,11 @@
 RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules'
 
 . /lib/udev/rule_generator.functions
+[ -r /etc/udev/udev.conf ] && . /etc/udev/udev.conf
+
+if [ "$persistent_net_generator" = "disabled" ]; then
+	exit 1
+fi
 
 interface_name_taken() {
 	local value="$(find_all_rules 'NAME=' $INTERFACE)"

-------------------------------------------------------------------------
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

#1 lore raw
Quoted 7 lines · Matthias Schwarzott

Hi there!

I thought about making rule generator/persistent-net user switchable. As this was not possible yet, I implemented one possibility. This reads udev.conf from write_(cd|net)_rules and aborts if there is:
persistent_cd_generator="disabled"

Quoted 8 lines

Is there a better method to do this? If not, how about including this, and perhaps commented out part for config file.

#Disable generation of persistent-rules for cd devices #persistent_cd_generator="disabled"

# Disable generation of persistent-rules for network devices #persistent_net_generator="disabled"

Just don't install the rules then? Why would you want to run the scripts at all, if you don't need them?

How should todays boxes work without persistent network names? They are as needed as LABEL, UUID, or /dev/disk/ for block devices. The old way of having luck to get the same kernel device names across reboots, just doesn't work today.

Thanks,
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

#2 lore raw
In reply to Matthias Schwarzott
Quoted 4 lines · Kay Sievers

How should todays boxes work without persistent network names? They are as needed as LABEL, UUID, or /dev/disk/ for block devices. The old way of having luck to get the same kernel device names across reboots, just doesn't work today.

The problem with the persistent net rule generator is when it's run - it is never run (at least under Fedora and related distributions) at a time when it's actually able to *write* rules.

Bill

-------------------------------------------------------------------------
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

#3 lore raw
In reply to Matthias Schwarzott
Quoted 9 lines · Bill Nottingham
Quoted 4 lines · Kay Sievers

How should todays boxes work without persistent network names? They are as needed as LABEL, UUID, or /dev/disk/ for block devices. The old way of having luck to get the same kernel device names across reboots, just doesn't work today.

The problem with the persistent net rule generator is when it's run - it is never run (at least under Fedora and related distributions) at a time when it's actually able to *write* rules.

Not a problem, it writes temporary rules to /dev/.udev, you are expected to copy over, if you system does not allow to write to /etc at that time.

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

#4 lore raw
In reply to Matthias Schwarzott
Quoted 2 lines · Kay Sievers

Just don't install the rules then? Why would you want to run the scripts at all, if you don't need them?

Debian uses a symlink because there are some situations where it does not work (the most common one still unsolved is Sun systems with multiple ethernet interfaces having the same MAC address).

Signature · 12 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
#5 lore raw
In reply to Matthias Schwarzott
Quoted 9 lines · you

Just don't install the rules then? Why would you want to run the scripts at all, if you don't need them?

How should todays boxes work without persistent network names? They are as needed as LABEL, UUID, or /dev/disk/ for block devices. The old way of having luck to get the same kernel device names across reboots, just doesn't work today.

A nice situation where it does not work is: xen domains with random mac.
Or: cloning installations that have same hw and just one NIC but as they have different macs persistent-net will fail.

Matthias

Signature · 11 lines
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
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
#6 lore raw
In reply to Matthias Schwarzott
Quoted 7 lines · Marco d'Itri
Quoted 2 lines · Kay Sievers

Just don't install the rules then? Why would you want to run the scripts at all, if you don't need them?

Debian uses a symlink because there are some situations where it does not work (the most common one still unsolved is Sun systems with multiple ethernet interfaces having the same MAC address).

Gentoo does not uses symlinks, but we up to now miss some setup to selectively disable rules.

Other way I thought of was: Adding ENV{DISABLE_PERSISTENT_NET}!="?*" to the rule, and then getting that var into udev. Perhaps injecting it via udevcontrol directly after starting udevd.

Matthias

Signature · 11 lines
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
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
#7 lore raw
In reply to Matthias Schwarzott
Quoted 11 lines · Kay Sievers
Quoted 10 lines · Matthias Schwarzott

Hi there!

I thought about making rule generator/persistent-net user switchable. As this was not possible yet, I implemented one possibility. This reads udev.conf from write_(cd|net)_rules and aborts if there is:
persistent_cd_generator="disabled"

Is there a better method to do this? If not, how about including this, and perhaps commented out part for config file.

Quoted 9 lines
Quoted 5 lines

#Disable generation of persistent-rules for cd devices #persistent_cd_generator="disabled"

# Disable generation of persistent-rules for network devices #persistent_net_generator="disabled"

Just don't install the rules then? Why would you want to run the scripts at all, if you don't need them?

Well, the problem here is:
If you unpack a basic gentoo stage you get an already installed udev. WITH the persistent-net rules.
Should we rely on the user to remove it and always remove it again after update.

Or Add some install time flag to udev package - but package manager portage will not remove the file if already existing for config-protection issues.

I clain: There is no sane way to disable specific rules config-wise. Is there no possibilities to inject some env vars into udev without calling udevcontrol - but perhaps from udev.conf ?

Matthias

Signature · 11 lines
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
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
#8 lore raw
In reply to Matthias Schwarzott
Quoted 21 lines · Matthias Schwarzott
Quoted 11 lines · Kay Sievers
Quoted 10 lines · Matthias Schwarzott

Hi there!

I thought about making rule generator/persistent-net user switchable. As this was not possible yet, I implemented one possibility. This reads udev.conf from write_(cd|net)_rules and aborts if there is:
persistent_cd_generator="disabled"

Is there a better method to do this? If not, how about including this, and perhaps commented out part for config file.

Quoted 9 lines
Quoted 5 lines

#Disable generation of persistent-rules for cd devices #persistent_cd_generator="disabled"

# Disable generation of persistent-rules for network devices #persistent_net_generator="disabled"

Just don't install the rules then? Why would you want to run the scripts at all, if you don't need them?

Quoted 8 lines

Well, the problem here is:
If you unpack a basic gentoo stage you get an already installed udev. WITH the persistent-net rules.
Should we rely on the user to remove it and always remove it again after update.

Or Add some install time flag to udev package - but package manager portage will not remove the file if already existing for config-protection issues.

For RPM you would just create a subpackage, which contain the rules and scripts, which the user can install or remove if needed. Btw, default udev rules are not configuration files. They are not meant to be edited by end users and expected to be replaced by every package update, so installing with a "disable flag" should probably at least rename the existing rules file do disable it.

Quoted 3 lines

I clain: There is no sane way to disable specific rules config-wise. Is there no possibilities to inject some env vars into udev without calling udevcontrol - but perhaps from udev.conf ?

Create a rules file to set these values? If possible, all policy should live in the rules files itself. For the net rules, you could probably just do:
SUBSYSTEM="net", NAME="%k"
to disable the rules generator.

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