You are not logged in.

#1 2017-10-27 08:55:20

yuuki
Member
Registered: 2017-10-27
Posts: 1

Wiki instructions on setting up wpa_supplicant and dhcpcd hook

In the wiki, under "At boot (systemd)", it is stated that:

To enable wireless at boot, enable an instance of one of the above services on a particular wireless interface. For example, enable the wpa_supplicant@interface systemd unit.

Further down there's a tip saying that:

dhcpcd has a hook that can launch wpa_supplicant implicitly, see dhcpcd#10-wpa_supplicant.

Am I correct to assume, that this is ideally an either/or kind of thing? Meaning that if I use the `dhcpcd` hook, I do not need to explicitly enable the service? Because I just set up networking through wpa_supplicant and systemd (after throwing out NetworkManager) and I set up the `@[interface].service` and the hook, because the Wiki just wasn't very clear on that (and in all honesty I just followed the instructions without giving them too much though - I know...).

Now I just removed the hook from `/usr/lib/dhcpcd/` and everything is still working as expected. I am definitely not well versed in all things Linux, but it is my impression that a service would start a daemon which, simplified, means that the `wpa_supplicant` would run in the background. Looking at the actual dhcpcd (I swear I need to look up the abbreviation every time) hook file (without intimate bash knowledge) it appears that it's really a super simple script that also just starts `wpa_supplicant` in the background.

wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" \
            "$driver" 2>&1

Bottom line: it's either dhcpcd hook or activate wpa_supplicant service manually, although the hook won't do anything if wpa is already running. Is that correct?

Offline

#2 2017-10-29 11:09:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: Wiki instructions on setting up wpa_supplicant and dhcpcd hook

yuuki wrote:

Am I correct to assume, that this is ideally an either/or kind of thing?

Yes.

yuuki wrote:

... although the hook won't do anything if wpa is already running. Is that correct?

I'm not sure if it will or not.  If the dhcpcd hook checks whether wpa_supplicant is already running then that'd be correct.  If it doesn't, it might try to launch it again and cause problems - but I think it does check.

FWIW, I enable just dhcpcd@.service and the hook and do not directly enable wpa_supplicant services at all.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-10-29 14:37:02

rsmarples
Member
Registered: 2009-05-12
Posts: 287

Re: Wiki instructions on setting up wpa_supplicant and dhcpcd hook

The wpa_supplicant hook is only there if there is no good OS support for managing wpa_supplicant.

It relies on the wpa_supplicant configuration allowing a control socket, which by default is NOT enabled.
This is why it's just available as an example script now instead of being installed by default.

Offline

#4 2017-10-29 16:26:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: Wiki instructions on setting up wpa_supplicant and dhcpcd hook

rsmarples wrote:

It relies on the wpa_supplicant configuration allowing a control socket, which by default is NOT enabled.

I don't know what you mean by "enabled".  It needs to be listed in the wpa_supplicant.conf.  Users are guided by the wiki to include this in their configs, and it is included in the default wpa_supplicant.conf distributed with the package in our repos.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2017-11-03 00:56:32

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,130

Re: Wiki instructions on setting up wpa_supplicant and dhcpcd hook

yuuki wrote:

wpa_supplicant -B -c"$wpa_supplicant_conf" -i"$interface" \
            "$driver" 2>&1

That's not starting it in the background. Generally, systemd prefers stuff not to fork to the background itself. systemd deals with that. Hence, service files generally specify foreground processes, where possible.


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#6 2017-11-03 11:18:26

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,447
Website

Re: Wiki instructions on setting up wpa_supplicant and dhcpcd hook

cfr wrote:

That's not starting it in the background.

Yes it is:

man wpa_supplicant wrote:

-B     Run daemon in the background.

You are correct that one should not background processes that are started directly from a systemd service, but I fail to see how that has any relevance as the line the OP quoted is not from a systemd service.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB