Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 531032 - app-admin/sysstat-11.0.2 - /etc/cron.d/sysstat format incompatible with sys-process/dcron
Summary: app-admin/sysstat-11.0.2 - /etc/cron.d/sysstat format incompatible with sys-p...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Georgy Yakovlev
URL:
Whiteboard:
Keywords: NeedPatch, PullRequest
Depends on:
Blocks:
 
Reported: 2014-11-28 20:22 UTC by Robert Trace
Modified: 2020-11-24 02:02 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Add (back) a cron USE flag (sysstat-11.0.5_ebuild_USE_cron.patch,659 bytes, patch)
2015-06-20 01:40 UTC, Hank Leininger
Details | Diff
Add (back) a cron USE flag; refuse to install with cron enabled if incompatible dcron is in use (sysstat-11.0.6_ebuild_USE_cron.patch,994 bytes, patch)
2015-08-29 01:40 UTC, Hank Leininger
Details | Diff
Add IUSE=+cron, and refuse to install when dcron is in use, to avoid errors. (sysstat-11.2.0_ebuild_USE_cron.patch,946 bytes, patch)
2016-02-26 02:12 UTC, Hank Leininger
Details | Diff
user patch as workaround for dcron/sysstat problem (sysstat-cron-owner.patch,616 bytes, patch)
2018-11-17 05:03 UTC, email200202
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Trace 2014-11-28 20:22:34 UTC
sysstat-11.0.2 installs a cron file in /etc/cron.d that's compatible with vixie/cronie but not dcron.  vixie/cronie uses /etc/cron.d for system jobs, so the username field is required.  dcron runs everything as root, so the username field can not be there.

See bug #493706 for the same problem with a different program.


Reproducible: Always

Steps to Reproduce:
1. install dcron
2. install sysstat
3. wait 10 minutes
Actual Results:  
error e-mail generated from dcron:

Subject: cron for user root root /usr/lib64/sa/sa1 1 1

/bin/sh: root: command not found

---

These messages are repeated every 10 minutes.
Comment 1 Hank Leininger 2015-06-20 01:38:01 UTC
This happens now (still?) with sysstat-11.0.5.

