public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Pandu Poluan <pandu@poluan.info>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] mdev + xorg + Gnome up and running. :-)
Date: Fri, 16 Mar 2012 16:06:34 +0700	[thread overview]
Message-ID: <CAA2qdGUPXYdu6_-8PRe63M9dD6TSihqDTVvnM-TC2h9O+bVfKQ@mail.gmail.com> (raw)
In-Reply-To: <2874264.VOoG3hLo5r@eve>

On Fri, Mar 16, 2012 at 15:41, Joost Roeleveld <joost@antarean.org> wrote:
> On Friday, March 16, 2012 02:54:16 PM Pandu Poluan wrote:
>> What I have in mind for "helper scripts" would be (for example) a
>> script to ensure that, on boot, ethernet devices will maintain their
>> relative order. This needs to be stuck into /etc/mdev.conf (already
>> part of stage3).
>>
>> (And if someone's well-versed enough in Linux, maybe he/she will
>> convert the shellscript into a simple -- and faster -- binary with
>> exact same functionality).
>
> I think you are talking about a script that handles a more "dynamic" database
> to force renames/softlinks for devices keeping names identical?
> I haven't played with mdev yet, but isn't that already in mdev?
> Or does mdev require it to be set manually?
>

Well, to make mdev simple enough for embedded devices (whose devices
always come up in the same order), busybox devs do not include any
database of devices.

However, mdev is perfectly able to execute a program (script or
binary) when it detects a device coming up, and it can choose which
program to execute based on the device name.

Let's say you have two NICs, one will get eth0, the other will get
eth1, depending on the order that the kernel initializes the device
name. For that, you don't have to do a thing.

However, if the devices somehow gets initialized at the same time
(e.g., hotplug events), it's a toss which dev will get which name.

That is why, the busybox devs recommended the "linuxrc" file to
contain the line "mdev -s", which will handle dev initializations
during boot in a sequential fashion, ensuring exact same device names.

> Btw, the "keep same devicename" is rather annoying when having to replace the
> network card and the network then doesn't come back up...
>

There are several scenarios:

Scenario 1: eth1 is replaced, eth0 stays -- if the new card is
initialized after eth0, it will automatically assume eth1. If the new
card is initialized before eth0, it will become the new eth0, and the
previous eth0 will become eth1 automatically.

Scenario 2: eth0 is replaced, eth1 stays -- if the new card is
initialized before eth1, it will automatically assume eth0. If the new
card is initialized after eth1, the previous eth1 gets eth0, while the
new card gets eth1.

The program (script) I'm planning will have a simple 'database'
(actually, a text file) containing pairs of MAC address and devname.
This should ensure that devices with a certain MAC address will
*always* get the same devname, while devices not listed in the
database will get the first available devname.

Thus, in the case where devname swapping would happen (see the second
situation in Scenarios 1 & 2), *at least* the non-replaced device will
get the exact devname as before replacement happens.

Rgds,
-- 
FdS Pandu E Poluan
~ IT Optimizer ~

 • LOPSA Member #15248
 • Blog : http://pepoluan.tumblr.com
 • Linked-In : http://id.linkedin.com/in/pepoluan



  reply	other threads:[~2012-03-16  9:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15  4:17 [gentoo-user] mdev + xorg + Gnome up and running. :-) Alan Mackenzie
2012-03-15  5:44 ` Pandu Poluan
2012-03-16  0:55 ` Walter Dnes
2012-03-16  1:41   ` Pandu Poluan
2012-03-16  7:32     ` Walter Dnes
2012-03-16  7:54       ` Pandu Poluan
2012-03-16  8:41         ` Joost Roeleveld
2012-03-16  9:06           ` Pandu Poluan [this message]
2012-03-16  9:33   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAA2qdGUPXYdu6_-8PRe63M9dD6TSihqDTVvnM-TC2h9O+bVfKQ@mail.gmail.com \
    --to=pandu@poluan.info \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox