Systemd - when systemctl unmask command fails
When you are using a typical modern Linux, where systemd is the init system, then you should be able to enable/disable daemons with:
Well, in this case, check how things are:
So the fix is simple - delete the symlinked one, rename the right one, enable and start the daemon:
systemctl enable somename.service
systemctl disable somename.service
and mask/unmask them with:systemctl mask somename.service
systemctl unmask somename.service
In real life you may end up with the simple fact that unmask command does not do anything (my last case was with SANE daemon - used for running scanners in Linux):
systemctl unmask saned
systemctl status saned
● saned.service
Loaded: masked (/dev/null; bad)
Active: inactive (dead)
Well, in this case, check how things are:
file /lib/systemd/system/saned.service
/lib/systemd/system/saned.service: symbolic link to /dev/null
or
cd /lib/systemd/system/
ls -l sane*
lrwxrwxrwx 1 root root 9 mai 21 11:04 saned.service -> /dev/null
-rw-r--r-- 1 root root 309 mai 21 11:04 saned@.service
-rw-r--r-- 1 root root 132 mai 21 11:04 saned.socket
Which means that SANE unit file saned.service is symlinked to /dev/null and won't do anything, but there is a renamed unitfile saned@.service.So the fix is simple - delete the symlinked one, rename the right one, enable and start the daemon:
cd /lib/systemd/system/
rm saned.service
mv saned@.service saned.service
systemctl enable saned.service
systemctl start saned.service