Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 88957 - logrotate fails to run pre/postrotate scripts
Summary: logrotate fails to run pre/postrotate scripts
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Daniel Gryniewicz (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-13 06:15 UTC by Robin Johnson
Modified: 2005-06-26 09:25 UTC (History)
0 users

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


Attachments
logrotate-3.7_p1.ebuild (logrotate-3.7_p1.ebuild,1.79 KB, text/plain)
2005-05-17 23:08 UTC, Chris White (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-04-13 06:15:54 UTC
logrotate is failing to run any prerotate or postrotate scripts. This is breaking all cases where I have a service being stopped before log rotation, and started again afterwards. This has caused me to loose valuable log data when it rotated the log file without running the scripts.
At the very least it should NOT proceed with rotation if the prerotation fails.

Reproducible: Always
Steps to Reproduce:
test configuration file:
/var/log/logrotate-test {
 #sharedscripts
 create
 #notifempty
 #nomail
 #noolddir
 #compress
 rotate 1
 #monthly
 prerotate
echo prerotate iplog `date` >>/tmp/logrotate-test
 endscript
 postrotate
echo postrotate iplog `date` >>/tmp/logrotate-test
 endscript
}
Actual Results:  
curie-int logrotate.d # echo foo >/var/log/logrotate-test
curie-int logrotate.d # logrotate -f -v test
reading config file test
reading config info for /var/log/logrotate-test

Handling 1 logs

rotating pattern: /var/log/logrotate-test  forced from command line (1 
rotations)
empty log files are rotated, old logs are removed
considering log /var/log/logrotate-test
  log needs rotating
rotating log /var/log/logrotate-test, log->rotateCount is 1
renaming /var/log/logrotate-test.1 to /var/log/logrotate-test.2 (rotatecount 1, 
logstart 1, i 1),
old log /var/log/logrotate-test.1 does not exist
renaming /var/log/logrotate-test.0 to /var/log/logrotate-test.1 (rotatecount 1, 
logstart 1, i 0),
old log /var/log/logrotate-test.0 does not exist
log /var/log/logrotate-test.2 doesn't exist -- won't try to dispose of it
running prerotate script
error: error running prerotate script, leaving old log in place
renaming /var/log/logrotate-test to /var/log/logrotate-test.1

Expected Results:  
should be no error, and the prerotate/postrotate scripts should have run.


This last worked for definate many months ago.

Portage 2.0.51.19 (!/usr/portage/profiles/default-linux/x86/2004.3, gcc-3.3.5, 
glibc-2.3.4.20050125-r1, 2.6.11-mm2 i686)
=================================================================
System uname: 2.6.11-mm2 i686 AMD Athlon(tm) XP 2400+
Gentoo Base System version 1.6.10
Python:              dev-lang/python-2.3.5 [2.3.5 (#2, Feb 20 2005, 02:49:02)]
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) 
[disabled]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.5
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.7.9, 1.9.5
sys-devel/binutils:  2.15.92.0.2-r7
sys-devel/libtool:   1.5.14
virtual/os-headers:  2.6.8.1-r4
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-march=athlon-xp -mcpu=athlon-xp -O3 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/
config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/shar
e/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf
/xdvi/ /var/bind /var/qmail/alias /var/qmail/control /var/vpopmail/domains /var/
vpopmail/etc"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon-xp -mcpu=athlon-xp -O3 -pipe"
DISTDIR="/usr/gentoo-distfiles"
FEATURES="autoaddcvs autoconfig buildpkg ccache collision-protect cvs digest 
distlocks sandbox sfperms sign userpriv"
GENTOO_MIRRORS="http://gentoo.ccccom.com http://gentoo.seren.com/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/gentoo-packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/gentoo-cvs/gentoo-x86"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC=""
USE="x86 3dnow aalib acl acpi alsa amd apache2 apm berkdb bitmap-fonts cdr cgi 
clearpasswd crypt cscope cups curl divx4linux emboss f77 fam font-server 
foomaticdb fortran gcj gd gdbm geoip gif imagemagick imap innodb ipalias ipv6 
java jikes jpeg junit libwww mad maildir mcal md5sum mikmod mmx mp3 mpeg 
multitarget mysql ncurses objc offensive pam pcap pdflib perl pic plotutils png 
pnp ppds python qmail readline samba scanner slp snmp socks5 spell sqlite sse 
ssl tetex tiff truetype truetype-fonts type1 type1-fonts ungif usb userlocales 
v4l v4l2 xml xml2 xvid zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS

curie-int logrotate.d # emerge -pv logrotate

These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild   R   ] app-admin/logrotate-3.7  (-selinux) 0 kB

Total size of downloads: 0 kB
Comment 1 Seemant Kulleen (RETIRED) gentoo-dev 2005-04-13 06:33:55 UTC
wildly sending your way since chriswhite is gone
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-05-17 19:55:16 UTC
chriswhite: bump
Comment 3 Chris White (RETIRED) gentoo-dev 2005-05-17 23:07:19 UTC
looks like a version bump is all we needed:

secures logrotate # logrotate -f -v test
reading config file test
reading config info for /var/log/logrotate-test

Handling 1 logs

rotating pattern: /var/log/logrotate-test  forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/logrotate-test
  log needs rotating
rotating log /var/log/logrotate-test, log->rotateCount is 1
renaming /var/log/logrotate-test.1 to /var/log/logrotate-test.2 (rotatecount 1,
logstart 1, i 1),
old log /var/log/logrotate-test.1 does not exist
renaming /var/log/logrotate-test.0 to /var/log/logrotate-test.1 (rotatecount 1,
logstart 1, i 0),
old log /var/log/logrotate-test.0 does not exist
log /var/log/logrotate-test.2 doesn't exist -- won't try to dispose of it
running prerotate script
renaming /var/log/logrotate-test to /var/log/logrotate-test.1
creating new log mode = 0644 uid = 0 gid = 0
running postrotate script

and:

secures logrotate # vi /var/log/log
log.txt           logrotate-test    logrotate-test.1

yay :).

I'm going to attach the ebuild I have here.  Please let me know if everything
else seems to work ok.
Comment 4 Chris White (RETIRED) gentoo-dev 2005-05-17 23:08:11 UTC
Created attachment 59182 [details]
logrotate-3.7_p1.ebuild

Ebuild for logrotate to be stuffed into portage overlay.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-05-18 00:53:56 UTC
chriswhite: doesn't fix it for me.

curie-int logrotate.d # logrotate -f -v test
reading config file test
reading config info for /var/log/logrotate-test

Handling 1 logs

rotating pattern: /var/log/logrotate-test  forced from command line (3 
rotations)
empty log files are rotated, old logs are removed
considering log /var/log/logrotate-test
  log needs rotating
rotating log /var/log/logrotate-test, log->rotateCount is 3
renaming /var/log/logrotate-test.3 to /var/log/logrotate-test.4 (rotatecount 3, 
logstart 1, i 3),
old log /var/log/logrotate-test.3 does not exist
renaming /var/log/logrotate-test.2 to /var/log/logrotate-test.3 (rotatecount 3, 
logstart 1, i 2),
old log /var/log/logrotate-test.2 does not exist
renaming /var/log/logrotate-test.1 to /var/log/logrotate-test.2 (rotatecount 3, 
logstart 1, i 1),
old log /var/log/logrotate-test.1 does not exist
renaming /var/log/logrotate-test.0 to /var/log/logrotate-test.1 (rotatecount 3, 
logstart 1, i 0),
old log /var/log/logrotate-test.0 does not exist
log /var/log/logrotate-test.4 doesn't exist -- won't try to dispose of it
running prerotate script
error: error running prerotate script, leaving old log in place
renaming /var/log/logrotate-test to /var/log/logrotate-test.1
Comment 6 Chris White (RETIRED) gentoo-dev 2005-05-20 10:55:11 UTC
Can you set me up an account with the relevant config file on your system please
(you mentioned it earlier).  I'm using the same config and the attached ebuild
and it works ok for me.. so I'm not sure what's causing yours to fail.
Comment 7 Daniel Gryniewicz (RETIRED) gentoo-dev 2005-05-24 14:09:41 UTC
please re-test with 3.7.1
Comment 8 Daniel Gryniewicz (RETIRED) gentoo-dev 2005-05-25 15:22:48 UTC
Do you by any chance have /tmp mounted noexec?  If so, a fix is going into
3.7.1-r1 for this problem.
Comment 9 Daniel Gryniewicz (RETIRED) gentoo-dev 2005-05-26 11:02:28 UTC
3.7.1-r1 is now committed.  Please retest with that.
Comment 10 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-05-29 21:43:49 UTC
yup, my tmp is noexec
/dev/scsi/host0/bus0/target0/lun0/part8 on /tmp type reiserfs 
(rw,noexec,nosuid,nodev,noatime)

i'm testing this evening now.
Comment 11 Daniel Gryniewicz (RETIRED) gentoo-dev 2005-06-26 09:25:20 UTC
3.7.1-r1 is stable now.