On a Linux system with systemd and networkd I need to operate a WLAN access point on one WLAN interface, while operating further (hotplug) WLAN interfaces in normal station ("client") mode.

As it turns out, wpa_supplicant.service goes live on all my WLAN interfaces, which would be fine, if only all these WLAN interfaces would operate in station/client mode. However, while wpa_supplicant.service serves a WLAN interface, it's not possible (anymore?) that hostapd.service operates that WLAN interface in AP access point mode.

So I want to disable wpa_supplicant.service for a specific interface only, say wls35u2. My idea was to have a wpa_supplicant@wls35u2.service unit that I can selectively disable, but to leave wpa_supplicant.service enabled. However, this does not seem to work or I'm doing something wrong in the wpa_supplicant@wls35u2.service.

So, how can I disable the WPA supplicant service on a specific interface only without globally disabling it?

I had the same problem. @Nproject found a nice solution. But you don't have to modify each of this procedures. Simply go to the end of the file Nproject mentioned (/lib/dhcpcd/dhcpcd-hooks/10-wpa_supplicant) and modify the following if clause:

ORIGINAL

if [ "$ifwireless" = "1" ] && \
    type wpa_supplicant >/dev/null 2>&1 && \
    type wpa_cli >/dev/null 2>&1
then
        case "$reason" in
        PREINIT)        wpa_supplicant_start;;
        RECONFIGURE)    wpa_supplicant_reconfigure;;
        DEPARTED)       wpa_supplicant_stop;;
        esac
fi

Add [ "$interface" != "TheInterfaceWPASupplicantShouldBeDisabledOn" ] in this way:

MODIFIED

if [ "$ifwireless" = "1" ] && [ "$interface" != "TheInterfaceWPASupplicantShouldBeDisabledOn" ]  && \
    type wpa_supplicant >/dev/null 2>&1 && \
    type wpa_cli >/dev/null 2>&1
then
        case "$reason" in
        PREINIT)        wpa_supplicant_start;;
        RECONFIGURE)    wpa_supplicant_reconfigure;;
        DEPARTED)       wpa_supplicant_stop;;
        esac
fi

Additionally this will prevent the Network Manager (GUI) in your taskbar to show up this interface.

  • 3
    Note to others, my filename was 10-wpa_supplicant. – Eugene Feb 23 at 11:32
  • Thx @Eugene - your are right. I have fixed my answer. – rweisse Mar 13 at 10:55

Use the "nohook wpa_supplicant" option in /etc/dhcpcd.conf. If you don't want wpa_supplicant for wlan0 this would be:

interface wlan0
        nohook wpa_supplicant

[EDIT: Look at @rweisse answer for a better way to do it]

I had the exact same problem on my raspberry pi.

What i found is that both wpa_supplicant@wlan0 and wpa_supplicant@wlan1 (I have two wlan interfaces) and wpa_supplicant.service were disabled.

I managed to find (On raspbian at least, i don't know how it is on other debian releases) that dhcpcd is responsible for wpa_supplicant start.

Under /lib/dhcpcd/dhcpcd-hooks, there is a file named "10-wpa-supplicant", in which you can find start/reconfigure/stop procedures for wpa_supplicant.

In this file i simply added condition on the $interface being processed. For each PROCEDURE_NAME (start/stop/reconfigure):

PROCEDURE_NAME( )
    if [ "$interface" != "TheInterfaceWPASupplicantShouldBeDisabledOn" ] then
        Code of the prodecure
    else
        return 0
    fi

After that, i restarted the dhcpcd service with

systemctl restart dhcpcd

Now the InterfaceWPASupplicantShouldBeDisabledOn is no longer a problem using hostapd. This solution is kinda brutal, as i don't think this is supposed to be done like so, but i was not able to find any manual on how to do this another way.

Hope this helps.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.