Initramfs is causing my boot to have low space

Hi there, i hope you’re all having a lovely day. I was wondering if someone could please help me with this problem that i’m facing.

Whenever i boot up my laptop, i’m notified that i have low boot space. Rescue disks are taking up the space, but frankly, i’m lost on what to do about it, as i fully committed to Linux for the first time several days ago. I’ve attached a screenshot in the hopes that will help.

Any advice would be greatly appreciated. Thank you.

To solve the problem try the following steps:

Step 1: Check Boot Partition Usage

First, let’s see what is taking up space in your boot partition:

  1. Open a terminal.
  2. Run the following command to check the usage of your boot partition:

bash

df -h /boot

This will show you how much space is being used and how much is left.

Step 2: Remove Old Kernels

If old kernels are taking up space, you can remove them. Fedora typically keeps several old kernels for safety, but if space is tight, you might want to remove some of them.

  1. List all installed kernels:

bash

sudo dnf list installed kernel
  1. Remove old kernels, but do not remove the current one (usually the one you’re booted into):

bash

sudo dnf remove kernel-<version>

Replace <version> with the specific version numbers of the kernels you want to remove.

Step 3: Clean Up Rescue Disks

Rescue disks can also take up space. To clean them up:

  1. List all rescue disks:

bash

sudo ls /boot/vmlinuz-*-rescue*
  1. Remove unwanted rescue disks:

bash

sudo rm /boot/vmlinuz-*-rescue*

Step 4: Configure dnf to Limit Kernel Versions

To prevent this from happening in the future, you can configure dnf to limit the number of kernel versions it keeps:

  1. Open the dnf.conf file:

bash

sudo nano /etc/dnf/dnf.conf
  1. Add or modify the following line to limit the number of installed kernels to 3:

ini

installonly_limit=3
  1. Save and close the file (press Ctrl + O to save and Ctrl + X to exit in nano).

Step 5: Clean Up Package Cache (Optional)

You can also clean up the package cache to free up some additional space:

bash

sudo dnf clean all

Step 6: Check for BTRFS-Specific Tools

Since you’re using BTRFS, make sure you’re using tools specific to this filesystem to manage snapshots and space. BTRFS can take snapshots automatically, which might also use up space.

  1. List BTRFS snapshots:

bash

sudo btrfs subvolume list /
  1. If you find unnecessary snapshots, you can delete them:

bash

sudo btrfs subvolume delete /path/to/snapshot

Step 7: Reboot and Verify

After you’ve cleaned up the old kernels and rescue disks, reboot your system and check if the low space warning persists.

I’m not convinced you have an issue that needs fixing.

So long as you have the default /boot size then you do not need to take any action. It will allow for 3 kernels to be installed and the rescue kernel.

This is the size of /boot on a freshly built Fedora server:

$ df -h /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p2  960M  344M  617M  36% /boot

and this is the contents of /boot for reference.

$ ll -h /boot
total 291M
-rw-r--r--. 1 root 266K 2024-04-11 01:00:00 config-6.8.5-301.fc40.x86_64
-rw-r--r--. 1 root 268K 2024-07-27 01:00:00 config-6.9.12-200.fc40.x86_64
drwx------. 3 root 4.0K 1970-01-01 01:00:00 efi/
drwx------. 3 root   50 2024-08-08 09:04:19 grub2/
-rw-------. 1 root 152M 2024-08-04 10:50:39 initramfs-0-rescue-15eab0c518af4080acc6f075de88d0a7.img
-rw-------. 1 root  43M 2024-08-04 10:52:03 initramfs-6.8.5-301.fc40.x86_64.img
-rw-------. 1 root  35M 2024-08-04 11:58:44 initramfs-6.9.12-200.fc40.x86_64.img
drwxr-xr-x. 3 root   21 2024-08-04 10:47:40 loader/
lrwxrwxrwx. 1 root   45 2024-08-04 10:50:39 symvers-6.8.5-301.fc40.x86_64.xz -> /lib/modules/6.8.5-301.fc40.x86_64/symvers.xz
-rw-r--r--. 1 root 160K 2024-08-04 11:58:45 symvers-6.9.12-200.fc40.x86_64.xz
-rw-r--r--. 1 root 8.5M 2024-04-11 01:00:00 System.map-6.8.5-301.fc40.x86_64
-rw-r--r--. 1 root 8.9M 2024-07-27 01:00:00 System.map-6.9.12-200.fc40.x86_64
-rwxr-xr-x. 1 root  15M 2024-08-04 10:49:30 vmlinuz-0-rescue-15eab0c518af4080acc6f075de88d0a7*
-rwxr-xr-x. 1 root  15M 2024-04-11 01:00:00 vmlinuz-6.8.5-301.fc40.x86_64*
-rwxr-xr-x. 1 root  16M 2024-07-27 01:00:00 vmlinuz-6.9.12-200.fc40.x86_64*

