Problem: /boot partition begins to fill and even after manual clean up, the problem reoccurs.
Solution: Initially clean the partition. The solution we have used is documented here and summarised below.
- Get the current kernel version by executing
- uname -r
- List the kernels available, except the kernel currently in use
- dpkg –list ‘linux-image*’|awk ‘{ if ($1==”ii”) print $2}’|grep -v
uname -r
- dpkg –list ‘linux-image*’|awk ‘{ if ($1==”ii”) print $2}’|grep -v
- Based on the list returned by the command above, execute
- apt-get purge linux-image–generic
- Remove orphaned packages
- apt-get autoremove
- Did it work? The command in step 2 should return no results. Check boot partition space with
- df -h | egrep “boot|Mounted on”
Once that’s done, it’s recommended to setup Automatic Maintenance as below:
- Install the package unattended-upgrades
- apt-get install unattended-upgrades
- Configure unattended-upgrades
- dpkg-reconfigure -plow unattended-upgrades
- Make sure /etc/apt/apt.conf.d/50unattended-upgrades contains line Unattended-Upgrade::Remove-Unused-Dependencies “true”;cat /etc/apt/apt.conf.d/50unattended-upgrades | grep Remove-Unused-Dependencies
If the result is //Unattended-Upgrade::Remove-Unused-Dependencies “false”;, then use your prefered editor to remove the // and change false to true.