Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 130166 - wireless problem baselayout-1.12.0_pre17-r2 (I've found the solution)
Summary: wireless problem baselayout-1.12.0_pre17-r2 (I've found the solution)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High normal
Assignee: Roy Marples (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-16 06:55 UTC by Joseph
Modified: 2006-04-18 09:51 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch rc-daemon.sh to only remove what we asked for (baselayout-1.12.0_pre17-daemon-stop.patch,563 bytes, patch)
2006-04-18 04:17 UTC, Roy Marples (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph 2006-04-16 06:55:09 UTC
I had a problem with a wireless network using wpa_supplicant. When a connection is lost on the wireless network then the connection will not be re-established.  So after hours of investigation I found out how to fix the problem. As I originally suspected it was a bug with the baselayout scripts. I got the latest version of baselayout (1.12.0_pre17-r2) and the problem still exists in this version. The problem occurs in the /lib/rcscripts/net.modules.d/dhcpcd.sh file, line 60. start-stop-daemon is used instead of the /sbin/start-stop-daemon. Using the start-stop-daemon function defined in /lib/rcscripts/sh/rc-daemon.sh to kill a process without creating the process (as is done in dhcpd.sh) causes the /var/lib/init.d/daemons/net.xxx file to lose reference to the wpa_supplicant process. When this occurs the code in the /lib/rcscripts/net.modules.d/wpa_supplicant.sh module kills the wpa_supplicant process when the wifi connection is lost. And thus no more wifi. 

If you edit the dhcpcd.sh file and change start-stop-daemon to /sbin/start-stop-daemon then the cascade of failure will not occur and the wifi connection will reestablish after the wifi connection is temporarily lost. 
 
Actually there is also a bug in the start-stop-daemon function which removed the reference to wpa_supplicant when start-stop-daemon --kill was called with reference to dhcpcd. I'm not sure exactly why the start-stop-daemon is failing because this is really the first time that I tried debugging a bash script and I did so by inserting logger statements throughout the rc-scripts. I've only really started understanding bash for a few months now.

Hope this helps.
Comment 1 Henrik Brix Andersen 2006-04-16 14:52:43 UTC
Problem confirmed. The proposed solutions works for me, thank you for investigating this.
Comment 2 Roy Marples (RETIRED) gentoo-dev 2006-04-18 04:17:54 UTC
Created attachment 84888 [details, diff]
Patch rc-daemon.sh to only remove what we asked for

Attached is a patch to /lib/rcscripts/sh/rc-daemon.sh that should correct this issue. The patch references sbin/rc-daemon.sh so it can easily be applied to the ebuild - to manually patch it, change it to reference /lib/rcscripts/sh/rc-daemon.sh
Comment 3 Roy Marples (RETIRED) gentoo-dev 2006-04-18 04:19:26 UTC
Please test and report back.
Comment 4 Henrik Brix Andersen 2006-04-18 04:55:40 UTC
(In reply to comment #3)
> Please test and report back.

Appears to work here as well (tested with the original proposed fix reverted, of course).

Joseph, does this work for you as well?
Comment 5 Joseph 2006-04-18 09:31:14 UTC
(In reply to comment #4)
> Appears to work here as well (tested with the original proposed fix reverted,
> of course).
> 
> Joseph, does this work for you as well?
> 
I've re-emerged this baselayout package, applied the patch to the rc-daemon.sh script and performed the original tests that led me to discover the problem. /var/lib/init.d/daemons/net.eth1 had the correct information this time around and the connection was re-established with my wireless access point after I switched it off and on, without restarting the service on my laptop. 

Classic == bug hey... Someone once gave me a great C tip which may apply to bash: He said to use the form constant == variable instead of the conventional method of variable == constant. This way, if human nature sucumbes then a compile error will occur instead of a phantom intermittent type bug.
Comment 6 Roy Marples (RETIRED) gentoo-dev 2006-04-18 09:50:56 UTC
(In reply to comment #5)
> Classic == bug hey... Someone once gave me a great C tip which may apply to
> bash: He said to use the form constant == variable instead of the conventional
> method of variable == constant. This way, if human nature sucumbes then a
> compile error will occur instead of a phantom intermittent type bug.

Ah no, bash treats quoting differently with RHS vs LHS.
Besides, that makes code more unreadable imo.
Comment 7 Roy Marples (RETIRED) gentoo-dev 2006-04-18 09:51:37 UTC
Fixed in pre17-r3