This is what comes up for me when i do the same.

It worked! I was able to use sudo rm to delete the rescue disk that was taking up the majority of space and i didn’t get the notification upon reboot. Thank you for your help!

Should i be creating my own rescue disks or be concerned at all about having deleted one?

It’s worth mentioning that the files right under /boot (including the just deleted rescue image) are only taking up about a quarter of the partition size (216M out of 974M).

I would take a look at the subdirectories, and in particular at /boot/timeshift.

1 Like

Also take a look at timeshift. This doesn’t belong in the boot file system, and can in the end take up a lot of space.

1 Like

Note that the command sudo du -hs /boot/* will show the space occupied by everything in /boot, including the usage within each subdirectory.

I suspect that the suggestion about timeshift is correct and that the content of that directory is what is filling up /boot.

Removing the rescue image as done by the OP will not work long term since the next kernel update will automatically recreate a new rescue image and the problem will return but may be even more catastrophic than just a warning.

@faeanxrchy
I strongly suggest that you reconfigure timeshift to NOT use space in /boot and that you also remove that directory (/boot/timeshift) and all its content.

1 Like

Thank you for your insight. I had already configured Timeshift to backup to an external hard-drive, but i see it in boot, too, so i must have made that mistake on the initial setup.

Also, what do you mean by "may return and be more catastrophic than a warning? Is there something else that i should do after i remove timeshift to make my system more stable/secure?

sudo rm -r /boot/timeshift

Nothing else should be necessary, and the use of df -h after removing that directory should show plenty of free space. It probably will have at least 30% of the ~1GB space free. My system shows that /boot is 825M with 231M available.

A kernel update that fails due to lack of space may require additional actions to recover. Better to never need to do that kind of recovery.

1 Like

You’ve been really helpful, thank you Jeff. Does this look right to you?

Try du -h /boot/*

It is always considered better to copy & paste text instead of screenshots.

Thank you for letting me know,.

This is what i get.

fae@Gnome-Home:~$ du -h /boot/*
272K /boot/config-6.10.3-200.fc40.x86_64
268K /boot/config-6.9.12-200.fc40.x86_64
du: cannot read directory ‘/boot/efi’: Permission denied
4.0K /boot/efi
du: cannot read directory ‘/boot/grub2’: Permission denied
4.0K /boot/grub2
38M /boot/initramfs-6.10.3-200.fc40.x86_64.img
38M /boot/initramfs-6.9.12-200.fc40.x86_64.img
du: cannot read directory ‘/boot/loader/entries’: Permission denied
4.0K /boot/loader/entries
8.0K /boot/loader
du: cannot read directory ‘/boot/lost+found’: Permission denied
16K /boot/lost+found
164K /boot/symvers-6.10.3-200.fc40.x86_64.xz
160K /boot/symvers-6.9.12-200.fc40.x86_64.xz
8.9M /boot/System.map-6.10.3-200.fc40.x86_64
8.9M /boot/System.map-6.9.12-200.fc40.x86_64
16M /boot/vmlinuz-6.10.3-200.fc40.x86_64
16M /boot/vmlinuz-6.9.12-200.fc40.x86_64
fae@Gnome-Home:~$

Sorry, that should have been sudo du -h /boot/* so it could access the subdirectories.

No problem, thank you for taking the time to help me out.

Here’s the new one.

fae@Gnome-Home:~$ sudo du -h /boot/*
272K /boot/config-6.10.3-200.fc40.x86_64
268K /boot/config-6.9.12-200.fc40.x86_64
1.8M /boot/efi/EFI/BOOT
18M /boot/efi/EFI/fedora
20M /boot/efi/EFI
8.0K /boot/efi/System/Library/CoreServices
12K /boot/efi/System/Library
16K /boot/efi/System
20M /boot/efi
2.3M /boot/grub2/fonts
2.4M /boot/grub2
38M /boot/initramfs-6.10.3-200.fc40.x86_64.img
38M /boot/initramfs-6.9.12-200.fc40.x86_64.img
16K /boot/loader/entries
20K /boot/loader
16K /boot/lost+found
164K /boot/symvers-6.10.3-200.fc40.x86_64.xz
160K /boot/symvers-6.9.12-200.fc40.x86_64.xz
8.9M /boot/System.map-6.10.3-200.fc40.x86_64
8.9M /boot/System.map-6.9.12-200.fc40.x86_64
16M /boot/vmlinuz-6.10.3-200.fc40.x86_64
16M /boot/vmlinuz-6.9.12-200.fc40.x86_64
fae@Gnome-Home:~$

I am not understanding something here.

Nothing is showing in /boot as unusual, yet I have 3 kernels and the rescue kernel installed and see this.
/dev/nvme0n1p2 825M 547M 220M 72% /boot
You have only 2 kernels and no rescue kernel and showed this.
image

Please show a newly run df -h and sudo ls -lR /boot

Please use the </> (preformatted text) button on the toolbar to retain the on-screen formatting of what you copy&paste here.

fae@Gnome-Home:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0       237G  100G  135G  43% /
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           7.7G  804K  7.7G   1% /dev/shm
efivarfs        128K  119K  4.6K  97% /sys/firmware/efi/efivars
tmpfs           3.1G  2.1M  3.1G   1% /run
/dev/dm-0       237G  100G  135G  43% /home
tmpfs           7.7G  752K  7.7G   1% /tmp
/dev/nvme0n1p2  974M  780M  128M  86% /boot
/dev/nvme0n1p1  599M   20M  580M   4% /boot/efi
tmpfs           1.6G   31M  1.6G   2% /run/user/1000
fae@Gnome-Home:~$ sudo ls -lR /boot
[sudo] password for fae: 
/boot:
total 126900
-rw-r--r--. 1 root root   275499 Aug  5 10:00 config-6.10.3-200.fc40.x86_64
-rw-r--r--. 1 root root   274277 Jul 27 10:00 config-6.9.12-200.fc40.x86_64
drwx------. 4 root root     4096 Jan  1  1970 efi
drwx------. 3 root root     4096 Aug 10 06:47 grub2
-rw-------. 1 root root 39536204 Aug 10 06:50 initramfs-6.10.3-200.fc40.x86_64.img
-rw-------. 1 root root 38990917 Aug  9 21:39 initramfs-6.9.12-200.fc40.x86_64.img
drwxr-xr-x. 3 root root     4096 Aug  7 21:46 loader
drwx------. 2 root root    16384 Aug  7 21:43 lost+found
-rw-r--r--. 1 root root   165780 Aug 10 06:50 symvers-6.10.3-200.fc40.x86_64.xz
-rw-r--r--. 1 root root   163112 Aug  7 08:21 symvers-6.9.12-200.fc40.x86_64.xz
-rw-r--r--. 1 root root  9329995 Aug  5 10:00 System.map-6.10.3-200.fc40.x86_64
-rw-r--r--. 1 root root  9262644 Jul 27 10:00 System.map-6.9.12-200.fc40.x86_64
-rwxr-xr-x. 1 root root 16009576 Aug  5 10:00 vmlinuz-6.10.3-200.fc40.x86_64
-rwxr-xr-x. 1 root root 15890792 Jul 27 10:00 vmlinuz-6.9.12-200.fc40.x86_64

/boot/efi:
total 12
drwx------. 4 root root 4096 Apr 14 18:57 EFI
-rwx------. 1 root root   34 Jan 24  2024 mach_kernel
drwx------. 3 root root 4096 Apr 14 19:00 System

/boot/efi/EFI:
total 8
drwx------. 2 root root 4096 Apr 14 18:59 BOOT
drwx------. 2 root root 4096 Aug  7 08:20 fedora

/boot/efi/EFI/BOOT:
total 1820
-rwx------. 1 root root 747681 Mar 18 20:00 BOOTIA32.EFI
-rwx------. 1 root root 949424 Mar 18 20:00 BOOTX64.EFI
-rwx------. 1 root root  70360 Mar 18 20:00 fbia32.efi
-rwx------. 1 root root  87816 Mar 18 20:00 fbx64.efi

/boot/efi/EFI/fedora:
total 17636
-rwx------. 1 root root     112 Mar 18 20:00 BOOTIA32.CSV
-rwx------. 1 root root     110 Mar 18 20:00 BOOTX64.CSV
-rwx------. 1 root root 2960704 May 29 10:00 gcdia32.efi
-rwx------. 1 root root 3972416 May 29 10:00 gcdx64.efi
-rwx------. 1 root root     144 Aug  7 07:47 grub.cfg
-rwx------. 1 root root 2960704 May 29 10:00 grubia32.efi
-rwx------. 1 root root 3972416 May 29 10:00 grubx64.efi
-rwx------. 1 root root  673992 Mar 18 20:00 mmia32.efi
-rwx------. 1 root root  848080 Mar 18 20:00 mmx64.efi
-rwx------. 1 root root  949424 Mar 18 20:00 shim.efi
-rwx------. 1 root root  747681 Mar 18 20:00 shimia32.efi
-rwx------. 1 root root  949424 Mar 18 20:00 shimx64.efi

/boot/efi/System:
total 4
drwx------. 3 root root 4096 Apr 14 19:00 Library

/boot/efi/System/Library:
total 4
drwx------. 2 root root 4096 Apr 14 19:00 CoreServices

/boot/efi/System/Library/CoreServices:
total 4
-rwx------. 1 root root 384 Jan 24  2024 SystemVersion.plist

/boot/grub2:
total 16
drwx------. 2 root root 4096 Aug  7 08:20 fonts
-rw-------. 1 root root 6451 Aug  7 21:47 grub.cfg
-rw-------. 1 root root 1024 Aug 10 06:50 grubenv

/boot/grub2/fonts:
total 2340
-rwx------. 1 root root 2394108 May 29 10:00 unicode.pf2

/boot/loader:
total 4
drwx------. 2 root root 4096 Aug 10 06:50 entries

/boot/loader/entries:
total 12
-rw-r--r--. 1 root root 471 Aug  7 21:47 5ecb147d906442d0b700cabbbf385568-0-rescue.conf
-rw-r--r--. 1 root root 394 Aug 10 06:50 5ecb147d906442d0b700cabbbf385568-6.10.3-200.fc40.x86_64.conf
-rw-r--r--. 1 root root 394 Aug  7 08:21 5ecb147d906442d0b700cabbbf385568-6.9.12-200.fc40.x86_64.conf

/boot/lost+found:
total 0
fae@Gnome-Home:~$ 

Now I am even more puzzled.
The free space shown by df -h did not change. It shows that you are using 780M of space in /boot. Mine shows using 574M with the additional files for the rescue kernel and one additional installed kernel

df -h
/dev/nvme0n1p2                 825M  547M  220M  72% /boot

# ls -lR /boot
/boot:
total 557068
-rw-r--r--. 1 root root    275499 Aug  4 19:00 config-6.10.3-200.fc40.x86_64
-rw-r--r--. 1 root root    274277 Jul 24 19:00 config-6.9.11-200.fc40.x86_64
-rw-r--r--. 1 root root    274277 Jul 26 19:00 config-6.9.12-200.fc40.x86_64
drwx------. 4 root root     16384 Dec 31  1969 efi
drwx------. 3 root root      4096 Aug  9 12:25 grub2
-rw-------. 1 root root 171755602 Aug  9 17:16 initramfs-0-rescue-594ece762a4b48678f35f7be2ddf7410.img
-rw-------. 1 root root  74649663 Aug  9 17:15 initramfs-6.10.3-200.fc40.x86_64.img
-rw-------. 1 root root 157323036 Jul 29 19:36 initramfs-6.9.11-200.fc40.x86_64.img
-rw-------. 1 root root  73670416 Aug  1 14:26 initramfs-6.9.12-200.fc40.x86_64.img
drwxr-xr-x. 3 root root      4096 Jul 28 18:36 loader
drwx------. 2 root root     16384 Jul 28 18:32 lost+found
-rw-r--r--. 1 root root    165780 Aug  9 09:47 symvers-6.10.3-200.fc40.x86_64.xz
-rw-r--r--. 1 root root    163112 Jul 28 18:59 symvers-6.9.11-200.fc40.x86_64.xz
-rw-r--r--. 1 root root    163112 Aug  1 14:26 symvers-6.9.12-200.fc40.x86_64.xz
-rw-r--r--. 1 root root   9329995 Aug  4 19:00 System.map-6.10.3-200.fc40.x86_64
-rw-r--r--. 1 root root   9262644 Jul 24 19:00 System.map-6.9.11-200.fc40.x86_64
-rw-r--r--. 1 root root   9262644 Jul 26 19:00 System.map-6.9.12-200.fc40.x86_64
-rwxr-xr-x. 1 root root  16009576 Aug  9 17:15 vmlinuz-0-rescue-594ece762a4b48678f35f7be2ddf7410
-rwxr-xr-x. 1 root root  16009576 Aug  4 19:00 vmlinuz-6.10.3-200.fc40.x86_64
-rwxr-xr-x. 1 root root  15890792 Jul 24 19:00 vmlinuz-6.9.11-200.fc40.x86_64
-rwxr-xr-x. 1 root root  15890792 Jul 26 19:00 vmlinuz-6.9.12-200.fc40.x86_64

Note that I have a vmlinuz & initramfs both for rescue as well as all the files for the 6.9.11 kernel yet am using 206M less space in /boot.

Your output from `ls -lR /boot is almost exactly the same as mine except for the files directly in /boot and /boot/loader/entries.

I wonder if there is something hidden in that directory tree.
Try sudo ls -alR /boot

I tried to send it, but i’m about 70,000 characters over the word limit.

Is there another way to attach it?

try splitting it into 2 parts. Send the first half then the second half