You are not logged in.

#1 2020-07-11 12:02:52

volker_weissmann
Member
Registered: 2020-01-05
Posts: 71

[SOLVED] systemctl list-timers says next time is N/A

Hello,

I'm trying to install a systemd timer. I have (nearly) the exactly configuration on two different systems, but the timer only works on one of them.
I installed the timer using systemctl enable --user --now autosync.timer (See autosync.timer and autosync.service below).


working system:

$ systemctl list-timers --all --user
NEXT                         LEFT LAST                         PASSED    UNIT ACTIVATES
Sat 2020-07-11 13:59:02 CEST 5min left Sat 2020-07-11 12:59:02 CEST 54min ago autosync.timer autosync.service

1 timers listed.

non working system:

$ systemctl list-timers --user --all
NEXT LEFT LAST                        PASSED               UNIT           ACTIVATES       
n/a  n/a  Sun 2020-03-22 01:44:34 CET 3 months 20 days ago autosync.timer autosync.service

1 timers listed.

$ systemctl status --user autosync.timer
● autosync.timer - Synchronise every hour
     Loaded: loaded (/etc/xdg/systemd/user/autosync.timer; enabled; vendor preset: enabled)
     Active: active (elapsed) since Sat 2020-07-11 13:41:54 CEST; 18min ago
    Trigger: n/a
   Triggers: ● autosync.service

Jul 11 13:41:54 yoga systemd[711]: Started Synchronise every hour.
Warning: journal has been rotated since unit was started and some journal files were not opened due to insufficient permissions, output may be incomplete.

Does anyone know why the timer does not work on my machine?




/etc/systemd/user/autosync.timer:

[Unit]
Description=Synchronise every hour

[Timer]
OnBootSec=10s
OnUnitActiveSec=1hour
Persistent=true
Unit=autosync.service

[Install]
WantedBy=timers.target

/etc/systemd/user/autosync.service:

[Unit]
Description=Synchronises ILA data

[Service]
Type=simple
ExecStart=/home/volker/SIMTAP_DIR/unison/autosync.sh

UPDATE:
I removed the Persistent=true line and now it works. The fact that it does not work with Persistent=true seems to be a bug:
https://bugs.archlinux.org/task/67384

Last edited by volker_weissmann (2020-07-24 17:44:08)

Offline

#2 2020-07-11 12:18:10

loqs
Member
Registered: 2014-03-06
Posts: 18,860

Re: [SOLVED] systemctl list-timers says next time is N/A

When next time is n/a,  what is the output of

systemctl status --user autosync.service

Please use code tags for commands and their outputs.

Offline

#3 2020-07-11 12:21:31

volker_weissmann
Member
Registered: 2020-01-05
Posts: 71

Re: [SOLVED] systemctl list-timers says next time is N/A

$ systemctl status --user autosync.service
● autosync.service - Synchronises ILA data
     Loaded: loaded (/etc/xdg/systemd/user/autosync.service; static; vendor preset: enabled)
     Active: inactive (dead)
TriggeredBy: ● autosync.timer

Offline

#4 2020-07-11 12:25:12

loqs
Member
Registered: 2014-03-06
Posts: 18,860

Re: [SOLVED] systemctl list-timers says next time is N/A

OnUnitActiveSec specifies a time relative to the last activation of the service.  If the service has not been activated there is no such time hence the n/a.

Offline

#5 2020-07-11 12:31:37

volker_weissmann
Member
Registered: 2020-01-05
Posts: 71

Re: [SOLVED] systemctl list-timers says next time is N/A

But I also have OnBootSec=10s. That's how the the wiki does it.

Offline

#6 2020-07-11 23:39:36

loqs
Member
Registered: 2014-03-06
Posts: 18,860

Re: [SOLVED] systemctl list-timers says next time is N/A

What is the output of

systemctl status --user timers.target
systemctl list-dependencies --user timers.target

Offline

#7 2020-07-12 10:27:10

volker_weissmann
Member
Registered: 2020-01-05
Posts: 71

Re: [SOLVED] systemctl list-timers says next time is N/A

$ systemctl status --user timers.target
● timers.target - Timers
     Loaded: loaded (/usr/lib/systemd/user/timers.target; static; vendor prese>
     Active: active since Sat 2020-07-11 13:41:54 CEST; 22h ago
       Docs: man:systemd.special(7)

Jul 11 13:41:54 yoga systemd[711]: Reached target Timers.
$ systemctl list-dependencies --user timers.target
timers.target
● └─autosync.timer

Offline

#8 2020-07-12 18:08:08

loqs
Member
Registered: 2014-03-06
Posts: 18,860

Re: [SOLVED] systemctl list-timers says next time is N/A

The timer unit starts and expires but the service it starts was not activated?
What is in the journal for the service and timer

journalctl --user -b -u autosync.timer -u autosync.service

Offline

#9 2020-07-12 21:43:01

volker_weissmann
Member
Registered: 2020-01-05
Posts: 71

Re: [SOLVED] systemctl list-timers says next time is N/A

$ journalctl --user -b -u autosync.timer -u autosync.service
-- Logs begin at Sun 2020-01-05 23:21:59 CET, end at Sun 2020-07-12 23:40:45 CEST. --
Jul 12 12:29:21 yoga systemd[777]: Started Synchronise every hour.

Offline

#10 2026-03-13 00:19:53

MxuZZt2FKrGxZbjD6MWgYd
Member
Registered: 2019-12-24
Posts: 3

Re: [SOLVED] systemctl list-timers says next time is N/A

I had this same issue and found the solution. From the systemd timer documentation:

Use systemctl clean --what=state … on the timer unit to remove the timestamp file maintained by this option from disk. In particular, use this command before uninstalling a timer unit. See systemctl(1) for details.

At some point my system must have messed up this timestamp file. Using the clean command fixed it. I can still have

Persistent=true

Offline

#11 2026-03-13 01:25:45

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,613

Re: [SOLVED] systemctl list-timers says next time is N/A

Thank you for the post, but be aware that this thread is almost six years old....

Using this opportunity to close this old thread.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB