Score:1

Masking systemd service

us flag

I am installing a few third party rpms in my system, and one of those rpm packages a systemd service file, and a preset file to enable the service. I want to keep the service disabled and masked.

For disabling, systemd provides preset framework and I can write a preset file with higher priority.

But how do I mask the service? Is there a configuration file I can install, similar to preset files? Or I have to add a cron job to run on node reboot to mask the service?

Nikita Kipriyanov avatar
za flag
A generic way of doing it is to write an Ansible playbook which installs packets and then disables and masks unneeded services.
Score:1
fr flag

systemctl actually tells you how to do it whenever you mask a service:

# systemctl mask foo
Created symlink /etc/systemd/system/foo.service → /dev/null.

"Masking" a service is similar to the mechanism of overriding a service, where unit configuration in /etc will take priority over the one in /usr/lib. (This is a common pattern in systemd, where local administrator settings in /etc have priority over distribution settings in /usr/lib.)

A service that is overridden with a symlink to /dev/null (or with an empty regular file, but symlink is preferred) will be considered "masked" by systemd.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.