Bug#606515: Preseed installation does not wait for network to be ready
Hi, Attached a patch to netcfg that waits for the link to come up before proceeding. It times out after 10 seconds, so if link detection is broken for some reason it doesn't affect the install. -- Yours sincerely, Floris Bos diff -ur netcfg.orig/Makefile netcfg/Makefile --- netcfg.orig/Makefile 2009-10-28 21:37:37.0 +0100 +++ netcfg/Makefile 2010-12-11 20:51:10.362642461 +0100 @@ -26,7 +26,7 @@ all: $(TARGETS) -netcfg-static: netcfg-static.o static.o +netcfg-static: netcfg-static.o static.o ethtool-lite.o netcfg: netcfg.o dhcp.o static.o ethtool-lite.o $(TARGETS): $(COMMON_OBJS) diff -ur netcfg.orig/netcfg.h netcfg/netcfg.h --- netcfg.orig/netcfg.h 2010-09-06 23:53:19.0 +0200 +++ netcfg/netcfg.h 2010-12-11 20:10:50.761351395 +0100 @@ -41,6 +41,9 @@ ff02::1 ip6-allnodes\n \ ff02::2 ip6-allrouters\n +/* Maximum number of seconds to wait for network link to come up */ +#define LINK_TIMEOUT 10 + typedef enum { NOT_ASKED = 30, GO_BACK } response_t; typedef enum { DHCP, STATIC, DUNNO } method_t; typedef enum { ADHOC = 1, MANAGED = 2 } wifimode_t; diff -ur netcfg.orig/static.c netcfg/static.c --- netcfg.orig/static.c 2010-12-11 20:03:12.091975462 +0100 +++ netcfg/static.c 2010-12-11 20:49:30.851349894 +0100 @@ -269,10 +269,10 @@ int netcfg_activate_static(struct debconfclient *client) { -int rv = 0, masksize; +int rv = 0, masksize, tries = 0; char buf[256]; char ptr1[INET_ADDRSTRLEN]; - + #ifdef __GNU__ snprintf(buf, sizeof(buf), settrans -fgap /servers/socket/2 /hurd/pfinet --interface=%s --address=%s, @@ -381,6 +381,16 @@ debconf_capb(client, backup); return -1; } + +di_info(Waiting for the link of interface %s to come up, interface); + +do { +usleep(10); /* sleep a tenth of a second */ +if (++tries LINK_TIMEOUT*10) { +di_info(Link did not come up, but timeout expired, continuing...); +break; +} +} while ( ethtool_lite(interface) == 2 /*DISCONNECTED*/ ); return 0; }
Bug#606515: Preseed installation does not wait for network to be ready
Package: network-preseed Version: 1.41 We are experiencing problems automatically installing Debian Lenny on a number of dedicated servers using PXE and preseed. Our setup works correctly with some hardware configurations, while others give a Failed to retrieve the preconfiguration file error message. If we manually press Continue and tell Debian installer to fetch the preconfiguration file a second time from the menu, installation does work properly. I suspect the reason it does not work the first time is that Debian installer does not bother to wait before the network link is ready, before attempting to fetch the preconfiguration file. When I press alt-F4 and look at the messages it shows: == 23:15:29 main-menu[1624]: INFO: menu item 'network-preseed' selected 23:15:32 kernel: eth0: Link is up 1000 Mbps Full Duplex Flow control: none == So if I understand the messages correctly the network-preseed routine is executed 3 seconds before the link is actually up? We assign a static network configuration to the servers using boot parameters like this: == kernel http://INSTALL-SERVER/main/installer- amd64/current/images/netboot/debian-installer/amd64/linux netcfg/choose_interface=auto debian-installer/locale=en_US kbd- chooser/method=us console-keymaps-at/keymap=us netcfg/disable_dhcp=true netcfg/get_ipaddress=$ip netcfg/get_netmask=$netmask netcfg/get_gateway=$gateway netcfg/get_nameservers=127.0.0.1 netcfg/get_hostname=$hostname netcfg/get_domain= preseed/url=http://INSTALL- SERVER/kickstart.php/debian-preseed (where $ip $netmask $gateway and $hostname is filled in with the information of the server being provisioned) == KVM over IP screenshot of the error message: http://image.bayimg.com/gabigaade.jpg Screenshot of the messages: http://image.bayimg.com/gabihaade.jpg Yours sincerely, Floris Bos -- To UNSUBSCRIBE, email to debian-boot-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20101209.10536@je-eigen-domein.nl