There are several good answers here regarding how to fix problems caused by a full /boot partition. What I'd like to know is if there is any best practices for proactively managing this issue before it becomes a problem.
I routinely go many weeks and sometimes several months between reboots. The need to apply patches frequently is rarely an issue with Linux like it is with MS. If I didn't mind rebooting every few days I'd just run Windows.
I am running a small farm of Ubuntu 16.04 LTS machines. I added the following to one of them as a test:
sudo crontab -e
1 9 * * 2 apt -y autoremove --purge >> /dev/null
This runs a purge once a week which should be more than frequent enough. This does work although I did a manual purge before creating the cron job so there may be issues when there is actually something in there to purge. Like, will this command run to successful completion unattended in all situations? Any unforeseen unintended consequences of using this approach? Is there a better OOB management scheme? For supportability reasons I would prefer to avoid using custom scripts.
Many thanks in advance.
https://help.ubuntu.com/community/RemoveOldKernels specifically says that the following does NOT purge old kernels:
File: /etc/apt/apt.conf.d/50unattended-upgrades
Set: Unattended-Upgrade::Remove-Unused-Dependencies "true";
apt
command line (it worked when I checked although I did not find it in the manualman apt
). – sudodus Aug 15 '17 at 19:40/boot
. ))) – Pilot6 Aug 15 '17 at 21:53/boot
. – Pilot6 Aug 15 '17 at 22:09cron
warning whenever/boot
is less than 100 MB free. I'm a little biased towards cron as I just set it up to email me system status. Instead of cron startup application could be used. At the same time I would consider issuing a warning whenever/
is > 80% full but that's a personal preference and not scientific. I would also use rm-kernels because I wrote it :) – WinEunuuchs2Unix Aug 16 '17 at 01:48linux-purge
script could do it waiting package lock to release before purging. After I release the script, you will be able to file bug reports against it in Launchpad. https://www.bountysource.com/issues/38300038-feature-request-the-command-should-work-like-this – jarno Aug 17 '17 at 03:39