LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - Installation
User Name
Password
Slackware - Installation This forum is for the discussion of installation issues with Slackware.

Notices


Reply
  Search this Thread
Old 06-27-2012, 09:46 PM   #1
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,176

Rep: Reputation: 233Reputation: 233Reputation: 233
Headless install -- How to auto detect NIC driver and interface?


Dear folks,

During a headless install, when I setup the network interface, is there a way to not specify the driver and interface?

Since slackware install initrd can automatically detect the NIC, and my headless server has only one interfaec (eth0), it seems unnecessary to write "nic=e1000e:eth0:dhcp:0.0.0.0:255.255.255.255" in the kernel command line.
I hope something like "nic=::dhcp::" should work as well. Is it possible?

Guan
 
Old 06-29-2012, 09:42 AM   #2
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Hi guanx

Use "nic=auto::dhcp"

Eric
 
Old 06-30-2012, 08:45 PM   #3
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,176

Original Poster
Rep: Reputation: 233Reputation: 233Reputation: 233
Hi Eric,

Tested to not work &&
No code found in SeTnet to deal with such kind of "nic=" parameter.

Guan
 
Old 07-01-2012, 06:24 AM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Tell me what does not work.
The SeTnet was designed for such a "nic=auto::dhcp" parameter. Just look more closely at it, and /etc/rc.d/rc.S will show you why the driver parameter can not be empty, instead "auto" is used as a "fake" driver name.

Eric

Eric
 
Old 07-01-2012, 12:26 PM   #5
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,176

Original Poster
Rep: Reputation: 233Reputation: 233Reputation: 233
Hi Eric,
Quote:
Originally Posted by Alien Bob View Post
Tell me what does not work.
I have decsribed in details in this thread:
http://www.linuxquestions.org/questi...cp-4175413753/
but of course I should provide more details here.
Quote:
Originally Posted by Alien Bob View Post
The SeTnet was designed for such a "nic=auto::dhcp" parameter. Just look more closely at it, and /etc/rc.d/rc.S will show you why the driver parameter can not be empty, instead "auto" is used as a "fake" driver name.
I am unable to look into the details at present (travelling). But attached are some files for your information:

"slack_auto.log" -- Screen log of boot process with "nic=auto::dhcp"
"slack_dhcp.log" -- Screen log of boot process with "nic=e1000:eth0:dhcp:0.0.0.0:255.255.255.255"
"bbsplay.py" -- Program to play the screen logs above

Qemu was started with the following command:
Code:
qemu-system-i386 -m 256 \
    -boot n \
    -tftp $HOME/qemu/tftpboot_slack \
    -bootp /pxelinux.0 \
    -net nic,model=e1000 \
    -net user \
    -curses
Guan
Attached Files
File Type: log slack_auto.log (115.6 KB, 25 views)
File Type: log slack_dhcp.log (121.9 KB, 22 views)
File Type: txt bbsplay.py.txt (1.2 KB, 26 views)
 
Old 07-01-2012, 05:03 PM   #6
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Yes I remember again why the interface could not be empty... in order to support autoconfiguration the script checks for the INTERFACE in case one was passed through the "nic=" parameter. Empty values are not accepted.

I will see what I can do about that. It would be nice to allow an empty value for INTERFACE with dhcp, or at least to accept something like "auto" as I also did with the DRIVER.

By the way, interesting playback of the boot sequence. How were those log files recorded?

Eric
 
Old 07-01-2012, 07:29 PM   #7
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,176

Original Poster
Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by Alien Bob View Post
...
By the way, interesting playback of the boot sequence. How were those log files recorded?
Using this program (attached).

Guan
Attached Files
File Type: txt bbsrec.py.txt (2.5 KB, 26 views)
 
Old 07-02-2012, 05:11 PM   #8
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Perhaps you can try this patch which allows "auto" to be specified as the interface name (like "auto" is also allowed for the driver name).
One caveat is that using "auto" requires that the DHCP client has finished polling the DHCP server and written a configuration file to /etc/dhcpc/ . I had to add 3 seconds of sleep time in case INTERFACE="auto" or else the script would run to soon.

Code:
diff -uar initrd64_20120701/usr/lib/setup/SeTnet initrd64_20120701_fixed/usr/lib/setup/SeTnet
--- initrd64_20120701/usr/lib/setup/SeTnet      2012-07-01 23:32:34.561573394 +0200
+++ initrd64_20120701_fixed/usr/lib/setup/SeTnet        2012-07-02 23:33:04.774861455 +0200
@@ -96,6 +96,7 @@
 # We need an interface:
 if [ `cat /proc/net/dev | grep ':' | sed -e "s/^ *//" | cut -f1 -d: | grep -v lo | wc -l` = 0 ]; then
   if [ "x${DRIVER}" != "x" ]; then
+    # This takes silent care of 'DRIVER=auto' as well...
     modprobe ${DRIVER} 1>/dev/null 2>/dev/null
   else
     while [ 0 ]; do
@@ -129,7 +130,15 @@
 fi
 
 # If we obtained information from a DHCP server, use it:
-if [ "x$INTERFACE" = "x" ]; then # the cmdline did not provide a nic
+if [ "x$INTERFACE" = "x" -o "$INTERFACE" = "auto" ]; then
+ # the cmdline did not provide a nic or it's "auto" to let dhcpcd find out:
+ if [ "$INTERFACE" = "auto" ]; then
+  # hope that 3 seconds is enough for dhcpcd;
+  # if not then you had better specify the INTERFACE in the nic= parameter...
+  dialog --title "INITIALIZING NETWORK" --infobox \
+   "\nWaiting a few seconds for DHCP polling to settle ..." 5 56
+  sleep 3
+ fi
  for I_I in \
   $(cat /proc/net/dev | grep ':' | sed -e "s/^ *//" | cut -f1 -d: | grep -v lo) ;
  do
@@ -139,6 +148,9 @@
   fi
  done
  unset I_I
+ if [ "$INTERFACE" = "auto" ]; then  # failed to find a configured interface
+  INTERFACE=""
+ fi
 fi
 
 while [ 0 ]; do
Eric
 
Old 07-02-2012, 10:54 PM   #9
guanx
Senior Member
 
Registered: Dec 2008
Posts: 1,176

Original Poster
Rep: Reputation: 233Reputation: 233Reputation: 233
Works fine in my qemu environment with "nic=auto:auto:dhcp".
Real world dhcp servers not checked.
 
Old 07-03-2012, 10:23 AM   #10
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by guanx View Post
Works fine in my qemu environment with "nic=auto:auto:dhcp".
Real world dhcp servers not checked.
I checked only with my own real-world DHCP server and used my laptop to PXE boot. Did not bother with a QEMU script ;-)

Eric
 
  


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
Detect which module/driver a network interface use. cshong Programming 4 12-29-2010 11:02 PM
Detect Centos NIC driver module andersb Linux - Kernel 2 12-28-2010 06:21 AM
NIC/driver issue - eth0: ERROR while getting interface flags: No such device Beck22 Linux - Networking 4 01-17-2009 12:14 PM
How to install NIC driver and will be auto detect when system boot up. hocheetiong Linux - Newbie 1 01-29-2008 07:43 PM
auto-load nic driver on boot? (slack) nadroj Linux - Newbie 5 04-24-2005 08:42 PM

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

All times are GMT -5. The time now is 02:55 PM.

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