4

I am trying to troubleshoot wpa_supplicant on a smaller tablet. The tablet is using systemd to run a wpa_supplicant.service which has an entry

ExecStart=/usr/sbin/wpa_supplicant -u

I would like to stop this service and run wpa_supplicant with a custom configuration instead of using the D-BUS interface. So I entered

systemctl stop wpa_supplicant

to stop the original service. The command succeeds, but unfortunately the service is restarted immediately. This is most unfortunate, since multiple instances of wpa_supplicant cannot really coexist.

Since I do not know that much about systemd: Why is the service immediately restarted? How can I prevent this from happening? Is this due to some service dependencies that I am not aware of?

The service definition in its entirety is given by:

[Unit]
Description=WPA supplicant
Before=network.target
Wants=network.target

[Service]
Type=dbus
BusName=fi.w1.wpa_supplicant1
ExecStart=/usr/sbin/wpa_supplicant -u

[Install]
WantedBy=multi-user.target
Alias=dbus-fi.w1.wpa_supplicant1.service

Edit: The services which are up are

   CGroup: /
           |-init.scope 
           | `-1 /sbin/init
           `-system.slice 
             |-systemd-timesyncd.service 
             | `-154 /lib/systemd/systemd-timesyncd
             |-crashuploader.service 
             | `-228 /usr/bin/crashuploader --path /home/root/
             |-sync.service 
             | `-181 /usr/bin/sync --service
             |-system-dropbear.slice 
             | `[email protected]:22-10.11.99.3:49522.service 
             |   |-2831 /usr/sbin/dropbear -i -r /etc/dropbear/dropbear_rsa_host_key -B
             |   |-2832 -sh
             |   |-2841 systemctl status
             |   `-2842 less
             |-dbus.service 
             | `-176 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
             |-update-engine.service 
             | `-185 /usr/sbin/update_engine -foreground
             |-system-serial\x2dgetty.slice 
             | `[email protected] 
             |   `-180 /sbin/agetty -8 -L ttymxc0 115200 xterm
             |-system-getty.slice 
             | `[email protected] 
             |   `-179 /sbin/agetty -o -p -- \x5cu --noclear tty1 linux
             |-wpa_supplicant.service 
             | `-2754 /usr/sbin/wpa_supplicant -u
             |-systemd-logind.service 
             | `-217 /lib/systemd/systemd-logind
             |-system-busybox\x2difplugd.slice 
             | `[email protected] 
             |   `-175 /usr/sbin/ifplugd -n -i usb0
             |-systemd-udevd.service 
             | `-135 /lib/systemd/systemd-udevd
             |-systemd-journald.service 
             | `-134 /lib/systemd/systemd-journald
             |-dhcpcd.service 
             | `-198 /usr/sbin/dhcpcd -4 -b --master wlan0
             |-haveged.service 
             | `-133 /usr/sbin/haveged -w 1024 -v 1 --Foreground
             |-systemd-networkd.service 
             | `-145 /lib/systemd/systemd-networkd
             |-system-busybox\x2dudhcpd.slice 
             | `[email protected] 
             |   `-1781 /usr/sbin/udhcpd -f /etc/udhcpd.usb0.conf
             |-xochitl.service 
             | `-229 /usr/bin/xochitl --system
             `-qmdns-responder.service 
               `-258 /usr/bin/qmdns-responder
4
  • systemctl disable wpa_supplicant? Feb 2, 2022 at 16:05
  • Sorry, that does not seem to have any effect...
    – hfhc2
    Feb 2, 2022 at 16:17
  • restarting the device? Feb 2, 2022 at 16:22
  • Well, apparently the service is started from elsewhere. The "disable" does not remove any symlinks...
    – hfhc2
    Feb 2, 2022 at 17:56

1 Answer 1

4

You can mask a service to prevent it from being started by systemd.

Just run systemctl mask wpa_supplicant.service. This this will prevent the service from being started by systemd until it is unmasked.

You can unmask the service by running systemctl unmask wpa_supplicant.service.

Keep in mind that this will prevent anything from starting the service via systemd, including other services that may expect or need the service to be running in order to run themselves.

From the systemctl man page:

       mask UNIT...
           Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it impossible to start them. This is a stronger version of disable, since it prohibits all kinds of
           activation of the unit, including enablement and manual activation. Use this option with care. This honors the --runtime option to only mask temporarily until the next reboot of the system. The --now option may be used
           to ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit file paths.

       unmask UNIT...
           Unmask one or more unit files, as specified on the command line. This will undo the effect of mask. This command expects valid unit names only, it does not accept unit file paths.
1
  • 1
    Thanks, that seems to have done the trick
    – hfhc2
    Feb 2, 2022 at 16:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .