Help a newb: Updating Rocky Linux and cleaning vestigial files

Hi all, me again. I recently did an update that included kernel updates. Upon booting into Rocky Linux I received a warning that my ‘/boot’ partition was nearly full.

by ‘/boot’ is a 1.1 GB XFS partition and its filling up with something, I suspect some vestigial files from previous versions of Rocky Linux?

Is there some advice about how to update then run maintenance to remove vestigial files?

here is an example of whats in by /boot partition

[steve@steve-pc boot]$ ls
config-5.14.0-427.13.1.el9_4.x86_64
config-5.14.0-427.31.1.el9_4.x86_64
config-5.14.0-427.33.1.el9_4.x86_64
efi
grub2
initramfs-0-rescue-7df3ea8e67c0440a91b6edd7674223c7.img
initramfs-5.14.0-427.13.1.el9_4.x86_64.img
initramfs-5.14.0-427.13.1.el9_4.x86_64kdump.img
initramfs-5.14.0-427.31.1.el9_4.x86_64.img
initramfs-5.14.0-427.31.1.el9_4.x86_64kdump.img
initramfs-5.14.0-427.33.1.el9_4.x86_64.img
initramfs-5.14.0-427.33.1.el9_4.x86_64kdump.img
loader
symvers-5.14.0-427.13.1.el9_4.x86_64.gz
symvers-5.14.0-427.31.1.el9_4.x86_64.gz
symvers-5.14.0-427.33.1.el9_4.x86_64.gz
System.map-5.14.0-427.13.1.el9_4.x86_64
System.map-5.14.0-427.31.1.el9_4.x86_64
System.map-5.14.0-427.33.1.el9_4.x86_64
vmlinuz-0-rescue-7df3ea8e67c0440a91b6edd7674223c7
vmlinuz-5.14.0-427.13.1.el9_4.x86_64
vmlinuz-5.14.0-427.31.1.el9_4.x86_64
vmlinuz-5.14.0-427.33.1.el9_4.x86_64

And here is my lsblk for reference

sda           8:0    0   3.6T  0 disk 
├─sda1        8:1    0   600M  0 part /boot/efi
├─sda2        8:2    0     1G  0 part /boot
└─sda3        8:3    0   3.1T  0 part 
  ├─rl-root 253:0    0     2T  0 lvm  /
  ├─rl-swap 253:1    0   128G  0 lvm  [SWAP]
  └─rl-home 253:2    0     1T  0 lvm  /home

And lastly here is a screenshot showing how I left some free space for flexibility in assigning disk space to partitions

Thanks

Could it be a solution to extend the XFS partition mounted at /boot to be larger? Like 5GB for example? - However I think the best solution is for me to actually understand the fundamentals of whats going on. Like I highly suspect the /boot partition of being filled with some kind of vestigial data from previous versions of Rocky.

Additional reference

[steve@steve-pc ~]$ rpm -q kernel
kernel-5.14.0-427.13.1.el9_4.x86_64
kernel-5.14.0-427.31.1.el9_4.x86_64
kernel-5.14.0-427.33.1.el9_4.x86_64
[steve@steve-pc ~]$ uname -r
5.14.0-427.33.1.el9_4.x86_64

There is a max of three kernels installed for Rocky Linux. When a fourth gets installed for an update, the oldest of the original three are removed. If your /boot partition is being filled up, check du like below to try to determine where the issue is.

[root@cm02 ~]# rpm -q kernel
kernel-5.14.0-362.8.1.el9_3.x86_64
kernel-5.14.0-362.18.1.el9_3.x86_64
kernel-5.14.0-427.13.1.el9_4.x86_64
[root@cm02 ~]# df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda2       960M  360M  601M  38% /boot
[root@cm02 ~]# cd /boot
[root@cm02 boot]# du -sch *
216K    config-5.14.0-362.18.1.el9_3.x86_64
216K    config-5.14.0-362.8.1.el9_3.x86_64
220K    config-5.14.0-427.13.1.el9_4.x86_64
7.1M    efi
2.3M    grub2
75M     initramfs-0-rescue-5eca7f8e86db414484d365469a467aab.img
36M     initramfs-5.14.0-362.18.1.el9_3.x86_64.img
32M     initramfs-5.14.0-362.18.1.el9_3.x86_64kdump.img
36M     initramfs-5.14.0-362.8.1.el9_3.x86_64.img
34M     initramfs-5.14.0-427.13.1.el9_4.x86_64.img
33M     initramfs-5.14.0-427.13.1.el9_4.x86_64kdump.img
20K     loader
0       symvers-5.14.0-362.18.1.el9_3.x86_64.gz
0       symvers-5.14.0-362.8.1.el9_3.x86_64.gz
0       symvers-5.14.0-427.13.1.el9_4.x86_64.gz
8.2M    System.map-5.14.0-362.18.1.el9_3.x86_64
8.2M    System.map-5.14.0-362.8.1.el9_3.x86_64
8.3M    System.map-5.14.0-427.13.1.el9_4.x86_64
13M     vmlinuz-0-rescue-5eca7f8e86db414484d365469a467aab
13M     vmlinuz-5.14.0-362.18.1.el9_3.x86_64
13M     vmlinuz-5.14.0-362.8.1.el9_3.x86_64
13M     vmlinuz-5.14.0-427.13.1.el9_4.x86_64
328M    total

