Bug 735300 - Enabling psacct causes daily cron spam
Summary: Enabling psacct causes daily cron spam
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: psacct
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaromír Cápík
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-02 08:42 UTC by Pekka Pietikäinen
Modified: 2016-02-01 01:55 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-01-30 00:50:02 UTC


Attachments (Terms of Use)
proposed patch (457 bytes, patch)
2011-10-31 18:35 UTC, Bill McGonigle
no flags Details | Diff

Description Pekka Pietikäinen 2011-09-02 08:42:48 UTC
Description of problem:

/etc/logrotate.d/psacct contains the following:

   postrotate
       if /etc/init.d/psacct status >/dev/null 2>&1; then
           /usr/sbin/accton /var/account/pacct
       fi

that is, if psacct is enabled, it'll run accton. Fair enough, but that one prints "Turning on process accounting, file set to '/var/account/pacct'." 
to stdout every time it gets run, resulting in unnecessary mails to root.

A >/dev/null seems to do the trick, suppose there can be some errors to stderr that would be worth seeing.

Version-Release number of selected component (if applicable):
6.5.5-2

How reproducible:
Enable psacct

Comment 1 Ian Donaldson 2011-09-17 04:45:19 UTC
This looks to have appeared in FC15 as /etc/cron.daily/logrotate 
no longer redirects output from logrotate to /dev/null like it did in FC14

I use this as a workaround (in kickstart.cfg)


sed -e '/\/usr\/sbin\/accton \/var\/account\/pacct$/s=$= | grep -v "Turning on"=' < /etc/logrotate.d/psacct > /tmp/psacct$$
cp /tmp/psacct$$ /etc/logrotate.d/psacct
rm -f /tmp/psacct$$

Comment 2 Ian Donaldson 2011-09-18 09:36:13 UTC
Actually that causes a different message due to the grep exit code, so 
add a cat to hide that exit code.  Can't see an option too grep to zero it.

sed -e '/\/usr\/sbin\/accton \/var\/account\/pacct$/s=$= | grep -v "Turning
on" | cat=' < /etc/logrotate.d/psacct > /tmp/psacct$$
cp /tmp/psacct$$ /etc/logrotate.d/psacct
rm -f /tmp/psacct$$

Comment 3 Bill McGonigle 2011-10-31 18:35:04 UTC
Created attachment 531012 [details]
proposed patch

I'd argue that accton is broken in two ways:

1) it violates the Unix principle of 'least surprise' - it should just shut up if everything works.
2) this status message is necessary despite 1) because accton's default behavior is to toggle the status of process accounting.  The behavior is undefined independent of the current state of process accounting.  This is bound to cause all kinds of programming errors.  Imagine if 'swapon' turned off all swap space if swaps were currently enabled.  We have a 'swapoff' symlink and swapon reads its $0 to know what to do.  There's not even a --disable flag to swapon, so people don't make these kinds of mistakes (and swapon isn't primarily about security... sigh).

That said, convincing GNU that they're wrong probably won't yield a fix in the f15 timeframe, so proposed patch attached.  I'm grepping specifically for this status message, so that all other outcomes propagate to mail, as expected.  Thanks for the 'cat' trick, Ian.

Comment 4 Bill McGonigle 2011-11-04 19:49:16 UTC
OK, 2) above is wrong.  Turning on requires a parameter, turning off does not.

So, it should be able to be quiet if everything works.  I'll ask upstream.

Comment 5 Bill McGonigle 2011-11-04 21:06:12 UTC
Upstream request:
  https://savannah.gnu.org/bugs/index.php?34748

I don't have edit permission on 'external trackers'.

Comment 6 Jaromír Cápík 2012-05-11 12:46:42 UTC
Hello Bill.

The change you've done seems to be reasonable. I'm going to apply the patch and test that.

Thanks.

Regards,
Jaromir.

Comment 7 Fedora End Of Life 2012-08-07 19:51:55 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 8 Jaromír Cápík 2013-01-16 16:00:32 UTC
Hello guys.

Sorry for the delay.

Bill, I've merged your changes together with changes made by Ian Donaldson (#759321) to the logrotate .in file and modified the spec file accordingly.

Thank you all for the report and help.

Regards,
Jaromir.

Comment 9 Fedora Update System 2013-01-16 17:35:29 UTC
psacct-6.5.5-6.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/psacct-6.5.5-6.fc17

Comment 10 Fedora Update System 2013-01-16 17:35:53 UTC
psacct-6.5.5-8.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/psacct-6.5.5-8.fc18

Comment 11 Fedora End Of Life 2013-01-16 22:46:51 UTC
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 12 Fedora Update System 2013-01-18 20:36:54 UTC
Package psacct-6.5.5-8.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing psacct-6.5.5-8.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-0944/psacct-6.5.5-8.fc18
then log in and leave karma (feedback).

Comment 13 Fedora Update System 2013-01-30 00:50:03 UTC
psacct-6.5.5-6.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2013-01-30 00:52:23 UTC
psacct-6.5.5-8.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.