Possibly an issue with Pi firmware of 4.9.x, find out your version by using this command
If so then issue these commands, the first installs the firmware updater the second the 4.4.50 version of the firmware.
sudo apt-get install rpi-update
sudo rpi-update 52241088c1da59a359110d39c1875cda56496764
If you can’t install the firmware because you have a “custom” kernel then you’ll have to get the latest version of Raspbian and install that, then run the above two commands.
One way to increase the lifespan, and presumably, reliability of the sd-card, currently being hammered, in your Pi is to put some of the temporary files into memory.
Add the following to your /etc/fstab
tmpfs /var/log tmpfs nodev,nosuid,size=50M 0 0
If the size isn’t specified then half of the machine’s memory is used.
nodev and nosuid are security options, the suggestion is that these only need setting for public facing machines.
8-Jan-2018: If you’re using the lighttpd web server then be aware that it stores files in /var/log, and it doesn’t like them being removed. This will cause the server to fail to start.
To install a GUI package manager use:
sudo apt-get install synaptic