Skip to content

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:

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

CUPS'i ehk Linuxi printerite seadistamine eemalt

Sul on mingid Linuxiline arvuti, kus on vaja printereid eemalt seadistada (seda juhib deemon nimega cupsd). Võid sinna arvutisse sisse logida ja käsurealt möllata või seadistada, et selle arvuti cupsd lubab end veebiliidesest seadistada.

Kuna tavaliselt seda vaja teha üliharva, siis hoopis lihtsam lahendus on ssh tunnel, mille teed oma arvutis käsurealt nii (miskimasin on see, kus vajad seadistamist):
ssh root@miskimasin -T -L 6631:localhost:631

Ja siis võtad oma arvuti veebibrauseri ette:
localhost:6631
ning teed mis vaja. Kui kõik on valmis, siis paned käsurealt Ctrl+C abil ssh tunneli kinni.

Arvuti võib lauaarvuti, sülearvuti või nutitelefon - peaasi, et seal toimivad sshd ja cupsd. Proovinud ei ole, aga sama peaks toimima ka Mac OS X puhul (kui sshd on lubatud).