Discussion:
Bug#804403: [logrotate] can not run logrotate on LXC container
(too old to reply)
LACROIX Jean Marc
2015-11-08 07:40:02 UTC
Permalink
Package: logrotate
Version: 3.8.7-1+b1

Dears Maintainers,

I have a strange behaviour on Debian Jessie on ARM platform with 2
differents contexts when using logotate with default config Debian
files.

Im am using logrotate on the host and the same logrotate on one
container managed by LXC, with of course the same Debian release.

When using logrotate on the host, logrotate behaviour is correct and
all files are correctly rotated. But when running the same command in
the container ( with same OS and same package, it was not possible to
run the command (look at error bellow).

The only found method is to use the '--force' option in order to run
the command correctly release on HOST:

------------trace ----------------

***@srv-cubie2-1:/etc# uname -a
Linux srv-cubie2-1 4.0.5-e23a94b-be4cb23-dirty #9 SMP Mon Aug 24
09:43:56 CEST 2015 armv7l GNU/Linux
***@srv-cubie2-1:/etc# cat /etc/debian_version
8.2

***@srv-cubie2-1:/etc# dpkg -l |grep logrotate
ii logrotate 3.8.7-1+b1 armhf Log rotation utility


step 1: config
--------------
***@srv-dns-2:/etc# cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
missingok
monthly
create 0664 root utmp
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0660 root utmp
rotate 1
}

***@srv-dns-2:/etc# md5sum /etc/logrotate.conf
176edd439a499501372cf3d04e795810 /etc/logrotate.conf

step 2: run logrotate on host
-----------------------------
***@srv-cubie2-1:/etc# /usr/sbin/logrotate /etc/logrotate.conf;echo $?

0

step 3: config container
------------------------
***@srv-dns-2:/etc# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_srv_dns-lv_rootfs 198337 33277 154820 18% /
/dev/mapper/vg_srv_dns-lv_tmp 99150 1550 92480 2% /tmp
/dev/mapper/vg_srv_dns-lv_usr 394724 257330 117017 69% /usr
/dev/mapper/vg_srv_dns-lv_var 301619 238194 47861 84% /var
tmpfs 102768 96 102672 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 205520 0 205520 0% /run/shm

***@srv-dns-2:/etc# cat /etc/debian_version
8.2

***@srv-dns-2:/etc# dpkg -l |grep logrotate
ii logrotate 3.8.7-1+b1 armhf
Log rotation utility

***@srv-dns-2:/etc# md5sum /etc/logrotate.conf
176edd439a499501372cf3d04e795810 /etc/logrotate.conf

Please note that configuration file is the same (same md5) than in host

step 4: run logrotate in container
----------------------------------
***@srv-dns-2:/etc# /usr/sbin/logrotate /etc/logrotate.conf
error: stat of # failed: No such file or directory
error: stat of internal failed: No such file or directory
error: stat of infrastructure failed: No such file or directory


but when forcing command...., there are still errors, but the job is
done

***@srv-dns-2:/etc# /usr/sbin/logrotate -f /etc/logrotate.conf
error: error creating output file /var/log/dpkg.log.1.gz: File exists
error: stat of # failed: No such file or directory
error: stat of internal failed: No such file or directory
error: stat of infrastructure failed: No such file or directory
error: error creating output file /var/log/kern.log.1.gz: File exists
error: error creating output file /var/log/auth.log.1.gz: File exists
error: error creating output file /var/log/debug.1.gz: File exists
error: error creating output file /var/log/messages.1.gz: File exists


Any suggestion would be appreciated

best regards
--
--------------------------------------
-- Jean-Marc LACROIX --
-- mailto : ***@free.fr --
---------------------------------------
Paul Martin
2015-11-08 14:10:01 UTC
Permalink
Post by LACROIX Jean Marc
Im am using logrotate on the host and the same logrotate on one
container managed by LXC, with of course the same Debian release.
Are the two logrotate binaries the same, or has LXC replaced the
containerized one with something else?
--
Paul Martin <***@debian.org>
LACROIX Jean Marc
2015-11-08 18:40:02 UTC
Permalink
Post by Paul Martin
Post by LACROIX Jean Marc
Im am using logrotate on the host and the same logrotate on one
container managed by LXC, with of course the same Debian release.
Are the two logrotate binaries the same, or has LXC replaced the
containerized one with something else?
The two binaries are the same for debian point of view (same release
number) but different because mounting point is different.
(/usr/sbin/logrotate are not identic)

- on the host: /usr is in /,

- on the container, /dev/mapper/vg_srv_dns-lv_usr is for /usr

Best regards
--
--------------------------------------
-- Jean-Marc LACROIX --
-- mailto : ***@free.fr --
---------------------------------------
Paul Martin
2015-11-08 22:50:01 UTC
Permalink
Post by Paul Martin
Post by LACROIX Jean Marc
Im am using logrotate on the host and the same logrotate on one
container managed by LXC, with of course the same Debian release.
Are the two logrotate binaries the same, or has LXC replaced the
containerized one with something else?
The two binaries are the same for debian point of view (same release number)
but different because mounting point is different.
(/usr/sbin/logrotate are not identic)
My supposition is that the logrotate in the container is not the
logrotate from the Debian package, as it's giving errors with the comments
in the config file, which the true logrotate wouldn't do.
--
Paul Martin <***@debian.org>
Christian Göttsche
2018-08-22 20:00:01 UTC
Permalink
Control: tags -1 moreinfo unreproducible

Hi,
can reproduce the second issue with the recent version 3.14.0-2?
Also can you post the configuration file that lead to the first issue,
maybe logrotate should give a better error message.

Best regards
Christian Göttsche

Loading...