Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#40443 - [cups] 1.7.2-1 logrotate cups.pid

Attached to Project: Arch Linux
Opened by Paul Kerry (paulkerry) - Monday, 19 May 2014, 11:41 GMT
Last edited by Andreas Radke (AndyRTR) - Tuesday, 21 October 2014, 17:49 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Andreas Radke (AndyRTR)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: /etc/logrotate.d/cups contains reference to cups.pid which does not exist


Additional info:
cups 1.7.2-1

/etc/logrotate.d/cups contains these lines...

postrotate
/bin/kill -HUP `cat /var/run/cups.pid 2>/dev/null` 2>/dev/null || true

but /var/run/cups.pid does not exist, so the kill command does not execute


I can confirm cups is running as a systemd service while this is happening...
529 ? Ss 0:03 /usr/bin/cupsd -f


Steps to reproduce:
install and start cups - no /var/run/cups.pid file is created.


Cheers
Paul.
This task depends upon

Closed by  Andreas Radke (AndyRTR)
Tuesday, 21 October 2014, 17:49 GMT
Reason for closing:  Fixed
Additional comments about closing:  2.0.0-2
Comment by Paul Kerry (paulkerry) - Saturday, 21 June 2014, 15:57 GMT
  • Field changed: Percent Complete (100% → 0%)
now that the kill line has been totally removed from /etc/logrotate.d/cups, access_log, error_log and page_log are re-created but aren't used: logs are still being placed into *_log.1
Comment by Andreas Radke (AndyRTR) - Monday, 23 June 2014, 15:44 GMT
Can you confirm if applying this patch solves this?

http://pkgs.fedoraproject.org/cgit/cups.git/tree/cups-logrotate.patch?id=f01be03466d52d1d8f32171942e690a41b4ba222


If not I have no clue what we in a different way than Fedora or other distros.
Comment by Paul Kerry (paulkerry) - Wednesday, 25 June 2014, 11:20 GMT
Sorry can't really apply the patch at present: before doing so however, perhaps you might consider reinstating the kill and other relevant lines and use an alternative command?