You shouldn’t have to in normal circumstances. 1GB is typically enough.

1 Like

thanks for helping me

[steve@steve-pc boot]$ sudo du -sch *
[sudo] password for steve: 
220K	config-5.14.0-427.13.1.el9_4.x86_64
220K	config-5.14.0-427.31.1.el9_4.x86_64
220K	config-5.14.0-427.33.1.el9_4.x86_64
7.1M	efi
2.3M	grub2
132M	initramfs-0-rescue-7df3ea8e67c0440a91b6edd7674223c7.img
136M	initramfs-5.14.0-427.13.1.el9_4.x86_64.img
37M	initramfs-5.14.0-427.13.1.el9_4.x86_64kdump.img
136M	initramfs-5.14.0-427.31.1.el9_4.x86_64.img
114M	initramfs-5.14.0-427.31.1.el9_4.x86_64kdump.img
137M	initramfs-5.14.0-427.33.1.el9_4.x86_64.img
114M	initramfs-5.14.0-427.33.1.el9_4.x86_64kdump.img
20K	loader
0	symvers-5.14.0-427.13.1.el9_4.x86_64.gz
0	symvers-5.14.0-427.31.1.el9_4.x86_64.gz
0	symvers-5.14.0-427.33.1.el9_4.x86_64.gz
8.3M	System.map-5.14.0-427.13.1.el9_4.x86_64
8.3M	System.map-5.14.0-427.31.1.el9_4.x86_64
8.3M	System.map-5.14.0-427.33.1.el9_4.x86_64
13M	vmlinuz-0-rescue-7df3ea8e67c0440a91b6edd7674223c7
13M	vmlinuz-5.14.0-427.13.1.el9_4.x86_64
13M	vmlinuz-5.14.0-427.31.1.el9_4.x86_64
13M	vmlinuz-5.14.0-427.33.1.el9_4.x86_64
889M	total

Kernel is a package that there can be more than one version simultaneously installed.

Consider following: You are running kernel version X. You install version Y. If Y would replace files of X, then you would still have version X in memory, but not in files. After reboot, you would then run Y – if the install was successful. If there is an issue in the install, then you have no kernel at all. With current system the X is kept, so you can still boot with known-to-work X and fix install of Y.

There is installonly_limit in /etc/dnf/dnf.conf. It could be decreased to 2 to keep only two kernels. However, three should fit fine.


One can get a neat summary of disk usage with:

sudo du -d 1 -hx /boot

The ‘x’ limits search to one filesystem – does not add the /boot/efi that is different filesystem into the total.
The number after ‘d’ tells much details to show before total.


Note how most of the space is used by the initramfs images. Note also that you have 7 of them. That is as expected.

  • There is one for each installed kernel. That is three
  • There is one “rescue” and corresponding vmlinuz-0-rescue-* (and file in /boot/loader/entries/). Package dracut-config-rescue makes a copy of vmlinuz and generates a special initramfs in some conditions. This kernel is one more safety measure for situations, where none of the regular kernels can boot
  • There are three “kdump” images, one for each kernel (except the rescue copy). On certain crash situations the machine reboots with that image in order to debug the crash. If that (kdump service) is disabled, then install of new kernels will no longer generate the additional “kdump.img”

[EDIT] Note: lsblk -f shows filesystem type and remaining free space.

A similar problem has been handled in this topic How do i extend /boot partition capacity?

You can check it out for some useful tips.

1 Like

Thanks I really appreciate that. Ill take a look. Thanks for all the feedback everyone :slight_smile: