[SOLVED] Headless install -- How to auto detect NIC driver and interface?
Slackware - InstallationThis forum is for the discussion of installation issues with Slackware.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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
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?
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.