/boot nearly full - how to free space?

Hello everyone,

my computer complains that the /boot partition is nearly full and I cannot update my system due to this. It seems like old kernels and whatnot are using up all the space. What do I need to delete in order to free space up in /boot?

ls -lh /boot
insgesamt 861M
-rw-r--r--. 1 root root 244K 22. Sep 05:12 config-5.19.10-1.surface.fc36.x86_64
-rw-r--r--. 1 root root 244K 23. Sep 17:26 config-5.19.11-200.fc36.x86_64
-rw-r--r--. 1 root root 244K 28. Sep 19:29 config-5.19.12-200.fc36.x86_64
-rw-r--r--. 1 root root 244K  7. Okt 02:50 config-5.19.13-1.surface.fc36.x86_64
-rw-r--r--. 1 root root 244K  4. Okt 18:01 config-5.19.13-200.fc36.x86_64
-rw-r--r--. 1 root root 244K  5. Okt 23:49 config-5.19.14-200.fc36.x86_64
-rw-r--r--. 1 root root 246K  2. Dez 21:57 config-6.0.11-200.fc36.x86_64
-rw-r--r--. 1 root root 246K  9. Dez 16:05 config-6.0.12-1.surface.fc37.x86_64
-rw-r--r--. 1 root root 246K  8. Dez 18:47 config-6.0.12-200.fc36.x86_64
-rw-r--r--. 1 root root 246K 21. Dez 20:05 config-6.0.15-200.fc36.x86_64
-rw-r--r--. 1 root root 246K 21. Dez 19:52 config-6.0.15-300.fc37.x86_64
drwx------. 5 root root 4,0K  1. Jan 1970  efi
drwxr-xr-x. 2 root root 4,0K 25. Dez 14:31 extlinux
drwxr-xr-x. 3 root root 4,0K  7. Dez 2021  grub
drwx------. 3 root root 4,0K 13. Feb 12:47 grub2
-rw-------. 1 root root 100M  7. Okt 19:11 initramfs-0-rescue-203af52c3fab4e0f8220057acc5a4a2e.img
-rw-------. 1 root root 100M 22. Okt 22:44 initramfs-0-rescue-7528ec4f33b84a7497ae2b2416ae4b1d.img
-rw-------. 1 root root  89M  5. Dez 2021  initramfs-0-rescue-da2c69ba414c485b95e58855d86bcfbd.img
-rw-------. 1 root root  34M 24. Sep 15:00 initramfs-5.19.10-1.surface.fc36.x86_64.img
-rw-------. 1 root root  35M 26. Sep 12:22 initramfs-5.19.11-200.fc36.x86_64.img
-rw-------. 1 root root  35M  1. Okt 10:02 initramfs-5.19.12-200.fc36.x86_64.img
-rw-------. 1 root root  35M  7. Okt 20:21 initramfs-5.19.13-1.surface.fc36.x86_64.img
-rw-------. 1 root root  36M  7. Okt 19:37 initramfs-5.19.13-200.fc36.x86_64.img
-rw-------. 1 root root  36M 13. Okt 21:35 initramfs-5.19.14-200.fc36.x86_64.img
-rw-------. 1 root root  36M  7. Dez 22:58 initramfs-6.0.11-200.fc36.x86_64.img
-rw-------. 1 root root  35M 25. Dez 14:36 initramfs-6.0.12-1.surface.fc37.x86_64.img
-rw-------. 1 root root  36M 12. Dez 14:04 initramfs-6.0.12-200.fc36.x86_64.img
-rw-------. 1 root root  36M 25. Dez 13:31 initramfs-6.0.15-200.fc36.x86_64.img
-rw-------. 1 root root  35M 25. Dez 14:36 initramfs-6.0.15-300.fc37.x86_64.img
drwxr-xr-x. 3 root root 4,0K  5. Dez 2021  loader
drwx------. 2 root root  16K  5. Dez 2021  lost+found
lrwxrwxrwx. 1 root root   47 26. Sep 12:22 symvers-5.19.11-200.fc36.x86_64.gz -> /lib/modules/5.19.11-200.fc36.x86_64/symvers.gz
lrwxrwxrwx. 1 root root   47  1. Okt 10:02 symvers-5.19.12-200.fc36.x86_64.gz -> /lib/modules/5.19.12-200.fc36.x86_64/symvers.gz
lrwxrwxrwx. 1 root root   47  7. Okt 19:37 symvers-5.19.13-200.fc36.x86_64.gz -> /lib/modules/5.19.13-200.fc36.x86_64/symvers.gz
lrwxrwxrwx. 1 root root   47 13. Okt 21:35 symvers-5.19.14-200.fc36.x86_64.gz -> /lib/modules/5.19.14-200.fc36.x86_64/symvers.gz
lrwxrwxrwx. 1 root root   46  7. Dez 22:57 symvers-6.0.11-200.fc36.x86_64.gz -> /lib/modules/6.0.11-200.fc36.x86_64/symvers.gz
lrwxrwxrwx. 1 root root   46 12. Dez 14:03 symvers-6.0.12-200.fc36.x86_64.gz -> /lib/modules/6.0.12-200.fc36.x86_64/symvers.gz
lrwxrwxrwx. 1 root root   46 25. Dez 13:31 symvers-6.0.15-200.fc36.x86_64.gz -> /lib/modules/6.0.15-200.fc36.x86_64/symvers.gz
lrwxrwxrwx. 1 root root   46 25. Dez 14:36 symvers-6.0.15-300.fc37.x86_64.gz -> /lib/modules/6.0.15-300.fc37.x86_64/symvers.gz
-rw-r--r--. 1 root root 6,0M 22. Sep 05:12 System.map-5.19.10-1.surface.fc36.x86_64
-rw-------. 1 root root 6,1M 23. Sep 17:25 System.map-5.19.11-200.fc36.x86_64
-rw-------. 1 root root 6,1M 28. Sep 19:29 System.map-5.19.12-200.fc36.x86_64
-rw-r--r--. 1 root root 6,0M  7. Okt 02:50 System.map-5.19.13-1.surface.fc36.x86_64
-rw-------. 1 root root 6,1M  4. Okt 18:01 System.map-5.19.13-200.fc36.x86_64
-rw-------. 1 root root 6,1M  5. Okt 23:49 System.map-5.19.14-200.fc36.x86_64
-rw-------. 1 root root 7,0M  2. Dez 21:57 System.map-6.0.11-200.fc36.x86_64
-rw-r--r--. 1 root root 6,9M  9. Dez 16:05 System.map-6.0.12-1.surface.fc37.x86_64
-rw-------. 1 root root 6,9M  8. Dez 18:47 System.map-6.0.12-200.fc36.x86_64
-rw-------. 1 root root 6,9M 21. Dez 20:05 System.map-6.0.15-200.fc36.x86_64
-rw-------. 1 root root 6,9M 21. Dez 19:52 System.map-6.0.15-300.fc37.x86_64
-rwxr-xr-x. 1 root root  12M  7. Okt 19:11 vmlinuz-0-rescue-203af52c3fab4e0f8220057acc5a4a2e
-rwxr-xr-x. 1 root root  12M 22. Okt 22:43 vmlinuz-0-rescue-7528ec4f33b84a7497ae2b2416ae4b1d
-rwxr-xr-x. 1 root root  11M  5. Dez 2021  vmlinuz-0-rescue-da2c69ba414c485b95e58855d86bcfbd
-rwxr-xr-x. 1 root root  12M 23. Sep 17:26 vmlinuz-5.19.11-200.fc36.x86_64
-rwxr-xr-x. 1 root root  12M 28. Sep 19:29 vmlinuz-5.19.12-200.fc36.x86_64
-rwxr-xr-x. 1 root root  12M  4. Okt 18:01 vmlinuz-5.19.13-200.fc36.x86_64
-rwxr-xr-x. 1 root root  11M  9. Dez 16:05 vmlinuz-6.0.12-1.surface.fc37.x86_64
-rwxr-xr-x. 1 root root  13M  8. Dez 18:47 vmlinuz-6.0.12-200.fc36.x86_64
-rwxr-xr-x. 1 root root  13M 21. Dez 20:05 vmlinuz-6.0.15-200.fc36.x86_64
-rwxr-xr-x. 1 root root  13M 21. Dez 19:52 vmlinuz-6.0.15-300.fc37.x86_64

