btrfsmaintenance broken

btrfsmaintenance cron jobs are missing (again), this time the jobs cannot be rescued by either the refresh service or forced reinstall. Journal gives some clues:


Jan 18 19:20:38 asus systemd[1]: /etc/systemd/system/btrfs-trim.timer.d/schedule.conf:2: Failed to parse calendar specification, ignoring: none
Jan 18 19:20:38 asus systemd[1]: /etc/systemd/system/btrfs-defrag.timer.d/schedule.conf:2: Failed to parse calendar specification, ignoring: none

can anyone else confirm this issue, or give hints into how to fix?

No, they are not missing.
They have been converted to systemd timers.

See e.g. Welcome - openSUSE Build Service

Journal gives some clues:

Jan 18 19:20:38 asus systemd[1]: /etc/systemd/system/btrfs-trim.timer.d/schedule.conf:2: Failed to parse calendar specification, ignoring: none
Jan 18 19:20:38 asus systemd[1]: /etc/systemd/system/btrfs-defrag.timer.d/schedule.conf:2: Failed to parse calendar specification, ignoring: none

can anyone else confirm this issue, or give hints into how to fix?

Maybe it would help if you posted the content of those mentioned files?
Apparently the calendar specifications are wrong, sounds like they are set to “none”.

And AFAICS, the refresh script (that writes those files) takes the values from /etc/sysconfig/btrfsmaintenance and/or /etc/default/btrfsmaintenance, so better post those too.

Seems like the timers are enabled by mistake even if set to “none” (which causes those error messages in the journal), but that apparently has been fixed in the devel project recently:

great observation.

i was hasty in simply running the refresh service and then force installing btrfsmaintainance, this should (under new system) be installed yes?

/etc/systemd/system/btrfs-trim.timer.d/


[Timer]
OnCalendar=none

/etc/systemd/system/btrfs-balance.timer.d/

[Timer]
OnCalendar=weekly

not surprisingly /etc/sysconfig/btrfsmaintenance shows


BTRFS_BALANCE_PERIOD="weekly"
BTRFS_TRIM_PERIOD="none"

for the error messages after reboot to make sure i had not triggered anything


sudo journalctl -b | grep btrfs
Jan 18 20:26:57 asus systemd[1]: /etc/systemd/system/**btrfs**-trim.timer.d/schedule.conf:2: Failed to parse calenda
r specification, ignoring: none
Jan 18 20:26:57 asus systemd[1]: /etc/systemd/system/**btrfs**-defrag.timer.d/schedule.conf:2: Failed to parse calen
dar specification, ignoring: none
Jan 18 20:26:59 asus systemd[1]: Started Balance block groups on a **btrfs** filesystem.
Jan 18 20:26:59 asus systemd[1]: Starting Update cron periods from /etc/sysconfig/**btrfs**maintenance...
Jan 18 20:26:59 asus **btrfs**maintenance-refresh-cron.sh[1103]: Refresh script **btrfs**-scrub.sh for uninstall
Jan 18 20:26:59 asus **btrfs**maintenance-refresh-cron.sh[1103]: Refresh script **btrfs**-defrag.sh for uninstall
Jan 18 20:26:59 asus systemd[1]: Started Scrub **btrfs** filesystem, verify block checksums.
Jan 18 20:26:59 asus **btrfs**maintenance-refresh-cron.sh[1103]: Refresh script **btrfs**-balance.sh for uninstall
Jan 18 20:26:59 asus **btrfs**maintenance-refresh-cron.sh[1103]: Refresh script **btrfs**-trim.sh for uninstall
Jan 18 20:26:59 asus **btrfs**maintenance-refresh-cron.sh[1103]: Refresh timer **btrfs**-scrub for monthly
Jan 18 20:26:59 asus systemd[1]: /etc/systemd/system/**btrfs**-trim.timer.d/schedule.conf:2: Failed to parse calenda
r specification, ignoring: none
Jan 18 20:26:59 asus systemd[1]: /etc/systemd/system/**btrfs**-defrag.timer.d/schedule.conf:2: Failed to parse calen
dar specification, ignoring: none
Jan 18 20:26:59 asus **btrfs**maintenance-refresh-cron.sh[1103]: Refresh timer **btrfs**-defrag for none
Jan 18 20:26:59 asus systemd[1]: /etc/systemd/system/**btrfs**-trim.timer.d/schedule.conf:2: Failed to parse calenda
r specification, ignoring: none
Jan 18 20:26:59 asus systemd[1]: /etc/systemd/system/**btrfs**-defrag.timer.d/schedule.conf:2: Failed to parse calen
dar specification, ignoring: none
Jan 18 20:27:00 asus **btrfs**maintenance-refresh-cron.sh[1103]: Refresh timer **btrfs**-balance for weekly
Jan 18 20:27:00 asus systemd[1]: /etc/systemd/system/**btrfs**-trim.timer.d/schedule.conf:2: Failed to parse calenda
r specification, ignoring: none
Jan 18 20:27:00 asus systemd[1]: /etc/systemd/system/**btrfs**-defrag.timer.d/schedule.conf:2: Failed to parse calen
dar specification, ignoring: none
Jan 18 20:27:00 asus **btrfs**maintenance-refresh-cron.sh[1103]: Refresh timer **btrfs**-trim for none
Jan 18 20:27:00 asus systemd[1]: /etc/systemd/system/**btrfs**-trim.timer.d/schedule.conf:2: Failed to parse calenda
r specification, ignoring: none
Jan 18 20:27:00 asus systemd[1]: /etc/systemd/system/**btrfs**-defrag.timer.d/schedule.conf:2: Failed to parse calen
dar specification, ignoring: none
Jan 18 20:27:00 asus systemd[1]: Started Update cron periods from /etc/sysconfig/**btrfs**maintenance.


for more info


nicholas@asus:~> sudo systemctl list-timers                            

NEXT                         LEFT                LAST                         PASSED             UNIT            
Fri 2018-01-19 00:00:00 CET  3h 7min left        Thu 2018-01-18 07:54:08 CET  12h ago            logrotate.timer
Fri 2018-01-19 20:41:56 CET  23h left            Thu 2018-01-18 20:41:56 CET  10min ago          systemd-tmpfile
Mon 2018-01-22 00:00:00 CET  3 days left         Mon 2018-01-15 07:47:10 CET  3 days ago         btrfs-balance.t
Mon 2018-01-22 00:00:00 CET  3 days left         Mon 2018-01-15 07:47:10 CET  3 days ago         fstrim.timer    
Thu 2018-02-01 00:00:00 CET  1 weeks 6 days left Mon 2018-01-01 00:00:25 CET  2 weeks 3 days ago btrfs-defrag.ti
Thu 2018-02-01 00:00:00 CET  1 weeks 6 days left Mon 2018-01-01 00:00:25 CET  2 weeks 3 days ago btrfs-scrub.tim
Thu 2018-02-01 00:00:00 CET  1 weeks 6 days left Mon 2018-01-01 00:00:25 CET  2 weeks 3 days ago btrfs-trim.time

btrfsmaintenance?
Yes, that should be installed, if you use btrfs at least.

not surprisingly /etc/sysconfig/btrfsmaintenance shows

BTRFS_BALANCE_PERIOD=“weekly”
BTRFS_TRIM_PERIOD=“none”

That’s the trim period, that affects btrfs-trim.timer .
I suppose BTRFS_DEFRAG_PERIOD is set to “none” as well…

So, if you want those services to be run periodically, you’d need to change the settings in /etc/sysconfig/btrfsmaintenance accordingly.
(these two are indeed set to “none” by default according to the comments in that file)

The error messages should be only cosmetical I think, as indicated they are caused by the fact that the timer is enabled even though it’s set to “none” (which has been fixed already in the devel project). The corresponding services won’t be run because of the errors, but that’s the intended effect of “none” anyway… :wink:
You can ignore the errors IMHO, or if you do want to get rid of them, I suppose it should suffice to disable the corresponding timers manually.
E.g. “systemctl disable btrfs-trim.timer”

If you enable them by setting some proper period, the “error” messages should disappear too I think.

for more info

nicholas@asus:~> sudo systemctl list-timers

NEXT LEFT LAST PASSED UNIT
Fri 2018-01-19 00:00:00 CET 3h 7min left Thu 2018-01-18 07:54:08 CET 12h ago logrotate.timer
Fri 2018-01-19 20:41:56 CET 23h left Thu 2018-01-18 20:41:56 CET 10min ago systemd-tmpfile
Mon 2018-01-22 00:00:00 CET 3 days left Mon 2018-01-15 07:47:10 CET 3 days ago btrfs-balance.t
Mon 2018-01-22 00:00:00 CET 3 days left Mon 2018-01-15 07:47:10 CET 3 days ago fstrim.timer
Thu 2018-02-01 00:00:00 CET 1 weeks 6 days left Mon 2018-01-01 00:00:25 CET 2 weeks 3 days ago btrfs-defrag.ti
Thu 2018-02-01 00:00:00 CET 1 weeks 6 days left Mon 2018-01-01 00:00:25 CET 2 weeks 3 days ago btrfs-scrub.tim
Thu 2018-02-01 00:00:00 CET 1 weeks 6 days left Mon 2018-01-01 00:00:25 CET 2 weeks 3 days ago btrfs-trim.time

Looks good, I’d say… :wink:

They are re-enabled by btrfsmaintenanace-refresh.service which runs on every boot (and is enabled by default).

Ah ok.
I somehow suspected that might be the case, but haven’t checked…