previous versions of /etc/logrotate.d/cups were like this...
-
/var/log/cups/*_log {
missingok
notifempty
postrotate
/bin/kill -HUP `cat /var/run/cups.pid 2>/dev/null` 2>/dev/null || true
endscript
}
-

so how about changing the kill line to something on the lines of...
/usr/bin/kill -HUP `/usr/bin/pidof cupsd` || true

or maybe it would be preferable to use systemctl now to do this...
/usr/bin/systemctl kill -s HUP cups

or following examples in "man logrotate"...
/usr/bin/killall -HUP cups

?


For info, in Debian stable (using cups 1.5.3), /etc/logrotate.d/cups contains...
-
/var/log/cups/*log {
daily
missingok
rotate 7
sharedscripts
postrotate
if [ -e /var/run/cups/cupsd.pid ]; then
invoke-rc.d --quiet cups force-reload > /dev/null
sleep 10
fi
endscript
compress
notifempty
create 640 root lpadmin
}
-

but in Debian unstable using cups 1.7.3, the /etc/logrotate.d/cups file has been removed.

Cheers
Paul.

Comment by Paul Kerry (paulkerry) - Thursday, 26 June 2014, 09:10 GMT
http://www.cups.org/documentation.php/spec-design.html
under the "Log Files" section says...

"Log files are rotated automatically by the scheduler when they reach the configured size limit, by default 1MB. If the limit is set to 0 then no rotation is performed in the scheduler - this mode is often used by Linux distributions so they can use the logrotated(8) program to rotate them instead."

As there is no "MaxLogSize" set in the default /etc/cups/cupsd.conf file, it would appear that cups is rotating the logs by it's internal mechanism and also /etc/logrotate.d/cups is rotating the logs, probably causing the problem.

So I guess there are two options here: add "MaxLogSize 0" to /etc/cups/cupsd.conf to use /etc/logrotate.d/cups or remove /etc/logrotate.d/cups completely

I'm testing this by putting "MaxLogSize 0" into /etc/cups/cupsd.conf and using a modified /etc/logrotate.d/cups file.

Cheers
Paul.
Comment by Paul Kerry (paulkerry) - Monday, 07 July 2014, 14:09 GMT

So I tested with "MaxLogSize 0" in /etc/cups/cupsd.conf and with a modified /etc/logrotate.d/cups file - as I commented before, new log files are created and rotated but aren't used.

I then tested with a small logsize, "MaxLogSize 10240" in /etc/cups/cupsd.conf and deleted the /etc/logrotate.d/cups file - everything works perfectly: logs are created, rotated and used.

Perhaps, as I mentioned before, this is an issue with both cups and logrotate doing the changes?

Cheers
Paul.
Comment by Paul Kerry (paulkerry) - Monday, 11 August 2014, 15:33 GMT
Hi

I've done more testing and have found the solution by changing the /etc/logrotate.d/cups file from the default settings. No patches to cups are required.

Adding this line to the /etc/cups/cupsd.conf file...
MaxLogSize 0

and changing the /etc/logrotate.d/cups file [with the relevant indentations as posting here removes these] to...

/var/log/cups/*_log {
missingok
notifempty
daily
rotate 14
sharedscripts
copytruncate
postrotate
/usr/bin/systemctl kill -s HUP cups
endscript
}


makes everything work perfectly: all logs are created, rotated and used as they should be.


Cheers
Paul.
Comment by Andreas Radke (AndyRTR) - Friday, 03 October 2014, 11:40 GMT
with our current package I get this:

[root@server64 andyrtr]# ls -lha /var/log/cups/
insgesamt 64K
drwxr-xr-x 2 root lp 4,0K 29. Sep 00:00 .
drwxr-xr-x 9 root root 4,0K 1. Okt 00:00 ..
-rw-r--r-- 1 root lp 511 3. Okt 10:26 access_log
-rw-r--r-- 1 root lp 125 14. Sep 13:59 access_log.1
-rw-r--r-- 1 root lp 124 1. Sep 20:32 access_log.2
-rw-r--r-- 1 root lp 122 17. Aug 09:37 access_log.3
-rw-r--r-- 1 root lp 634 16. Aug 20:20 access_log.4
-rw-r--r-- 1 root lp 104 2. Okt 12:44 error_log
-rw-r--r-- 1 root lp 524 2. Okt 12:43 error_log.1
-rw-r--r-- 1 root lp 210 21. Sep 17:53 error_log.2
-rw-r--r-- 1 root lp 210 18. Sep 20:46 error_log.3
-rw-r--r-- 1 root lp 3,1K 7. Sep 20:19 error_log.4
-rw-r--r-- 1 root lp 0 15. Sep 00:00 page_log
-rw-r--r-- 1 root lp 1,5K 14. Sep 13:59 page_log.1
-rw-r--r-- 1 root lp 1,2K 1. Sep 20:32 page_log.2
-rw-r--r-- 1 root lp 1,3K 17. Aug 09:37 page_log.3
-rw-r--r-- 1 root lp 1,4K 16. Aug 20:20 page_log.4

maybe there's no real problem?

I've added the sharedscripts option to our logrotate file like Fedora does into cups 2.0.0 package in testing. Please test if there's all working for you.
Comment by Paul Kerry (paulkerry) - Friday, 03 October 2014, 12:16 GMT
Do you also have "MaxLogSize 0" set in /etc/cups/cupsd.conf or is this negated by going to cups-2.0.0? If not, perhaps it should be added as a default?
Comment by Andreas Radke (AndyRTR) - Friday, 03 October 2014, 15:30 GMT
no, I don't have such a setting. check this from cupsd.conf manpage:

MaxLogSize size
Specifies the maximum size of the log files before they are rotated. The value "0" disables log rotation. The default is "1048576" (1MB).

So this setting shouldn't be required.
Comment by Paul Kerry (paulkerry) - Monday, 06 October 2014, 09:39 GMT
If you haven't set MaxLogSize and therefore the default size for MaxLogSize is in operation, why are the sizes of the log files in the /var/log/cups directory listing you posted very small and not rotated when >1048576 ?

Also from your /var/log/cups directory listing, your log files seem to be created and rotated at random times.

Without adding MaxLogSize to cupsd.conf, what happens when you add "daily" to /etc/logrotate.d/cups ? Are the cups logs changed daily or not?


For info, debian stable /etc/cups/cupsd.conf says...

# Deactivate CUPS' internal logrotating, as we provide a better one, especially
# LogLevel debug2 gets usable now
MaxLogSize 0

by which it means logrotate is a better method than the cups built-in method.

Comment by Andreas Radke (AndyRTR) - Monday, 06 October 2014, 15:36 GMT
Fedora also seems to add this option by this:

sed -i -e '1iMaxLogSize 0' conf/cupsd.conf.in
Comment by Andreas Radke (AndyRTR) - Wednesday, 08 October 2014, 20:01 GMT
I've added MaxLogSize 0 to our default cupsd.conf. This will cups internal cups log file rotating.
Comment by Paul Kerry (paulkerry) - Thursday, 09 October 2014, 08:27 GMT
OK. I would also recommend changing the default /etc/logrotate.d/cups file by adding

postrotate
/usr/bin/systemctl kill -s HUP cups
endscript

so that cups is HUP'd when logrotate runs.

Cheers
Paul.
Comment by Andreas Radke (AndyRTR) - Friday, 10 October 2014, 18:03 GMT
Why do you think this is helpful?

Loading...