You can boot the latest kernel and remove the old ones like this:

sudo dnf remove --oldinstallonly
2 Likes

It appears you have upgraded to fedora 37.
For some reason you have all the kernel related files in /boot that apply to numerous older fedora 36 kernels.

I even see 3 different rescue images there.
I would first do dnf list installed kernel* as see exactly what kernels are actually installed.

If that output shows more than 3 kernel versions then something is different with the dnf config than standard which only by default keeps the 3 most recent kernels.

If the listing from the above returns more than 3 kernel versions, especially if it shows kernels all the way back to the 5.19.10 version, you should run
sudo dnf remove kernel*VERSION* where you replace VERSION with the actual kernel version you wish to remove. This can be repeated as many times as necessary to eliminate all but the latest 3 kernel versions.

You might look at /etc/dnf/dnf.conf to see how many kernels it is configured to keep. The default is installonly-limit=3. If that has been modified or removed then it may keep more kernels, which could explain why you have so many kernel files showing up in /boot.

Yeah I did upgrade from f36 to f37. I ran some of the commands, but my older kernel pre Version 6.x.x are not listed. Here is the output for them:

dnf list installed kernel*
Installierte Pakete
kernel.x86_64                          6.0.11-200.fc36            @updates      
kernel.x86_64                          6.0.12-200.fc36            @updates      
kernel.x86_64                          6.0.15-200.fc36            @updates      
kernel.x86_64                          6.0.15-300.fc37            @updates      
kernel-core.x86_64                     6.0.11-200.fc36            @updates      
kernel-core.x86_64                     6.0.12-200.fc36            @updates      
kernel-core.x86_64                     6.0.15-200.fc36            @updates      
kernel-core.x86_64                     6.0.15-300.fc37            @updates      
kernel-headers.x86_64                  6.0.5-300.fc37             @fedora       
kernel-modules.x86_64                  6.0.11-200.fc36            @updates      
kernel-modules.x86_64                  6.0.12-200.fc36            @updates      
kernel-modules.x86_64                  6.0.15-200.fc36            @updates      
kernel-modules.x86_64                  6.0.15-300.fc37            @updates      
kernel-modules-extra.x86_64            6.0.11-200.fc36            @updates      
kernel-modules-extra.x86_64            6.0.12-200.fc36            @updates      
kernel-modules-extra.x86_64            6.0.15-200.fc36            @updates      
kernel-modules-extra.x86_64            6.0.15-300.fc37            @updates      
kernel-surface.x86_64                  6.0.12-1.fc37              @linux-surface
cat /etc/dnf/dnf.conf
# see `man dnf.conf` for defaults and possible options

