Skip to content

cta-taped log file created with wrong permissions

Summary

  • CTA version: 5.10.10.1-1
  • OS: AlmaLinux 9.3
  • Kernel: 5.14.0-362.8.1.el9_3.x86_64

(Not tested on CC7 yet, might be the same there)

If cta-taped is started without a log file already being present, it is created with the wrong ownership and permissions.

This in turn causes monitoring to fail, as we need read access for the tape group and other users.

This problem was spotted by Vlado and Richard during testing of the new Alma9 machines.

Steps to reproduce

  1. systemctl stop cta-taped
  2. rm /var/log/cta/cta-taped-IBMLIB4-TS1160-F2C1R4.log
  3. systemctl start cta-taped
  4. ls -l /var/log/cta/cta-taped-IBMLIB4-TS1160-F2C1R4.log

What is the current bug behaviour?

If there is no existing log file when cta-taped is (re)started, then a fresh one is created, but with the wrong permissions:

[root@tpsrv454 ~]# ls -l /var/log/cta/cta-taped-IBMLIB4-TS1160-F2C1R4.log
-rw-r-----. 1 root root 236927 Apr 26 15:20 /var/log/cta/cta-taped-IBMLIB4-TS1160-F2C1R4.log

What is the expected correct behaviour?

After restart one would expect the log file to be owned by cta:tape, and readable by others.

[root@tpsrv454 ~]# ls -l /var/log/cta/cta-taped-IBMLIB4-TS1160-F2C1R4.log
-rw-r--r--. 1 cta tape 0 Apr 25 00:00 /var/log/cta/cta-taped-IBMLIB4-TS1160-F2C1R4.log

Relevant logs and/or screenshots

[root@tpsrv454 ~]# cat /etc/systemd/system/cta-taped\@.service 
[Unit]
Description=CERN Tape Archive (CTA) tape drive daemon for drive %i
PartOf=cta-taped.service
After=syslog.target network-online.target cta-taped.service

[Service]
EnvironmentFile=-/etc/sysconfig/cta-taped
ExecStart=/usr/bin/cta-taped --log-format=json --log-to-file=/var/log/cta/cta-taped-%i.log --config=/etc/cta/cta-taped-%i.conf ${CTA_TAPED_OPTIONS}
LimitCORE=infinity
OOMScoreAdjust=-1000
Type=forking
Restart=no

[Install]
WantedBy=cta-taped.service

Possible causes

Might be tied to the log changes introduced by the use of json logging?

Edited by Richard Bachmann