After OS updates, old Linux kernels begin to accumulate in the boot partition, taking up extra space. To remove them from the system, follow these steps:
1. Determine the current kernel under which the system is loaded:
uname -a
Output:
Linux clear-centos8.rc.nbrb.by 4.18.0-80.7.1.el8_0.x86_64 #1 SMP Sat Aug 3 15:14:00 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
2. Checking available kernels:
rpm -q kernel
Output:
kernel-4.18.0-80.7.1.el8_0.x86_64
kernel-4.18.0-80.el8_0.x86_64
3. Run to clean up "kernel-4.18.0-80.el8_0.x86_64" kernel:
yum remove kernel-4.18.0-80.el8_0.x86_64
4. Remove kernel from grub:
ls /boot/vmlinuz*
Determine which file corresponds to the removed kernel.
vmlinuz-0-rescue-40f768414b694ee0a57971f91b470de0
vmlinuz-4.18.0-80.7.1.el8_0.x86_64
vmlinuz-4.18.0-80.el8.x86_64
In example it's "vmlinuz-4.18.0-80.el8.x86_64".
Run:
grubby --remove-kernel=/boot/vmlinuz-4.18.0-80.el8.x86_64
5. Clear the boot section from the old image and its configuration files:
rm /boot/*-4.18.0-80.el8.x86_64*
In our case, we use the filter according to the kernel version ("-4.18.0-80.el8_0.x86_64").
P.S. There is another less flexible, but faster way to automatically clean old kernels: "yum autoremove kernel".
1. Determine the current kernel under which the system is loaded:
uname -a
Output:
Linux clear-centos8.rc.nbrb.by 4.18.0-80.7.1.el8_0.x86_64 #1 SMP Sat Aug 3 15:14:00 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
2. Checking available kernels:
rpm -q kernel
Output:
kernel-4.18.0-80.7.1.el8_0.x86_64
kernel-4.18.0-80.el8_0.x86_64
3. Run to clean up "kernel-4.18.0-80.el8_0.x86_64" kernel:
yum remove kernel-4.18.0-80.el8_0.x86_64
4. Remove kernel from grub:
ls /boot/vmlinuz*
Determine which file corresponds to the removed kernel.
vmlinuz-0-rescue-40f768414b694ee0a57971f91b470de0
vmlinuz-4.18.0-80.7.1.el8_0.x86_64
vmlinuz-4.18.0-80.el8.x86_64
In example it's "vmlinuz-4.18.0-80.el8.x86_64".
Run:
grubby --remove-kernel=/boot/vmlinuz-4.18.0-80.el8.x86_64
5. Clear the boot section from the old image and its configuration files:
rm /boot/*-4.18.0-80.el8.x86_64*
In our case, we use the filter according to the kernel version ("-4.18.0-80.el8_0.x86_64").
P.S. There is another less flexible, but faster way to automatically clean old kernels: "yum autoremove kernel".
No comments:
Post a Comment