You are not logged in.
I have an older PC (so it's not moving much...), and I'm trying to set up wireless connection trough a USB wireless adapter (Ralink Technology, Corp. RT2501USB Wireless Adapter).
I have the correct drivers installed, and everything set up (doulbe checked of course).
The wireless setup during boot-time does not works, and prints the error message
Could not associate $1 - try increasing WIRELESS_TIMEOUT and check network is WEP or has no securityIf I run iwgetid immeadiateley after login, I get the following output:
$ iwgetid wlan0 -ra
00:00:00:00:00:00On the other hand, if I try a
sudo /etc/rc.d/network startafter I log in, it works flawlessley.
I've tried the following:
--> setting WIRELESS_TIMEOUT to 10 seconds, does not works (only after boot)
--> double checking the setup lines
--> reading the /etc/rc.d/network script, and executing the commands manually, it works
$ sudo /etc/rc.d/network stop
$ sudo iwconfig wlan0 essid BodorWLAN key s:wikey
$ sudo iwgetid wlan0 -ra[the MAC-ADDRESS of wlan0, differring from 00:00:00:00:00:00]
--> stopping and starting the /etc/rc.d/network script, it works
--> editing /etc/rc.d/network to print out the used varialbes and more verbose error messages (I've restored it since then, so I cannot post the results, all seemed to be ok.)
/etc/config.d/wireless:
#
# Settings for wireless cards
#
# For each wireless interface declared in INTERFACES (in rc.conf), declare
# a wlan_${IF} variable that contains the arguments to be passed to
# iwconfig(8). Then list the original interface name in the
# WLAN_INTERFACES array.
#
#wlan_eth0="eth0 mode managed essid default"
#WLAN_INTERFACES=(eth0)/etc/rc.conf:
#
# /etc/rc.conf - Main Configuration for Arch Linux
#
# -----------------------------------------------------------------------
# LOCALIZATION
# -----------------------------------------------------------------------
#
# LOCALE: available languages can be listed with the 'locale -a' command
# HARDWARECLOCK: set to "UTC" or "localtime", any other value will result
# in the hardware clock being left untouched (useful for virtualization)
# TIMEZONE: timezones are found in /usr/share/zoneinfo
# KEYMAP: keymaps are found in /usr/share/kbd/keymaps
# CONSOLEFONT: found in /usr/share/kbd/consolefonts (only needed for non-US)
# CONSOLEMAP: found in /usr/share/kbd/consoletrans
# USECOLOR: use ANSI color sequences in startup messages
#
LOCALE="hu_HU.UTF-8"
HARDWARECLOCK="UTC"
TIMEZONE="Europe/Budapest"
KEYMAP="hu"
CONSOLEFONT="lat2-16.psfu.gz"
CONSOLEMAP=
USECOLOR="yes"
# -----------------------------------------------------------------------
# HARDWARE
# -----------------------------------------------------------------------
#
# MOD_AUTOLOAD: Allow autoloading of modules at boot and when needed
# MOD_BLACKLIST: Prevent udev from loading these modules
# MODULES: Modules to load at boot-up. Prefix with a ! to blacklist.
#
# NOTE: Use of 'MOD_BLACKLIST' is deprecated. Please use ! in the MODULES array.
#
MOD_AUTOLOAD="yes"
#MOD_BLACKLIST=() #deprecated
MODULES=()
# Scan for LVM volume groups at startup, required if you use LVM
USELVM="no"
# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="curly-desktop"
# Use 'ifconfig -a' or 'ls /sys/class/net/' to see all available interfaces.
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
# - prefix an entry in INTERFACES with a ! to disable it
# - no hyphens in your interface names - Bash doesn't like it
#
# DHCP: Set your interface to "dhcp" (eth0="dhcp")
# Wireless: See network profiles below
#
#Static IP example
#eth0="eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255"
eth0="dhcp"
wlan0="dhcp"
wlan_wlan0="wlan0 essid BodorWLAN key s:wikey"
INTERFACES=(eth0 wlan0)
# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
# - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.0.1"
ROUTES=(!gateway)
# Enable these network profiles at boot-up. These are only useful
# if you happen to need multiple network configurations (ie, laptop users)
# - set to 'menu' to present a menu during boot-up (dialog package required)
# - prefix an entry with a ! to disable it
#
# Network profiles are found in /etc/network.d
#
# This now requires the netcfg package
#
#NETWORKS=(main)
# -----------------------------------------------------------------------
# DAEMONS
# -----------------------------------------------------------------------
#
# Daemons to start at boot-up (in this order)
# - prefix a daemon with a ! to disable it
# - prefix a daemon with a @ to start it up in the background
#
DAEMONS=(syslog-ng dbus hal network openntpd netfs crond alsa)Note: I modified sensitive information (passwd, stb.)
I'm running out of ideas, since the network script appears to be working always except at boot time.
Last edited by dragonfi (2010-06-11 15:44:52)
Offline
I wonder if the problem lies with the usb not been available at boot time.
Do you have the usb hook in your mkinitcpio.conf?
If not, add the usb hook to your "/etc/mkinitcpio.conf" and run
mkinitcpio -k 2.6.33-ARCH -c /etc/mkinitcpio.conf -g /boot/kernel26.imgLast edited by chapaj (2010-06-12 10:35:33)
Offline
Activating the usb hooks in the ramdisk did not done the job, as the network demon only runs late in boottime (maybe I'm just being imprecise, i'm meaning the part, where it already entered the final runlevel).
On the other hand, I did tracked down the problem, and I beliveve it's some kind of desing-flaw in the wireless USB utility. (Or I'm just not aware of a certain feature in it.)
I modified /etc/rc.d/network to resend the iwconfig to the device after the 2 second sleep, and it seems to work sometimes.
/etc/rc.d/network: (added lines in wi_up())
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
# wireless settings
[ -f /etc/conf.d/wireless ] && . /etc/conf.d/wireless
# ethernet bonding settings
[ -f /etc/conf.d/bonding ] && . /etc/conf.d/bonding
# bridge settings
[ -f /etc/conf.d/bridges ] && . /etc/conf.d/bridges
# dhcpcd settings
[ -f /etc/conf.d/dhcpcd ] && . /etc/conf.d/dhcpcd
ifup()
{
if [ "$1" = "" ]; then
echo "usage: $0 ifup <interface_name>"
return 1
fi
eval ifcfg="\$${1}"
# Get the name of the interface from the first token in the string
if [ "$ifcfg" = "dhcp" ]; then
ifname="$1"
else
ifname=${ifcfg%% *}
fi
/sbin/ifconfig $ifname up
wi_up $1 || return 1
if [ "$ifcfg" = "dhcp" ]; then
# remove the .pid file if it exists
/bin/rm -f /var/run/dhcpcd-${1}.pid >/dev/null 2>&1
/bin/rm -f /var/run/dhcpcd-${1}.cache >/dev/null 2>&1
/sbin/dhcpcd $DHCPCD_ARGS ${1}
else
/sbin/ifconfig $ifcfg
fi
return $?
}
wi_up()
{
eval iwcfg="\$wlan_${1}"
[ "$iwcfg" = "" ] && return 0
/usr/sbin/iwconfig $iwcfg
[[ -z "$WIRELESS_TIMEOUT" ]] && WIRELESS_TIMEOUT=2
sleep $WIRELESS_TIMEOUT
#added line below because wlan0 does not play nice..
/usr/sbin/iwconfig $iwcfg
bssid=`iwgetid $1 -ra`
if [[ "$bssid" = "00:00:00:00:00:00" ]]; then
printhl "Could not associate $1 - try increasing WIRELESS_TIMEOUT and check network is WEP or has no security"
return 1
fi
return 0
}
ifdown()
{
if [ "$1" = "" ]; then
echo "usage: $0 ifdown <interface_name>"
return 1
fi
eval ifcfg="\$${1}"
if [ "$ifcfg" = "dhcp" ]; then
if [ -f /var/run/dhcpcd-${1}.pid ]; then
/bin/kill $(cat /var/run/dhcpcd-${1}.pid)
fi
fi
# Always bring the interface itself down
/sbin/ifconfig ${1} down >/dev/null 2>&1
return $?
}
iflist()
{
for ifline in ${INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
printf " $ifline:\t"
else
printf "$ifline:\t"
fi
eval real_ifline=\$${ifline#!}
echo $real_ifline
done
}
rtup()
{
if [ "$1" = "" ]; then
echo "usage: $0 rtup <route_name>"
return 1
fi
eval routecfg="\$${1}"
if grep -q :: <<< $routecfg; then
/sbin/route -A inet6 add $routecfg
else
/sbin/route add $routecfg
fi
return $?
}
rtdown()
{
if [ "$1" = "" ]; then
echo "usage: $0 rtdown <route_name>"
return 1
fi
eval routecfg="\$${1}"
if grep -q :: <<< $routecfg; then
/sbin/route -A inet6 del $routecfg
else
/sbin/route del $routecfg
fi
return $?
}
rtlist()
{
for rtline in ${ROUTES[@]}; do
if [ "$rtline" = "${rtline#!}" ]; then
printf " $rtline:\t"
else
printf "$rtline:\t"
fi
eval real_rtline=\$${rtline#!}
echo $real_rtline
done
}
bond_up()
{
for ifline in ${BOND_INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
eval bondcfg="\$bond_${ifline}"
if [ -n "${bondcfg}" ]; then
/sbin/ifenslave $ifline $bondcfg || error=1
fi
fi
done
}
bond_down()
{
for ifline in ${BOND_INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
eval bondcfg="\$bond_${ifline}"
/sbin/ifenslave -d $ifline $bondcfg || error=1
fi
done
}
bridge_up()
{
for br in ${BRIDGE_INTERFACES[@]}; do
if [ "$br" = "${br#!}" ]; then
# if the bridge already exists, remove it
if [ "$(/sbin/ifconfig $br 2>/dev/null)" ]; then
/sbin/ifconfig $br down
/usr/sbin/brctl delbr $br
fi
/usr/sbin/brctl addbr $br
eval brifs="\$bridge_${br}"
for brif in $brifs; do
if [ "$brif" = "${brif#!}" ]; then
for ifline in ${BOND_INTERFACES[@]}; do
if [ "$brif" = "$ifline" ] && [ "$ifline" = "${ifline#!}" ]; then
ifup $ifline
eval bondcfg="\$bond_${ifline}"
/sbin/ifenslave $ifline $bondcfg || error=1
unset bond_${ifline}
fi
done
/usr/sbin/brctl addif $br $brif || error=1
fi
done
fi
done
}
bridge_down()
{
for br in ${BRIDGE_INTERFACES[@]}; do
if [ "$br" = "${br#!}" ]; then
/usr/sbin/brctl delbr $br
fi
done
}
case "$1" in
start)
if ! ck_daemon network; then
echo "Network is already running. Try 'network restart'"
exit
fi
stat_busy "Starting Network"
error=0
# bring up bridge interfaces
bridge_up
# bring up ethernet interfaces
for ifline in ${INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
ifup $ifline || error=1
fi
done
# bring up bond interfaces
bond_up
# bring up routes
for rtline in "${ROUTES[@]}"; do
if [ "$rtline" = "${rtline#!}" ]; then
rtup $rtline || error=1
fi
done
if [ $error -eq 0 ]; then
add_daemon network
stat_done
else
stat_fail
fi
;;
stop)
#if ck_daemon network; then
# echo "Network is not running. Try 'network start'"
# exit
#fi
stat_busy "Stopping Network"
rm_daemon network
error=0
for rtline in "${ROUTES[@]}"; do
if [ "$rtline" = "${rtline#!}" ]; then
rtdown $rtline || error=1
fi
done
# bring down bond interfaces
bond_down
for ifline in ${INTERFACES[@]}; do
if [ "$ifline" = "${ifline#!}" ]; then
ifdown $ifline || error=1
fi
done
# bring down bridge interfaces
bridge_down
if [ $error -eq 0 ]; then
stat_done
else
stat_fail
fi
;;
restart)
$0 stop
/bin/sleep 2
$0 start
;;
ifup|ifdown|iflist|rtup|rtdown|rtlist)
$1 $2
;;
*)
echo "usage: $0 {start|stop|restart}"
echo " $0 {ifup|ifdown|iflist|rtup|rtdown|rtlist}"
esac
# vim: set ts=2 noet:I wrote a sript and chnaged network to this script in my rc.conf, it appears to be working now.
/etc/rc.d/myscript:
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
ifup()
{
/sbin/ifconfig wlan0 up
/usr/sbin/iwconfig wlan0 essid BodorWLAN key s:admin
sleep 2
/usr/sbin/iwconfig wlan0 essid BodorWLAN key s:admin
dhcpcd wlan0
return $?
}
ifdown()
{
if [ -f /var/run/dhcpcd-wlan0.pid ]; then
/bin/kill $(cat /var/run/dhcpcd-wlan0.pid)
fi
/sbin/ifconfig wlan0 down >/dev/null 2>&1
return $?
}
case "$1" in
start)
stat_busy "Starting Network"
ifup
stat_done
;;
restart)
stat_busy "Restarting Network"
ifdown
ifup
stat_done
;;
stop)
stat_busy "Stopping Network"
ifdown
stat_done
;;
*)
echo "usage: $0 {start|stop|restart}"
;;
esacMy only question now is that how could I achieve the same solution in a more elegant way, I'm a bit confused, because the above script does the exact same stuff that my modified /etc/rc.d/network would supposed to be doing.
Last edited by dragonfi (2010-06-12 19:27:38)
Offline
1) No problem, glad you got it working.
2) The problem with your solution is that the script "/etc/rc.d/network" will get overwritten on an update. Have you tried using netcfg instead. You can execute commands before/after interface up/down like
PRE_UP="sleep 5"Have a look at the wiki
[wiki]Netcfg#Passing_arguments_to_iwconfig_before_connecting[/wiki]
3) I'd say you can.
4) Edit your first post and append [SOLVED] to the subject
[SOLVED] wireless not working on boot
Offline
Thank you, I was a bit fast to write down my "findings", and the first solution did not always worked, I edited the post to include my second solution, that looks better. (It appears to severly distrupt the flow of the forum so I will try not to do it too oten inthe future, sorr for this.)
I will try netcfg tomorrow and see if I get a better solution at it.
Offline