10

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?

6
  • 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
    Commented Sep 9, 2016 at 17:46
  • I also tried using NetworkManager but it also depends on wpa_supplicant
    – user189141
    Commented Sep 9, 2016 at 17:49
  • See exactly what is masked: systemctl list-unit-files --state=masked
    – jasonwryan
    Commented Sep 9, 2016 at 19:06
  • [email protected] [email protected] wpa_supplicant.service [email protected]
    – user189141
    Commented Sep 9, 2016 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
    Commented Sep 9, 2016 at 19:26

2 Answers 2

13

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
    OR
    file /etc/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 :)

2
  • 6
    If you bothered reading those comments instead of "focusing (exclusively) on the question" you'd know that your answer doesn't apply here... Commented Mar 27, 2018 at 10:08
  • I'm not sure if "deleting a file/symlink" created during package installation is really a viable solution. At least - after reinstalling the pulseaudio-package (to get this symlink to /dev/null back), everything worked as expected :-)
    – Gerd
    Commented Jan 3 at 21:15
9

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.

1
  • just curious about the check. is masked service is zero-length or it must be linked to /dev/null. can't find spec about it.
    – Kevin Chan
    Commented Nov 23, 2022 at 11:17

You must log in to answer this question.

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