Stacer icon indicating copy to clipboard operation
Stacer copied to clipboard

Stacer's log cleaning breaks MySQL, Apache2 and Timeshift

Open xdpirate opened this issue 5 years ago • 4 comments

Cleaning out logs with Stacer breaks MySQL, Apache2 and Timeshift.

Last week I tried out stacer and it seemed to work nicely, cleaned a few gigs of files, and didn't seem to have any ill effects. But today I tried to open my selfhosted webapp only to get a 404 on localhost. Dug through syslog to find that both apache2 and mysql services fail to start, because of the fact that their log folders no longer exist. The log and the date my Timeshift backups stopped indicate they have been failing since the day I ran Stacer.

Stacer seems to have removed these log folders these programs require to start up: /var/log/mysql/ for MySQL /var/log/apache2/ for Apache2

For Timeshift I'm unsure which path broke it, but I had to go through Timeshift's initial setup and reenable scheduled backups, it had not backed up since the day I ran Stacer last week.

To fix:

sudo mkdir /var/log/apache2/
sudo chmod -R 744 /var/log/apache2/
sudo mkdir /var/log/mysql/
sudo chown mysql:mysql /var/log/mysql/
sudo service mysql start
sudo service apache2 start

Running Kubuntu 20.04.1 LTS with Stacer from Ubuntu apt repo.

Suggested fix: When cleaning logs, only clean the log files and not their parent directory as the log directories are expected to exist with certain permissions and ownership, by many pieces of software.

xdpirate avatar Nov 25 '20 19:11 xdpirate

I confirm this. Same happens to supervisor and rabbitmq services, stacer should never delete logs dir.

kaiohken1982 avatar Jan 09 '21 23:01 kaiohken1982

Found out today that this also applies to Samba's log folder - /var/log/samba. Although Samba will still run normally without the log folder existing, it needs to be recreated manually to start logging again.

Jan 12 19:49:59 LPC smbd[397296]: [2021/01/12 19:49:59.734749,  0] ../../lib/util/debug.c:1098(reopen_one_log)
Jan 12 19:49:59 LPC smbd[397296]:   reopen_one_log: Unable to open new log file '/var/log/samba/log.smbd': No such file or directory

xdpirate avatar Jan 12 '21 18:01 xdpirate

It also breaks System Security Services Daemon (sssd): I don't know where it logs, but thet systemd journal says it's /var/log/sssd/sssd.log mkdir /var/log/sssd

willyywt avatar Mar 03 '21 12:03 willyywt

Also breaks audit.service mkdir /var/log/audit

willyywt avatar Mar 03 '21 12:03 willyywt