[mythtv-users] anacron time change after upgrade to Ubuntu 18.04

Jim Abernathy jfabernathy at gmail.com
Thu Nov 8 11:55:50 UTC 2018


>>>>>>> To change it back to how it used to be, I created a systemd override
>>>>>>> file for anacron.timer:
>>>>>>>
>>>>>>> root at mypvr:/etc/systemd/system# ll -d ana*
>>>>>>> drwxr-xr-x 2 root root 4096 Oct 21 01:13 anacron.timer.d/
>>>>>>> root at mypvr:/etc/systemd/system# cd anacron.timer.d/
>>>>>>> root at mypvr:/etc/systemd/system/anacron.timer.d# ll
>>>>>>> total 12
>>>>>>> drwxr-xr-x  2 root root 4096 Oct 21 01:13 ./
>>>>>>> drwxr-xr-x 27 root root 4096 Oct 23 23:45 ../
>>>>>>> -rw-r--r--  1 root root  166 Oct 21 01:13 anacron-timer-override.conf
>>>>>>> root at mypvr:/etc/systemd/system/anacron.timer.d# cat
>>>>>>> anacron-timer-override.conf
>>>>>>> [Unit]
>>>>>>> Description=Trigger anacron at 07:30, as happened before the Ubuntu
>>>>>>> 18.04 upgrade.
>>>>>>>
>>>>>>> [Timer]
>>>>>>> OnCalendar=
>>>>>>> OnCalendar=07:30
>>>>>>> RandomizedDelaySec=0s
>>>>>>> Persistent=true
>>>>>>>
>>>>>>> If you want to create an override file like mine, the easy way is to
>>>>>>> do this command:
>>>>>>>
>>>>>>> sudo systemctl edit anacron.timer
>>>>>>>
>>>>>>> and paste my override file into it.  The systemctl edit command is
>>>>>>> only available in newer versions of systemd, but it is very useful as
>>>>>>> it sets up the override directory and .conf file with the right
>>>>>>> ownership and permissions automatically.
>>>>>>>
>>>>>>> I have filed a bug report about this problem, but I have not had any
>>>>>>> response to it yet:
>>>>>>>
>>>>>>> https://bugs.launchpad.net/ubuntu/+source/anacron/+bug/1799361
>>>>>> This is a great explanation and very helpful.  I've duplicated what you
>>>>>> did and will look for the changes to take affect tomorrow.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Jim A
>>>>> You can check to see what is going to happen by using:
>>>>>
>>>>> sudo systemctl status anacron.timer
>>>>> sudo systemctl status anacron
>>>> Well something went wrong. Both jobs ran a 12:07AM install of 7:35AM.
>>>>
>>>> It's now about 6:35AM.
>>>>
>>>> I just ran the 2 systemctl commands and their output is below:
>>>>
>>>> jim at mythbuntu:~$*sudo systemctl status anacron.timer*
>>>> [sudo] password for jim:
>>>> ? anacron.timer - Trigger anacron at 07:30, as happened before the Ubuntu
>>>>      Loaded: loaded (/lib/systemd/system/anacron.timer; bad; vendor
>>>> preset: enable
>>>>     Drop-In: /etc/systemd/system/anacron.timer.d
>>>>              ??override.conf
>>>>      Active: active (waiting) since Tue 2018-11-06 15:36:31 EST; 15h ago
>>>>     Trigger: Wed 2018-11-07 07:01:40 EST; 24min left
>>>>
>>>> Nov 06 15:36:31 mythbuntu systemd[1]: Started Trigger anacron at 07:30,
>>>> as happe
>>>> Nov 07 06:37:18 mythbuntu systemd[1]:
>>>> /etc/systemd/system/anacron.timer.d/overri
>>>> jim at mythbuntu:~$
>>>> jim at mythbuntu:~$ *sudo systemctl status anacron*
>>>> ? anacron.service - Run anacron jobs
>>>>      Loaded: loaded (/lib/systemd/system/anacron.service; enabled; vendor
>>>> preset:
>>>>      Active: inactive (dead) since Wed 2018-11-07 06:05:27 EST; 33min ago
>>>>        Docs: man:anacron
>>>>              man:anacrontab
>>>>     Process: 7771 ExecStart=/usr/sbin/anacron -dsq (code=exited,
>>>> status=0/SUCCESS)
>>>>    Main PID: 7771 (code=exited, status=0/SUCCESS)
>>>>
>>>> Nov 07 06:05:27 mythbuntu systemd[1]: Started Run anacron jobs.
>>>> Nov 07 06:05:27 mythbuntu anacron[7771]: Anacron 2.3 started on 2018-11-07
>>>> Nov 07 06:05:27 mythbuntu anacron[7771]: Normal exit (0 jobs run)
>>>> jim at mythbuntu:~$
>>>>
>>>> I got some advice from the Ubuntu forum to not use anacron for precise
>>>> timing stuff but use cron.  I've haven't explored what that person meant.
>>>>
>>>> "That doesn't alter anacron's behavior of only supporting 24 hour
>>>> resolution in jobs.
>>>>
>>>> If you need control to the minute, use cron."
>>>>
>>>> Jim A
>>> Anacron is still being run every hour, according to the results of the
>>> status commands.  So it looks like the systemctl edit command did not
>>> do everything necessary for the new override to take effect.  Please
>>> do these commands and see if anacron.timer is then scheduled for
>>> 07:30:
>>>
>>> sudo systemctl stop anacron.timer
>>> sudo systemctl daemon-reload
>>> sudo systemctl start anacron.timer
>>> sudo systemctl status anacron.timer
>>> sudo systemctl status anacron
>>>
>> at this point I have been convinced that I should just leave the anacron
>> stuff as it shipped from the factory and not mess with it.
> Uhh, why?  I have it working on my system, and systemd is telling you
> what it is doing.  Please just try the above commands, or just reboot.
> Either should fix the problem that systemd is not yet running the
> override file.
>
Okay, I'll try your method again. So here's my steps.

First the changes I made to /etc/crontab did work and my DB maintenance 
ran at 6:25 AM.

I removed the line I added into crontab and put the scripts back into 
/etc/cron.daily.

I used 'sudo systemctl edit anacron.timer' to add the override stuff:

[Unit]
Description=Trigger anacron at 07:30, as happened before the Ubuntu 18.04 upgrade.

[Timer]
OnCalendar=
OnCalendar=07:30
RandomizedDelaySec=0s
Persistent=true

-------

Then here is your sequence of commands:

jim at mythbuntu:~$ sudo systemctl stop anacron.timer
Warning: The unit file, source configuration file or drop-ins of anacron.timer changed on disk. Run 'systemctl daemon-reload' to reload units.
jim at mythbuntu:~$ sudo systemctl daemon-reload
jim at mythbuntu:~$ sudo systemctl start anacron.timer
jim at mythbuntu:~$ sudo systemctl status anacron.timer
● anacron.timer - Trigger anacron at 07:30, as happened before the Ubuntu 18.04 upgrade.
    Loaded: loaded (/lib/systemd/system/anacron.timer; enabled; vendor preset: enabled)
   Drop-In: /etc/systemd/system/anacron.timer.d
            └─override.conf
    Active: active (waiting) since Thu 2018-11-08 06:49:57 EST; 13s ago
   Trigger: Thu 2018-11-08 07:30:00 EST; 39min left

Nov 08 06:49:57 mythbuntu systemd[1]: Started Trigger anacron at 07:30, as happened before the Ubuntu 18.04 upgrad
jim at mythbuntu:~$ sudo systemctl status anacron
● anacron.service - Run anacron jobs
    Loaded: loaded (/lib/systemd/system/anacron.service; enabled; vendor preset: enabled)
    Active: inactive (dead) since Thu 2018-11-08 06:05:05 EST; 45min ago
      Docs: man:anacron
            man:anacrontab
  Main PID: 7099 (code=exited, status=0/SUCCESS)

Nov 08 06:05:05 mythbuntu systemd[1]: Started Run anacron jobs.
Nov 08 06:05:05 mythbuntu anacron[7099]: Anacron 2.3 started on 2018-11-08
Nov 08 06:05:05 mythbuntu anacron[7099]: Normal exit (0 jobs run)
jim at mythbuntu:~$

Not sure what's happening, but we'll see in ~35 minutes.

Jim A




More information about the mythtv-users mailing list