So today I started installing a few updates on one of my servers (centos 7) and had the following issue , I could not install the new kernel version because there was not enough disk space in /boot to accommodate the new kernel , so I went about removing the old files, and solving this problem permanently , so first I installed yum-utils
#yum install yum-utils
Then I used the package-cleanup utility (handy python script , yay python!!! ) that allows us to remove duplicate or orphaned packages.
Here is an example
#package-cleanup –oldkernels –count=2
so what this does is that it removes old kernels and keeps only the last 2 .
So this does what we want , which is to remove the older version of the kernel , however we might have this problem again in the future . Looking for a solution I have checked /etc/yum.conf and there we have the option
according to Red Hat and their deployment guide present here
installonlypkgsdirective include several different kernel packages, so be aware that changing the value of
installonly_limitwill also affect the maximum number of installed versions of any single kernel package. The default value listed in
installonly_limit=3, and it is not recommended to decrease this value, particularly below
So , I changed the yum.conf to read
There , we have avoided this problem.
Of course that this has an impact on how many old versions of the kernel you wish to keep , and I do recommend that you set this value taking into account your needs … but for me at this point I feel that 2 is enough .