Build: Improper replacement of log.hdd causing failure with logrotate

Created on 5 Jul 2018  路  17Comments  路  Source: armbian/build

In the Armbian_5.50.180630_Tinkerboard_Ubuntu_bionic_next_4.14.52.img I found a bug with zram logrotating:

Seems that cause file is packages/bsp/common/usr/lib/armbian/armbian-hardware-optimization#L47 contains sed that replaces log to log.hdd in the logrotate configuration, that also affects target file /etc/logrotate.d/rsyslog and replaces valid postrotate action /usr/lib/rsyslog/rsyslog-rotate to invalid /usr/lib/rsyslog.hdd/rsyslog-rotate that doesn't exist.

Error:

$ sudo /usr/lib/armbian/armbian-truncate-logs
logrotate_script: 2: logrotate_script: /usr/lib/rsyslog.hdd/rsyslog-rotate: not found
...

BTW seems that logratate can't affect journald and it will consume all the available disk space on the zram disk.

Most helpful comment

Open the following config file (eg. via nano):
nano /etc/logrotate.d/rsyslog

Changing all the lines with:
/usr/lib/rsyslog.hdd/rsyslog-rotate
To:
/usr/lib/rsyslog/rsyslog-rotate

Hopefully solved the problem..!?

All 17 comments

Thanks. This should fix the issue while for journald we have to figure out something.

Thank you!

Sure, I will test it

FWIW, I have just got this email from an Orange Pi Lite running Armbian_5.59_Orangepilite_Ubuntu_bionic_next_4.14.65:

/etc/cron.daily/logrotate:
logrotate_script: 2: logrotate_script: /usr/lib/rsyslog.hdd/rsyslog-rotate: not found
error: error running non-shared postrotate script for /var/log.hdd/syslog of '/var/log.hdd/syslog
'
run-parts: /etc/cron.daily/logrotate exited with return code 1

I flashed the board on Monday and was playing with settings which resulted in a situation when I had to reinstall rsyslog package.

If sed has been already fixed, do you know what else could trigger sed command to replace "log" with "log.hdd"?

Armbian_5.75_Orangepilite_Ubuntu_bionic_next_4.19.20
Still getting those emails:

/etc/cron.daily/logrotate:
logrotate_script: 2: logrotate_script: /usr/lib/rsyslog.hdd/rsyslog-rotate: not found
error: error running non-shared postrotate script for /var/log.hdd/syslog of '/var/log.hdd/syslog
'
run-parts: /etc/cron.daily/logrotate exited with return code 1

same here:

/etc/cron.daily/logrotate:
logrotate_script: 2: logrotate_script: /usr/lib/rsyslog.hdd/rsyslog-rotate: not found
error: error running non-shared postrotate script for /var/log.hdd/syslog of '/var/log.hdd/syslog
'
run-parts: /etc/cron.daily/logrotate exited with return code 1

/etc/armbian-release

BOARD=orangepiplus2e
BOARD_NAME="Orange Pi+ 2E"
BOARDFAMILY=sun8i
VERSION=5.75
LINUXFAMILY=sunxi
BRANCH=next
ARCH=arm
IMAGE_TYPE=stable
BOARD_TYPE=conf
INITRD_ARCH=arm
KERNEL_IMAGE_TYPE=zImage

uname -a
Linux orangepiplus2e 4.19.25-sunxi #5.78 SMP Mon Apr 8 07:46:22 CEST 2019 armv7l armv7l armv7l GNU/Linux

Yep. Please reopen:

/etc/cron.daily/logrotate: logrotate_script: 2: logrotate_script: /usr/lib/rsyslog.hdd/rsyslog-rotate: not found error: error running non-shared postrotate script for /var/log.hdd/syslog of '/var/log.hdd/syslog ' run-parts: /etc/cron.daily/logrotate exited with return code 1

Happens due to:

/usr/sbin/logrotate --force /etc/logrotate.conf                                                                                                                                        
logrotate_script: 2: logrotate_script: /usr/lib/rsyslog.hdd/rsyslog-rotate: not found                                                                                                                              
error: error running non-shared postrotate script for /var/log.hdd/syslog of '/var/log.hdd/syslog                                                                                                                  
'                                                                                                                                                                                                                  
logrotate_script: 2: logrotate_script: /usr/lib/rsyslog.hdd/rsyslog-rotate: not found                                                                                                                              
error: error running shared postrotate script for '/var/log.hdd/mail.info                                                                                                                                          
/var/log.hdd/mail.warn                                                                                                                                                                                             
/var/log.hdd/mail.err                                                                                                                                                                                              
/var/log.hdd/mail.log                                                                                                                                                                                              
/var/log.hdd/daemon.log                                                                                                                                                                                            
/var/log.hdd/kern.log                                                                                                                                                                                              
/var/log.hdd/auth.log                                                                                                                                                                                              
/var/log.hdd/user.log                                                                                                                                                                                              
/var/log.hdd/lpr.log                                                                                                                                                                                               
/var/log.hdd/cron.log                                                                                                                                                                                              
/var/log.hdd/debug                                                                                                                                                                                                 
/var/log.hdd/messages                                                                                                                                                                                              

Linux bananapi 4.19.25-sunxi #5.78 SMP Mon Apr 8 07:46:22 CEST 2019 armv7l armv7l armv7l GNU/Linux

Open the following config file (eg. via nano):
nano /etc/logrotate.d/rsyslog

Changing all the lines with:
/usr/lib/rsyslog.hdd/rsyslog-rotate
To:
/usr/lib/rsyslog/rsyslog-rotate

Hopefully solved the problem..!?

Actually that solved the problem, thanks past me!

However, now the following issue pop-ups:
error: error running shared postrotate script for '/var/log.hdd/nginx/*.log '

Looking at the nginx logrotate file (in /etc/logrotate.d directory):

/var/log.hdd/nginx/*.log {
        daily
        missingok
        rotate 14
        compress
        delaycompress
        notifempty
        create 0640 www-data adm
        sharedscripts
        prerotate
                if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                        run-parts /etc/logrotate.d/httpd-prerotate; \
                fi \
        endscript
        postrotate
                service nginx reload >/dev/null 2>&1
        endscript
}

Rights seems ok:

-rw-r----- 1 www-data adm       0 May 10 06:25 access.log
-rw-r----- 1 www-data adm    186K May 10 06:24 access.log.1
-rw-r----- 1 www-data adm       0 May  9 18:30 error.log

I think the nginx folder permissions itself where wrong I correct it by executing:
sudo chown www-data:adm /var/log.hdd/nginx

Optionally you could run chmod 640 as well on the files.

(Fingers crossed)

it solved the problem for me as well, but it came back (probably after a reboot of the machine)

problem still exists in:

Linux orangepiplus2e 4.19.62-sunxi #5.92 SMP Wed Jul 31 22:07:23 CEST 2019 armv7l armv7l armv7l GNU/Linux

@igorpecovnik can you reopen this ticket?

@Stefan300381 Perhaps this https://github.com/armbian/build/pull/1588 solved it?

@igorpecovnik
tbh I'm not a github expert and thus I don't know what has been changed where. Anyway, I ran a dist-upgrade on my OrangePi Plus 2E and I'm still on 5.90

Let's see tomorrow morning

This code change is for now only on Github, You need to build an image from sources or implement manually to see if this problem was fixed -> https://docs.armbian.com/Developer-Guide_Build-Preparation/

alright, thanks. I'll wait then until apt upgrade solves the issue :-)

Unable to reproduce, closing.

Was this page helpful?
0 / 5 - 0 ratings