LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-10-2011, 08:34 AM   #1
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Rep: Reputation: 68
Udev messes up network rules


Hi all,

I use Slackware 13.37 (but I had this problem with previous versions). I set specific names for my network cards on servers (usually eth0 and eth1) using /etc/udev/rules.d/70-persistent-net.rules. Then on next reboot, udev comes along and makes a mess of the file. Usually deletes both rules I've set and adds an eth2, or switches eth0 to eth1 and so on. I don't understand what's going on.

According the the Slack 13.37 Changes and Hints document:

Quote:
As with 13.1, the system udev rules now reside in /lib/udev/rules.d/ instead
of /etc/udev/rules.d/ in older versions. There should never be a reason
to edit anything in /lib/udev/rules.d/, so if you think you have a case
where this is required, either you're wrong or it needs to be addressed in
the upstream source. However, you can override default rules by placing
one with an identical name inside /etc/udev/rules.d/ The rules files in
/etc/udev/rules.d/ are still intended to (maybe) be edited as needed by
local system administrators, and as such, the rules for optical and network
devices will still be placed there.
According to the above, I should be OK to edit the network rules. Why would udev decide to change things - when I have both interfaces listed using their MAC addresses already? Where am I going wrong? I want my interfaces to be named as I decide, not what udev finds convenient. I've been locked out of servers because of interfaces suddenly jumping around on next reboot. Sometimes I have to re-edit the file about 4 times (and reboot in between) until udev finally gives up on interfering.

Thanks for any tips.
 
Old 10-10-2011, 09:18 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
When I saw this, I needed to specify the interfaces in the order eth0, then eth1, then eth2 in /etc/udev/rules.d/70-persistent-net.rules.
 
Old 10-10-2011, 01:11 PM   #3
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Original Poster
Rep: Reputation: 68
Thanks allend. I will try specifying them in order next time. It is possible that is the reason udev is re-writing the rule file. It still seems silly to me - if there is a corresponding rule in there somewhere, it should just move on and leave the file alone - in my opinion.
 
Old 10-11-2011, 02:21 AM   #4
zeroberto
Member
 
Registered: Aug 2008
Location: Serbia
Posts: 44

Rep: Reputation: 1
Delete the /lib/udev/rules.d/75-persistent-net-generator.rules, and it won't rewrite the rules anymore.
 
Old 10-11-2011, 06:48 AM   #5
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750Reputation: 2750
Quote:
Delete the /lib/udev/rules.d/75-persistent-net-generator.rules, and it won't rewrite the rules anymore.
I would not advocate subverting the udev system. What if you want to add/remove or change a network interface?
 
Old 10-11-2011, 09:04 AM   #6
the3dfxdude
Member
 
Registered: May 2007
Posts: 730

Rep: Reputation: 358Reputation: 358Reputation: 358Reputation: 358
Quote:
Originally Posted by allend View Post
I would not advocate subverting the udev system. What if you want to add/remove or change a network interface?
Then you add/remove or change a network interface. You don't need udev to do it. And yes, it's completely possible to get them in the right order still. There was a time that udev wasn't around to manage devices. And when udev breaks, even when you are not adding/removing or changing your network setup, then it's just getting in the way-- and I've had that happen just like the original poster.
 
Old 10-11-2011, 03:53 PM   #7
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Original Poster
Rep: Reputation: 68
I was thinking along the same lines. The kernel *will* give names to eth* devices anyway, isn't it? So it's not like they can't exist without udev. In the case of servers, where I want full control over which eth* interface gets what name, it sounds to me like deleting the 75-persistent-net-generator.rules files is just what's required.

Even further than that, I would suggest that the udev rule generator should have never been designed to mess about with a device which already has a naming rule in place. If something is already named, that means somebody (or a piece of software) put it there - it should not be deleted. It reminds of the days I use to work (more) with Windows, when it was damn near impossible to get the system to do what one *actually* wanted it to do. It always seemed to second guess (badly) what was wanted or required.
 
Old 10-11-2011, 06:19 PM   #8
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Original Poster
Rep: Reputation: 68
I have just run some more tests on this server. After about 10 reboots, I pretty much never ended up with an identical /etc/udev/rules.d/70-persistent-net.rules file from one reboot to another. This is utterly ridiculous. This server has two eth* cards and one wlan* adapter. After one reboot the file lists eth2 and wlan0 only, after next reboot only eth1 and nothing else, after another reboot eth1 and wlan0. It just goes on and on. I could never reboot my servers remotely fearing udev will start playing with my network cards naming scheme again and screw things up.

If this is how udev was meant to work - I don't have many good things to say about it. I want a system where *I* do the settings - not some little goblin in the OS. If I wanted a babysitter - I would have returned to the OS Full of Buttons (tm). I am really puzzled as to the thinking behind the udev re-write rules. I would have accepted some scripts that generate rules files *only* the first time a device is detected - letting me change them as I please later, and *not* interfering ever again, unless it detects a device which doesn't have a naming rule in place. But to re-generate the rules on every-single reboot - risking that the order and naming keeps on changing every time - that's not what I would call a recipe for grown up computing.