But it has gotten slightly worse, because installing crontab files has become non-optional (I think as a result of #547846).  I don't care to have the sysstat cron jobs run, I only install the package for interactive use of tools like 'iostat'.

The attached patch does not actually fix the /etc/cron.d/ file for compatibility with dcron, but it does re-add the 'cron' USE flag, which seems useful in its own right.
Comment 2 Hank Leininger 2015-06-20 01:40:04 UTC
Created attachment 405390 [details, diff]
Add (back) a cron USE flag
Comment 3 Thomas Capricelli 2015-06-28 00:23:48 UTC
Hit by this since i've updated to app-admin/sysstat-11.0.5
(was using 11.0.4 installed on april 29th before this)
Comment 4 Thomas Capricelli 2015-08-26 13:12:46 UTC
Hit again by this. I "fix" it by deleting /etc/cron.d/sysstat, but i'm probably missing some functionality. Moreover i have to do this on every server for each update ..
Comment 5 Hank Leininger 2015-08-29 01:38:57 UTC
Same, this hit me again because app-admin/sysstat got a version bump without any fix for this, so the fixed version in my local overlay got superseded.

Attaching an updated workaround patch; in addition to re-adding the cron use flag, this causes merging to fail with USE=cron if dcron is installed - since USE=cron does not support dcron.
Comment 6 Hank Leininger 2015-08-29 01:40:13 UTC
Created attachment 410548 [details, diff]
Add (back) a cron USE flag; refuse to install with cron enabled if incompatible dcron is in use
Comment 7 Hank Leininger 2015-10-06 02:32:28 UTC
Another sysstat version bump, and the problem is still present.

The previous patch applies cleanly to sysstat-11.0.7.ebuild, and once again fixes the problem.

Can this be applied to the ebuild in portage please?  Or if dcron is not going to be supported by Gentoo, should it be removed from portage?
Comment 8 Thomas Capricelli 2016-01-23 11:28:39 UTC
Please, i've been hit by this bug, again.
Comment 9 Jeroen Roovers (RETIRED) gentoo-dev 2016-02-05 06:38:25 UTC
You can set CONFIG_PROTECT on it.
Comment 10 Jeroen Roovers (RETIRED) gentoo-dev 2016-02-05 06:54:40 UTC
Comment on attachment 410548 [details, diff]
Add (back) a cron USE flag; refuse to install with cron enabled if incompatible dcron is in use

Why does your ebuild change what happens with SYSSTAT_FAKE_RC_DIR?
Comment 11 Hank Leininger 2016-02-26 02:11:06 UTC
> You can set CONFIG_PROTECT on it.

AFAIK that works for fixing dcron-compatibility in the existing file by hand, once deployed.  But not for telling portage "don't install this file, I don't want the cron job" (which in my case is true - I like iostat, but don't care to have sar cron jobs run).  I suppose you could hand-edit the file to be empty or a noop, and trust CONFIG_PROTECT to not overwrite it.  If that is the preferred solution, I'll just do that on all my boxes and move on.  But it will still be broken for any user of dcron who emerges sysstat.

> Why does your ebuild change what happens with SYSSTAT_FAKE_RC_DIR?

The short answer is, without that, emerge blows up during src_install if USE=-cron:

rm: cannot remove '/var/tmp/portage/app-admin/sysstat-11.2.0-r1/image//Gentoo-does-not-use-rc.d': No such file or directory

I _think_ it is because the directory is only created when configure has been told --enable-install-cron.  In the in-tree ebuild, that is unconditionally set, so the dir needs to be unconditionally removed.  But when disabled with USE=-cron, the dir isn't created, so doesn't need to be removed as part of install.

I noticed something else, though: the version of my patch attached to this bug is old, and it adds IUSE="cron" instead of IUSE="+cron".  +cron is better I think, because that way users who have no problem and do nothing at all, keep the same behavior as now.  Only users who choose to set USE=-cron for sysstat see any change in behavior.I'll update this with the version in bug #571012.
Comment 12 Hank Leininger 2016-02-26 02:12:38 UTC
Created attachment 426576 [details, diff]
Add IUSE=+cron, and refuse to install when dcron is in use, to avoid errors.
Comment 13 Thomas Capricelli 2016-08-26 19:18:51 UTC
hit again by this bug with 11.4.0 ebuild, which, if i understand well, has no 'cron' USE flag anyway.
Comment 14 Thomas Capricelli 2017-01-27 19:25:38 UTC
(In reply to Hank Leininger from comment #7)
> Another sysstat version bump, and the problem is still present.
> 
> The previous patch applies cleanly to sysstat-11.0.7.ebuild, and once again
> fixes the problem.
> 
> Can this be applied to the ebuild in portage please?  Or if dcron is not
> going to be supported by Gentoo, should it be removed from portage?



And yet another. This package has been broken for months with people reporting success on a proposed patch. Please do something.
Comment 15 Hank Leininger 2017-08-04 21:42:21 UTC
FWIW, I got tired of making a private ebuild in my overlay to wrap /etc/cron.d/sysstat in a USE=cron flag for every single release, and simply replaced the content of that file with a single '#'.

That avoids the constant errors, and upon upgrade the worst I have to do is pay attention during etc-update to not let the package's broken version take its place.

Please consider applying the IUSE=+cron patch, which AFAIK has no ill side effects & leaves behavior the same for people who aren't impacted by this, but gives people who are a workaround.  AFAIK I answered your 2016-02-05 question on 2016-02-26, let me know if there's more info I can provide.
Comment 16 Thomas Capricelli 2017-08-05 00:30:06 UTC
Yes, please someone do something ..
Comment 17 email200202 2018-11-17 05:03:57 UTC
Created attachment 555392 [details, diff]
user patch as workaround for dcron/sysstat problem
Comment 18 email200202 2018-11-17 05:07:21 UTC
For people waiting for this bug to bug to be fixed, I attached user patch file to remove "root" from /etc/cron.d/sysstat.

Place the patch file under the directory /etc/portage/patches/app-admin/sysstat/ and re-emerge app-admin/sysstat.
Comment 19 email200202 2018-11-17 05:10:21 UTC
(In reply to email200202 from comment #18)
> For people waiting for this bug to bug to be fixed, I attached user patch
> file to remove "root" from /etc/cron.d/sysstat.
> 
> Place the patch file under the directory
> /etc/portage/patches/app-admin/sysstat/ and re-emerge app-admin/sysstat.

And then do etc-update and run /etc/init.d/dcron restart
Comment 20 Peter Gantner (a.k.a. nephros) 2020-07-08 10:52:54 UTC
Hey, anything happening about this?

Current stable version is still affected by this.
Comment 21 Georgy Yakovlev gentoo-dev 2020-11-03 22:41:18 UTC
new maintainer here. will do something soon, will need some time to research it.

sad to see issue being ignored for 6 years.
Comment 22 Hank Leininger 2020-11-03 22:51:34 UTC
(In reply to Georgy Yakovlev from comment #21)
> new maintainer here. will do something soon, will need some time to research
> it.
> 
> sad to see issue being ignored for 6 years.

Thank you!

I think there are other/related bugs discussing this same issue (see #547846 and maybe others).

Speaking as a dcron user who wants the bug fixed... IIRC there are some good points arguing against automagic patching of the cron file to make it dcron-compatible, such as auto-editing the file to be deployed in /etc/cron.d/ , namely that if the admin then changes from dcron to some-other-cron, they'll now get errors for the opposite reason.

My best idea is still the one I submitted over 4 years ago - add IUSE=+cron, and refuse USE=cron when dcron is in use. That'll result in no net change for most users, but prevent dcron users from getting a broken cron job deployed. Still imperfect though, because it would prevent dcron users from deploying and manually fixing the cron job.
Comment 23 Georgy Yakovlev gentoo-dev 2020-11-03 23:34:26 UTC
thanks for suggestions.

I'm still reading, and haven't even tested it yet.

my first idea was just to add dcron useflag which both adds an  explicit dependency and modifies the file.
and if disabled, blocks dcron and installs cronfiles as-is.

that way it's impossible to get incorrect configuration, and there's explicit opt-in/opt-out via useflag.

but not sure yet =)
Comment 24 Larry the Git Cow gentoo-dev 2020-11-11 07:59:43 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e5fb72773abb5993c3f4ae7ea5796c6f8fd433f7

commit e5fb72773abb5993c3f4ae7ea5796c6f8fd433f7
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-11-11 07:59:14 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-11-11 07:59:25 +0000

    app-admin/sysstat: revbump, add dcron workaround for testing
    
    Bug: https://bugs.gentoo.org/531032
    Package-Manager: Portage-3.0.9, Repoman-3.0.2
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 app-admin/sysstat/metadata.xml             |  3 +
 app-admin/sysstat/sysstat-12.4.0-r1.ebuild | 88 ++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)
Comment 25 Georgy Yakovlev gentoo-dev 2020-11-11 08:01:27 UTC
please try out sysstat-12.4.0-r1 and let me know how it works.

Feedback really appreciated.

It's unkeyworded, for testing purposes. So you'll have to opt-in and keyword it.

USE="dcron" should adjust cronjobs and will prevent other implementations from being installed.
USE=dcron can't be selected with USE=systemd
Comment 26 Alex Efros 2020-11-11 19:30:39 UTC
(In reply to Georgy Yakovlev from comment #25)
> please try out sysstat-12.4.0-r1 and let me know how it works.

Works for me, thanks!
Comment 27 Hank Leininger 2020-11-12 23:29:19 UTC
(In reply to Georgy Yakovlev from comment #25)
> USE="dcron" should adjust cronjobs and will prevent other implementations
> from being installed.
> USE=dcron can't be selected with USE=systemd

Seems to behave exactly as intended now, thanks!
Comment 28 Larry the Git Cow gentoo-dev 2020-11-24 02:02:11 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee6175e80f202840de51bcaf86be5c1f3420dd53

commit ee6175e80f202840de51bcaf86be5c1f3420dd53
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-11-24 01:48:52 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-11-24 02:01:43 +0000

    app-admin/sysstat: bump to 12.4.1, add dcron useflag
    
    Closes: https://bugs.gentoo.org/531032
    Package-Manager: Portage-3.0.10, Repoman-3.0.2
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 app-admin/sysstat/Manifest              |  1 +
 app-admin/sysstat/sysstat-12.4.1.ebuild | 86 +++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+)

Additionally, it has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=afc8357859078426ec00ea0bd21cb4cedd30330f

commit afc8357859078426ec00ea0bd21cb4cedd30330f
Author:     Georgy Yakovlev <gyakovlev@gentoo.org>
AuthorDate: 2020-11-24 02:00:43 +0000
Commit:     Georgy Yakovlev <gyakovlev@gentoo.org>
CommitDate: 2020-11-24 02:01:45 +0000

    app-admin/sysstat: drop experimental ebuild
    
    Bug: https://bugs.gentoo.org/531032
    Package-Manager: Portage-3.0.10, Repoman-3.0.2
    Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>

 app-admin/sysstat/sysstat-12.4.0-r1.ebuild | 87 ------------------------------
 1 file changed, 87 deletions(-)
Comment 29 Georgy Yakovlev gentoo-dev 2020-11-24 02:02:53 UTC
ok 12.4.1 is out, it's keyworded and has useflag.
lmk if there are any issues.