You are not logged in.

#1 2014-05-28 11:56:17

Marcos FRM
Member
Registered: 2013-02-10
Posts: 14

systemd timer units can not be disabled

Packages that have auto-enabled systemd timers do it by having a symlink in /usr/lib/systemd/system/<target>.target.wants.

This aproach is confusing. For example:

# systemctl status logrotate.timer
? logrotate.timer - Daily rotation of log files
   Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; static)
   Active: active (waiting) since Qua 2014-05-28 07:21:34 BRT; 34min ago

logrotate.timer *is* enabled and if I run systemctl disable it does nothing:

# systemctl disable logrotate.timer
# ls -l /usr/lib/systemd/system/multi-user.target.wants/logrotate.timer
lrwxrwxrwx 1 root root 18 Abr 13 04:13 /usr/lib/systemd/system/multi-user.target.wants/logrotate.timer -> ../logrotate.timer

Probably the behaviour is right. systemd considers /usr package manager territory.

Even with an [Install] section, /usr symlink will override /etc for systemctl disable.

So the only way to disable these units is manually create a null symlink in /etc or (with [Install]) through systemctl mask.

As a former Fedora user, RPM generally auto-enable things in its post install scriptlets via systemctl, working allways in /etc.

BTW, as an experiment, I put a [Install]\nWantedBy=multi-user.target in /usr/lib/systemd/system/logrotate.timer and after systemctl daemon-reload systemd says the unit is disabled:

# systemctl status logrotate.timer
? logrotate.timer - Daily rotation of log files
   Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; disabled)
   Active: active (elapsed) since Qua 2014-05-28 07:21:34 BRT; 1h 9min ago

Is this a bug?

Offline

#2 2014-10-29 18:01:36

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: systemd timer units can not be disabled

I have the same problem with the updatedb.timer. I want to run updatedb manually only, how can I achieve that cleanly with systemd?


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#3 2014-10-29 19:07:22

ratcheer
Member
Registered: 2011-10-09
Posts: 912

Re: systemd timer units can not be disabled

I have the same question, because I want to disable man-db. I was told that I need to "mask" it, but I don't know whether to mask the service, the timer, or both.

Tim

Offline

#4 2014-11-02 15:18:26

lardon
Member
Registered: 2008-05-31
Posts: 264
Website

Re: systemd timer units can not be disabled

"Solved" it for me by setting the timer to monthly. Would still like to know how to disable these units completely.


Autojump, the fastest way to navigate your filesystem from the command line!

Offline

#5 2014-11-02 15:26:03

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: systemd timer units can not be disabled

Have you tried masking them?

Offline

#6 2014-11-22 16:56:38

Marcos FRM
Member
Registered: 2013-02-10
Posts: 14

Re: systemd timer units can not be disabled

Offline

#7 2014-11-24 14:13:52

serdotlinecho
Member
Registered: 2013-01-26
Posts: 100

Re: systemd timer units can not be disabled

If you want to change the timer to monthly or yearly etc, first disable and stop the timer units that you want to change. Then, copy for example, the man-db.timer units file to /etc/systemd/system and change the [Timer] sections. Enable and start the new man-db.timer settings.

$ systemctl cat man-db.timer
# /etc/systemd/system/man-db.timer
[Unit]
Description=Monthly man-db cache update

[Timer] 
OnCalendar=monthly
AccuracySec=12h
Persistent=true
$ systemctl list-timers man-db.timer
NEXT                         LEFT        LAST                         PASSED  UNIT         ACTIVATES
Mon 2014-12-01 00:00:00 MYT  6 days left Mon 2014-11-24 00:00:01 MYT  22h ago man-db.timer man-db.service

1 timers listed.
Pass --all to see loaded but inactive timers, too.

Last edited by serdotlinecho (2014-11-24 14:17:25)

Offline

#8 2014-11-25 09:36:16

Marcos FRM
Member
Registered: 2013-02-10
Posts: 14

Re: systemd timer units can not be disabled

karol wrote:

Have you tried masking them?

It is the only way. Manually:

systemctl stop xxx.timer
cd /etc/systemd/system
ln -s /dev/null xxx.timer
systemctl daemon-reload

Offline

#9 2014-11-25 09:56:27

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: systemd timer units can not be disabled

Why manually?

Offline

#10 2014-11-25 10:09:06

Marcos FRM
Member
Registered: 2013-02-10
Posts: 14

Re: systemd timer units can not be disabled

Because they do not have an [Install] section. systemctl disable/mask will do nothing. Even with [Install] systemctl disable will not change anything because /usr symlink takes precedence.

Offline

#11 2014-11-25 10:57:07

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: systemd timer units can not be disabled

Marcos FRM wrote:

Because they do not have an [Install] section. systemctl disable/mask will do nothing. Even with [Install] systemctl disable will not change anything because /usr symlink takes precedence.

???

# systemctl mask man-db.timer
Created symlink from /etc/systemd/system/man-db.timer to /dev/null.

How is that different from your manual symlink? Obviously disable is not going to do anything for a service that wasn't hooked up using enable, but masking works.

Offline

#12 2014-11-25 11:19:51

Marcos FRM
Member
Registered: 2013-02-10
Posts: 14

Re: systemd timer units can not be disabled

Hmm. I remember trying systemctl mask on older versions without sucess. But it seems fixed now. Thanks for the heads-up!

Offline

#13 2014-11-25 11:21:11

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: systemd timer units can not be disabled

I don't understand either.
Marcos FRM, what do you get when trying to run 'systemctl mask man-db.timer'?

$ sudo systemctl mask man-db.timer
Created symlink from /etc/systemd/system/man-db.timer to /dev/null.
~ $ sudo systemctl unmask man-db.timer
Removed symlink /etc/systemd/system/man-db.timer.

Edit: Too late.

Last edited by karol (2014-11-25 11:21:30)

Offline

Board footer

Powered by FluxBB