Monday, 13 December 2021

Ubuntu - Disk Full - Delete files and Caution && apache2 && mysql failed to start due to /var/log removal

https://askubuntu.com/questions/1113629/apache2-service-failed-to-run-start-task-no-space-left-on-device 

When Ubuntu is full, apache will fail to start.


Should delete content in /tmp and /var/log (tmp are removed after reboot)


https://askubuntu.com/questions/171678/can-i-delete-var-log-files-due-to-low-root-space

However, if you delete the /var/log subdirectories. I deleted all my log files and their directories (rm -r /var/log/*) and it broke my apache2 functionality. Apparently apache doesn't/can't recreate the log directories and therefore can't write log files and that apparently can cause it to fail.

I've heard before that deleting some log files can cause problems, though I don't have any first-hand experience to support it. But of course I didn't have any first-hand experience of directory deletion being a problem until a few days ago...


Fix:

Create sudo mkdir apache2 in /var/log

https://askubuntu.com/questions/64996/var-log-apache2-gets-deleted-on-restart-so-apache-doesnt-start-on-startup



MYSQL fail to start due to /var/log removal (AKA showing permission denied error on sudo service mysql start)


1) sudo service mysql status

2) sudo service mysql stop

3) sudo service mysql start

5) vim  journalctl -xe to see log on why mysql failed

6) You should see cant access /var/log/mysql/error.log

7) sudo mkdir /var/log/mysql, sudo touch /var/log/mysql/error.log

8) ch


No comments:

Post a Comment