logrotate script cause "Read-only file system" error while writing logs in /etc/ or /usr/ directories
Issue
-
logrotatepostrotate script cause "Read only filesystem" error while writing logs in/etc/or/usr/directories, but same script works in RHEL 8, and it runs well in RHEL 9 with interactive execution./var/log/myservice/*.log { weekly rotate 7 ... postrotate sh /etc/myservice/myscript.sh <<==== this script output logs to /etc/myservice/log/*.log, and it fails with `Read-only file system` endscript } OR /usr/local/example/var/*log { missingok notifempty size 5M copytruncate su nagios nagios rotate 1 compress }Log example:
Aug 22 00:01:07 myrhel9 logrotate[33408]: /etc/myservice/myscript.sh: line 4: /etc/myservice/log/myservice.log: Read only filesystem OR Jan 22 14:22:32 otherrhel9 logrotate[123464]: error: error opening /usr/local/example/var/cleaner.log: Read-only file system
Environment
- Red Hat Enterprise Linux 9
- logrotate
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.