3

I tried to start wpa_supplicant.service, but I got the following error:

Failed to start wpa_supplicant.service: Unit wpa_supplicant.service is masked.

I tried unmasking it using systemctl unmask wpa_supplicant.service, but it doesn't seem to change anything.

systemctl status wpa_supplicant.service

returns

Loaded: masked (/usr/lib/systemd/system/wpa_supplicaant.service; masked; vendor preset: disabled) Active: inactive (dead)

What seems really strange is that when I check the wpa_supplicant.service file it's an empty document.
How can I unmask the service?

  • I'm using Arch Linux my problem is i want to start a netctl profile and wpa_supplicant is needed to bring the interface up but since it's masked i get an error ... is there any other ways to start wpa_supplicant? – user189141 Sep 9 '16 at 17:46
  • I also tried using NetworkManager but it also depends on wpa_supplicant – user189141 Sep 9 '16 at 17:49
  • See exactly what is masked: systemctl list-unit-files --state=masked – jasonwryan Sep 9 '16 at 19:06
  • wpa_supplicant-nl80211@.service wpa_supplicant-wired@.service wpa_supplicant.service wpa_supplicant@.service – user189141 Sep 9 '16 at 19:11
  • when i try to unmask any other service besides wpa_supplicant.service i get the following error: Failed to get properties: Unit name *.service is missing the instance name. – user189141 Sep 9 '16 at 19:26
3

A service unit that is empty (0 bytes) will be parsed by systemd as masked. While systemctl mask <unit> works by symlinking the service to /dev/null, systemd appears to just check if a file is 0 bytes when read to determine if a unit is masked. This results in the misleading message about a masked service.
You need to figure out why the service unit is empty.

As to how to unmask a service whose unit file is empty... You "unmask" the service by making the unit non-empty, which is going to be dependent on why the unit is empty.

0

8 comments and no answer - really guys, focus on the question. How to unmask a systemd service!!!! You can try systemctl unmask your_app.service , but if your service link has been symlinked to /dev/null, this will fail. The following is the recommended process:

  1. Check that the unit file is a symlink to /dev/null:

    file /lib/systemd/system/your_app.service
    

    It should return:

    /lib/systemd/system/your_app.service: symbolic link to /dev/null
    
  2. Delete the symlink:

    sudo rm /lib/systemd/system/your_app.service
    
  3. Reload systemd daemon as you changed a service:

    sudo systemctl daemon-reload
    
  4. Check the status:

    systemctl status your_app
    

Happy Hosting :)

  • 3
    If you bothered reading those comments instead of "focusing (exclusively) on the question" you'd know that your answer doesn't apply here... – don_crissti Mar 27 '18 at 10:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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