Hi all,
I was out of town, away from my computer recently. Today I managed to solve this problem by putting a DHCP_TIMEOUT value in rc.inet1.conf. A value as low as 2 does the job. So, obviously the problem is not an actual DHCP timeout issue (Slack tries with 10 seconds at least).
Setting an explicit timeout value makes a difference in this part of the rc.inet1 script:
Code:
if [ "${DHCP_TIMEOUT[$i]}" = "" ]; then
ifconfig ${1} up && sleep 1
CONNSTATUS="$(cat /sys/class/net/${1}/carrier 2> /dev/null)"
ifconfig ${1} down
echo "CONNSTATUS= $CONNSTATUS"
if [ "$CONNSTATUS" = "0" ]; then
# The kernel has just told us the cable isn't even plugged in, but we will
# give any DHCP server a short chance to reply anyway:
echo "No carrier detected on ${1}. Reducing DHCP timeout to 10 seconds."
DHCP_TIMEOUT[$i]=10
fi
fi
# 30 seconds should be a reasonable default DHCP timeout. 60 was too much. :-)
echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-30} ${DHCP_OPTIONS} ${1}" | $LOGGER
/sbin/dhcpcd -d -t ${DHCP_TIMEOUT[$i]:-30} ${DHCP_OPTIONS} ${1}
So, it's the if at the beginning that gets skipped if I set an explicit timeout.
Then I tried to simulate this in the console. I inserted ifconfig up/down commands before the dhcpcd call. The following one works:
Code:
root@kutu:/usr/src/linux# killall wpa_supplicant && killall dhcpcd
root@kutu:/usr/src/linux# /sbin/iwconfig wlan0 nick kutu ; /sbin/iwconfig wlan0 essid "AIRTIES_RT-205" ; wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -Dwext -iwlan0 ; ifconfig wlan0 up; ifconfig wlan0 down; /sbin/dhcpcd -d -t 30 wlan0
Error for wireless request "Set Nickname" (8B1C) :
SET failed on device wlan0 ; Operation not supported.
dhcpcd: MAC address = 00:1a:73:66:6b:b9
dhcpcd: your IP address = 192.168.2.6
There is a delay of 3-4 seconds between the last two lines, but it works. However, this one doesn't work:
Code:
/sbin/iwconfig wlan0 nick kutu ; /sbin/iwconfig wlan0 essid "AIRTIES_RT-205" ; wpa_supplicant -Bw -c/etc/wpa_supplicant.conf -Dwext -iwlan0 ; ifconfig wlan0 up; sleep 1; ifconfig wlan0 down; /sbin/dhcpcd -d -t 30 wlan0
The only difference is that I added that "sleep 1" between the ifconfigs. There is a "sleep 1" there in the rc.inet1 script, so this is a better simulation of rc.inet1. A bigger sleep doesn't change anything. Adding another sleep before the dhcpcd call doesn't help either. Removing the "sleep 1" part in rc.inet1 also didn't help.
Earlier, I have tried adding/modifiying countless sleep calls here and there, trying to give the thing the extra time where I thought it choked, but I'm a bit surprised that the solution was to stay away from sleeps
.
Edit: Btw, I'm aware of bstrik's "sleep 3" fix; but that didn't help me.