Auto-reconnect to wifi

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

Re: Auto-reconnect to wifi

Postby KingDuckZ » Sat Sep 29, 2012 10:23 pm

Hmm I'll try again and ask if I get stuck. The problem is I don't have a screen, so either I do blind typing or I try to do manual work on the SD card mounted on my laptop. Either way is prone to mistakes. I can try to ssh with an ethernet cable tho.
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: Auto-reconnect to wifi

Postby KingDuckZ » Sat Sep 29, 2012 11:42 pm

From what I understand, I have to write a profile based on the wireless-wpa template. I named it home, so I ran:
$this->bbcode_second_pass_code('', 'systemctl enable netcfg\@home.service net-auto-wireless.service')
Problem is that after startup ifconfig doesn't list wlan0 (which is an usb wifi stick), and after what seems to be a timeout wait I get an error message. If I manually run ifconfig wlan0 up and then systemctl start netcfg\@home.service then it works.
The wiki speaks about a PRE_UP and a POST_UP step, which makes me think that the up command should be issued automatically already. So what's happening? How can I make sure wlan0 is up?
The systemctl status command shows that dhcpcd timed out, basically.

Edit: Oh wait, I think I found a solution to this by myself: apparently profile files (ie: /etc/network.d/home) support an option named DHCP_OPTIONS. So by adding DHCP_OPTIONS='up' I fixed my problem. I still find it silly that one has to specify that manually.

Edit 2: Apparently, there is no need to enable netcfg (and thus to write a profile). It's more likely that this will cause a race condition at boot and break the connection.
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: Auto-reconnect to wifi

Postby KingDuckZ » Sun Sep 30, 2012 12:59 am

Apparently I still have the issue. After having replaced my previous wifi setup with the suggested net-auto-wireless I opened an ssh connection again and started copying some files around. A couple minutes after starting I lost the connection again and couldn't ping the raspberry anymore. Every time I lost the connection, in fact, I was doing some hard disk operation (unzip, mv, cp, hash checking in torrent or even just mounting). I have several hard disks connected (but I also tried with only one). The wifi stick is connected directly to the Respberry through the supplied extension cable (http://trust.com/18213), while the hard disks are behind a usb hub (tried two different hubs). Any other hint at why this is happening? Just waiting didn't bring the connection back, but I'm sure the raspberry is not hanging. The hard disks are self powered and the usb hub has its own power cable. This tends to happen if the Raspberry is serving an nfs share.
On the raspberry I get this:
$this->bbcode_second_pass_code('', '[root@alarmpi ~]# systemctl status net-auto-wireless.service
net-auto-wireless.service - Provides automatic netcfg wireless connection
Loaded: loaded (/usr/lib/systemd/system/net-auto-wireless.service; enabled)
Active: active (running) since Thu, 01 Jan 1970 01:01:34 +0100; 27min ago
Process: 138 ExecStart=/usr/bin/netcfg-wpa_actiond $WIRELESS_INTERFACE (code=exited, status=0/SUCCESS)
CGroup: name=systemd:/system/net-auto-wireless.service
├ 177 wpa_supplicant -B -P /run/wpa_supplicant_wlan0.pid -i wlan0 -D nl80211,wext -c/run/network/wpa.wlan0/wp...
├ 180 /usr/sbin/wpa_actiond -p /run/wpa_supplicant -i wlan0 -P /run/wpa_actiond_wlan0.pid -a /usr/bin/netcfg-...
└ 252 dhcpcd -qL -t 10 -K up wlan0

Jan 01 01:01:38 alarmpi dhcpcd[223]: wlan0: sendmsg: Cannot assign requested address
Jan 01 01:01:38 alarmpi dhcpcd[223]: wlan0: rebinding lease of 192.168.0.14
Jan 01 01:01:39 alarmpi dhcpcd[223]: wlan0: acknowledged 192.168.0.14 from 192.168.0.1
Jan 01 01:01:39 alarmpi dhcpcd[223]: wlan0: checking for 192.168.0.14
Jan 01 01:01:42 alarmpi dhcpcd[223]: wlan0: sending IPv6 Router Solicitation
Jan 01 01:01:44 alarmpi dhcpcd[223]: wlan0: leased 192.168.0.14 for 86400 seconds
Jan 01 01:01:45 alarmpi dhcpcd[223]: forked to background, child pid 252
Jan 01 01:01:46 alarmpi dhcpcd[252]: wlan0: sending IPv6 Router Solicitation
Jan 01 01:01:50 alarmpi dhcpcd[252]: wlan0: sending IPv6 Router Solicitation
Jan 01 01:01:50 alarmpi dhcpcd[252]: wlan0: no IPv6 Routers available
')
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Re: Auto-reconnect to wifi

Postby pepedog » Sun Sep 30, 2012 11:00 am

@KingDuckZ
you accidentally pointed me to resolve something completly different, multiple static wired interfaces on a dockstar, difficult without console and network is down.
In brief-
create wired or wireless interfaces in /etc/network.d/ (examples here /etc/network.d/examples)
The names of the files are put in /etc/conf.d/netcfg
Examples are
WIRED_INTERFACE="myeth0 myeth1"
(names of files in /etc/network.d/ are myeth0 and myeth1)
Or for wireless
WIRELESS_INTERFACE="mywlan0"
And to get them going on boot
systemctl enable net-auto-wired.service
and/or
systemctl enable net-auto-wireless.service
Thanks
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: Auto-reconnect to wifi

Postby KingDuckZ » Sun Sep 30, 2012 12:17 pm

Glad that my posts have helped somebody else :) However, I'm starting to think that the culprit here is nfs. It's just an hypothesis, but maybe it hangs and keeps wlan0 busy so that you can't even ping it anymore. I tried to restart/kill nfs daemon from the server but it's unkillable. Even rebooting doesn't work and I have to unplug the power.
Now on the client I'm trying to mount with -t nfs4 instead of just -t nfs, but since when the nfs4 support is in I get the infamous "does not support NFS export" problem (possibly http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=602956). In spite of that message mounting on the client works (not on the first attempt tho), and I'm actually moving data around to see if it's more stable. I'll start a new thread if I need help as this is going OT.

Edit: so no luck, even with -t nfs4.
KingDuckZ
 
Posts: 17
Joined: Wed Sep 26, 2012 9:11 am

Previous

Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 5 guests