[main]
gpgcheck=True
installonly_limit=3
clean_requirements_on_remove=True
best=False
skip_if_unavailable=True

# User applied confs
fastestmirror=True
max_parallel_downloads=10
defaultyes=True
keepcache=True

This results in the same problem of not all kernels beings shown.
I can only think of manually deleting the files, but I do not know which.

Compare the list you received with dnf list installed kernel* and the list you received with ls /boot.

Any files in the ‘ls’ listing that begin with config-VERSION, initramfs-VERSION, symvers-VERSION, System.map-VERSION, or vmlinuz-VERSION where VERSION does not match the ones shown in the ‘dnf list’ command can be removed manually with sudo rm /boot/<filename>.

4 Likes

This works. Thanks to both of you for taking the time to help me.

1 Like

There may also be unloved and unwanted old /lib/modules directories corresponding to the kernels you removed. There is also a question of why you had so many old kernels despite a setting that should limit the number to 3 plus a rescue kernel.

I just deleted 9 old initramfs files in the range of “fc22” till “fc30”. What mechanism should delete those? I used to install nvidia drivers manually in that time (some of these initramfs end in nvidia.img, most in nouveau.img), maybe that messed up the automatic cleanup :thinking:

files that are not created and installed by the system during updates do not get deleted during updates. Manually compiling is one way to break the automatic updates.

My /boot has the following, for the latest 3 kernels and only the rescue kernel additional
Notice that only the initramfs and vmlinuz files are there for the rescue kernel

$ ls /boot
config-6.2.12-200.fc37.x86_64                            symvers-6.2.12-200.fc37.x86_64.gz
config-6.2.13-200.fc37.x86_64                            symvers-6.2.13-200.fc37.x86_64.gz
config-6.2.14-200.fc37.x86_64                            symvers-6.2.14-200.fc37.x86_64.gz
efi                                                      System.map-6.2.12-200.fc37.x86_64
grub2                                                    System.map-6.2.13-200.fc37.x86_64
initramfs-0-rescue-9a24c575d0d74cc6ae527869279847e3.img  System.map-6.2.14-200.fc37.x86_64
initramfs-6.2.12-200.fc37.x86_64.img                     vmlinuz-0-rescue-9a24c575d0d74cc6ae527869279847e3
initramfs-6.2.13-200.fc37.x86_64.img                     vmlinuz-6.2.12-200.fc37.x86_64
initramfs-6.2.14-200.fc37.x86_64.img                     vmlinuz-6.2.13-200.fc37.x86_64
loader                                                   vmlinuz-6.2.14-200.fc37.x86_64
lost+found

If the user does not add anything beyond what the system automatically installed with an upgrade then the system automatically removes the older ones when there is a kernel upgrade. If the file names are different the system cannot manage the files that are differently named.

Theoretically your system should not have anything other than shown above, but maybe differing for the last 3 kernels installed.

The command dnf list installed kernel should show you the currently installed kernel versions and those should be the only ones in /boot (except the rescue kernel).

2 Likes