Linux – systemd: How to unmask a service whose unit file is empty

arch linuxnetwork-interfacesystemd

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?

Best Answer

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.