You are not logged in.

#1 2014-08-12 04:47:40

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 307

dhcpcd and wpa_supplicant

I can manually start my WiFi client connection via wpa_supplicant. Once it is up, I can run dhcpcd and get an IP address.

Now I'm trying to use systemd to automate the process upon boot. I'm reading about the dhcpcd hook for wpa_supplicant [1] but I'm afraid it's not working.

I have done:

systemctl enable dhcpcd@ra0

and I have a file named

/etc/wpa_supplicant/wpa_supplicant-ra0.conf

which works when used with wpa_supplicant directly. However, after I reboot, I get this:

# systemctl status dhcpcd@ra0 
* dhcpcd@ra0.service - dhcpcd on ra0
   Loaded: loaded (/usr/lib/systemd/system/dhcpcd@.service; enabled)
   Active: failed (Result: exit-code) since Tue 2014-08-12 05:07:53 UTC; 12s ago
  Process: 236 ExecStart=/usr/bin/dhcpcd -q -w %I (code=exited, status=1/FAILURE)

...
Aug 12 05:07:24 chameleon dhcpcd[236]: ra0: soliciting a DHCP lease
Aug 12 05:07:24 chameleon dhcpcd[236]: ra0: soliciting an IPv6 router
...
Aug 12 05:07:53 chameleon dhcpcd[236]: timed out
Aug 12 05:07:53 chameleon dhcpcd[236]: exited
Aug 12 05:07:53 chameleon systemd[1]: dhcpcd@ra0.service: control process exited, code=exited status=1
Aug 12 05:07:53 chameleon systemd[1]: Failed to start dhcpcd on ra0.
Aug 12 05:07:53 chameleon systemd[1]: Unit dhcpcd@ra0.service entered failed state.

It's same if I attempt to start the service manually. What am I doing wrong?


[1] https://wiki.archlinux.org/index.php/Dh … supplicant

Offline

#2 2014-08-12 05:07:14

DVNO
Member
Registered: 2014-08-10
Posts: 19

Re: dhcpcd and wpa_supplicant

Well, I'm not sure how dhcpcd engages the 10-wpa_supplicant hook, but I have an almost identical setup as yours, with the "/etc/wpa_supplicant/wpa_supplicant-$interface.conf" file as well, and what I do (and it works) is:

# systemctl enable wpa_supplicant@$interface

Along with:

# systemctl enable dhcpcd@$interface

I suppose it's obvious but you didn't mention using wpa_supplicant@.service, so...

At any rate, if you're not connecting to any networks that use 802-1X protocols (or something even more robust) you could use tools such as netctl or wicd... They do work for the majority of network types available big_smile

Offline

#3 2014-09-02 03:51:00

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 307

Re: dhcpcd and wpa_supplicant

I think my problem is that the wireless chipset requires driver "wext" instead of "nl80211". I cannot see how to tell dhcpcd to run wpa_supplicant with "wext".

If I run wpa_supplicant manually, I specify -Dwext on the command-line, but if dhcpcd invokes wpa_supplicant via /usr/lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant per [1], there is no such option in the invocation that I can see. The call seems to be:

$err=$(wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface)

I had hoped that the driver could be specified in the wpa_supplicant.conf file, but from what I can tell, it cannot.


Here is a workaround that is ALMOST working, I'm only getting a systemd dependency wrong I think.

I created myself a /usr/lib/systemd/system/wpa_supplicant-wext@.service file that provides the -Dwext line on the command-line:

ExecStart=/usr/bin/wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant-%I.conf -Dwext -i%I

otherwise it's the same as /usr/lib/systemd/system/wpa_supplicant-nl80211\@.service, which comes with the wpa_supplicant package. I enable it with:

systemctl enable wpa_supplicant-wext@ra0

dhcpcd is also enabled on that interface:

systemctl enable dhcpcd@ra0

Now, when I reboot, wpa_supplicant-wext@ra0 starts successfully, but dhcpd does not:

# systemctl status dhcpcd@ra0
* dhcpcd@ra0.service - dhcpcd on ra0
   Loaded: loaded (/usr/lib/systemd/system/dhcpcd@.service; enabled)
   Active: failed (Result: exit-code) since Tue 2014-09-02 04:01:49 UTC; 18s ago
  Process: 235 ExecStart=/usr/bin/dhcpcd -q -w %I (code=exited, status=1/FAILURE)

but when I restart it manually:

systemctl restart dhcpcd@ra0

it all works! How do I get dhcpcd to run well after wpa_supplicant is up?

I tried adding this to the [Unit] section of my wpa_supplicant-wext@.service file:

Before=dhcpcd@%i.service

but it does not seem to make any difference. Progress ... but no cigar so far!

[1] https://wiki.archlinux.org/index.php/Dh … supplicant

Offline

Board footer

Powered by FluxBB