Well, rant over for now. The rule generator in /lib/udev/rules.d for net devices is on its way to hell and is not going to get its slimy paws on my systems again.
 
Old 10-11-2011, 07:53 PM   #9
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Did any of you submit a bug report?
 
Old 10-12-2011, 03:07 AM   #10
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Original Poster
Rep: Reputation: 68
I am happy to submit a bug report. I only posted here first to make sure it's not something silly that I'm doing. I'd rather not waste developers' time just to find out that I'm not using a piece of software the way it's meant to be used - if I can help it.

Also - does anybody know where the bug report should be submitted - to Slackware or to udev? Is the udev rule re-generator the creation of Slackware packagers, or comes straight upstream from udev?
 
Old 10-12-2011, 08:37 AM   #11
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

You should read the paragraph following the one you posted in OP;
Quote:
Speaking of udev, pay particular attention to 70-persistent-net.rules and
70-persistent-cd.rules in /etc/udev/rules.d/ -- these two are automatically
generated by the system. If you remove, add, and/or replace some hardware
(specifically network cards and/or optical drives) in a machine, you will
probably need to edit one or both of the rules files mentioned above.
I do agree that '/etc/udev/rules.d/70-persistent-net.rules' should allow for changes or additions without deleting current configs. Possibly flag the changes or modify allow query to admin. Shuffle a copy to revert or some safe guards. Depth of rules should be up to the local admin not a closed config script (/lib/udev/rules.d/75-persistent-net-generator.rules).

If you follow the rules suggestions within some of the scripts you will find that 90-network.rules states;
Quote:
Please put your
# custom rules somewhere else (90-local.rules is a good idea)
The option for custom rule is there by providing 90-local.rules within '/etc/udev/rules.d'.

I believe the above quote from 'CHANGES_AND_HINTS.TXT' is a valid alert and everyone should realize the configuration changes can be made by the admin instead of providing a rule.

The depth of control or configuration can be had for '/lib/udev/rules.d/75-persistent-net-generator.rules' but at what expense?
 
Old 10-12-2011, 08:58 AM   #12
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Original Poster
Rep: Reputation: 68
The paragraph that you posted:

Quote:
Speaking of udev, pay particular attention to 70-persistent-net.rules and
70-persistent-cd.rules in /etc/udev/rules.d/ -- these two are automatically
generated by the system. If you remove, add, and/or replace some hardware
(specifically network cards and/or optical drives) in a machine, you will
probably need to edit one or both of the rules files mentioned above.
would seem to suggest that it is ok to edit any of the two files. That seems misleading and confusing - as both files get overwritten on reboots. It actually should read "there is no point in editing any of the two files, as your changes will most likely be lost on next reboot".
 
Old 10-12-2011, 12:57 PM   #13
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Then the option for custom rule is there by providing rule(s) in 90-local.rules within '/etc/udev/rules.d'. This will allow admin to control the installed system devices.

Trace through the scripts and you will see this option.

Last edited by onebuck; 10-12-2011 at 09:29 PM. Reason: typo
 
Old 10-18-2011, 05:45 PM   #14
xj25vm
Member
 
Registered: Jun 2008
Posts: 393

Original Poster
Rep: Reputation: 68
Hi have done some more research and testing into this. Disabling the udev rule generator does not actually solve the problem. Every few reboots, when the modules for my wired network interfaces get loaded in a different order by the kernel, the boot process hangs for about 50 to 60 seconds, after which I get the error message:

Quote:
[udev] error changing eth0 name to eth1: File exists
It looks like the kernel gives names to interfaces first, and then udev is incapable of changing these names if the name wanted already exists. Then I wonder what is the point of a software like udev, if it can't deal with a name being in use? It should be able to rename the interface which is already using the name I am after automatically to next available name, and use the name just freed (which is the name I want) for the interface I tell it to.

So udev can rename your interface, as long as it doesn't step on the toes of what the kernel chose in the first place. Marvelous capability that!

I found lots of other people from various distributions with servers with multiple interfaces complaining of this bug online. Every few reboots and udev is either re-writing the network rule, or, if set to static rules, hangs the computer has it can't finish the renaming process according to the rule in place. It is even more annoying, as it is somewhat random, depending on which order the kernel is detecting the interfaces during boot - which can't be predicted. I don't know yet if there is a fix for this bug - as all bug reports I found (mainly on distributions bug reporting systems) were closed without an actual resolution. I'll keep on looking.

If anybody else has info on this or is experiencing this bug - please post here.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
correcting udev network persistent-net rules Skaperen Linux - Networking 2 09-19-2011 04:11 PM
Slack 13.1 : /etc/udev/rules.d70-persistent-net.rules Ramurd Slackware 10 02-18-2011 09:56 AM
udev ignores network rules on Fedora 11 barth84 Linux - Networking 5 11-16-2009 02:10 AM
cat: /etc/udev/rules.d/70-persistent-net.rules: No such file or directory rcg1984 Linux From Scratch 2 09-17-2008 07:02 AM
slackware-current, udev 0.96, and custom udev rules not working rignes Slackware 6 08-10-2006 03:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration