systemd: How to unmask a service whose unit file is empty?
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.
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:
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
Delete the symlink:
sudo rm /lib/systemd/system/your_app.service
Reload systemd daemon as you changed a service:
sudo systemctl daemon-reload
Check the status:
systemctl status your_app
Happy Hosting :)