No space left on device while update-initramfs

I did:

$ sudo apt upgrade

update-initramfs: Generating /boot/initrd.img-5.16.0-1-librem5
setupcon: The keyboard model is unknown, assuming 'pc105'. Keyboard may be configured incorrectly.
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"
WARNING: Unknown X keysym "dead_belowmacron"

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-5.16.0-1-librem5 with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

What should I do now? Have not rebooted yet…

As good as i know, update-initramfs is transactional, meaning you should not be too concerned about a reboot. The point is, that your disc is full and you need to clean up.

Perhaps your upgrade process should have looked like this:
sudo apt update
sudo apt list --upgradable -a
sudo apt list linux-image-librem5
sudo apt-get install linux-image-librem5 --assume-no
sudo apt-get install linux-image-librem5 --yes
sudo reboot
uname -r
sudo apt update
sudo apt upgrade

But as of now you should try some other type of workaround to resolve your current issue, please try if this method (or similar one) might help, revert to your current Linux Kernel, curently used one, not the rebooted one:
uname -r −− please take a look if 5.15.X-1-librem5 still over there (within /boot).
sudo apt list linux-image-librem5
sudo dpkg --list | grep linux-image-librem5
sudo dpkg --configure -a
sudo update-initramfs -c -k 5.15.X-1-librem5
sudo update-initramfs -u

Trying of: sudo update-initramfs -u might help right away but it might be somehow risky move as well, just not sure, don’t know.

NOTE: Didn’t test above but still considering your thread here as very important one. Actually, someone else, that still uses old 5.15.9pureos1 image, should take over from here (test my first chapter, within this post, proposed commands).

RELATED:

I looked into the /boot partition:

df /boot
Filesystem     1K-blocks   Used Available Use% Mounted on
/dev/mmcblk0p1    461087 406677     30602  94% /boot

ls -lh /boot
total 395M
-rw-r--r-- 1 root root 2.3K Jan 23 02:18 boot.scr
-rw-r--r-- 1 root root 2.3K Jan  9 08:14 boot.scr.bak
-rw-r--r-- 1 root root 182K Nov 29 09:31 config-5.13.0-1-librem5
-rw-r--r-- 1 root root 182K Dec 20 17:34 config-5.15.0-1-librem5
-rw-r--r-- 1 root root 184K Jan 17 11:33 config-5.16.0-1-librem5
lrwxrwxrwx 1 root root   53 Jan 23 02:17 dtb -> dtbs/5.16.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
lrwxrwxrwx 1 root root   53 Dec 10 07:55 dtb-5.13.0-1-librem5 -> dtbs/5.13.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
lrwxrwxrwx 1 root root   53 Jan  9 08:14 dtb-5.15.0-1-librem5 -> dtbs/5.15.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
lrwxrwxrwx 1 root root   53 Jan 23 02:17 dtb-5.16.0-1-librem5 -> dtbs/5.16.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
drwxr-xr-x 5 root root 1.0K Jan 23 02:17 dtbs
drwxr-xr-x 2 root root 1.0K Jul 13  2021 grub
-rw-r--r-- 1 root root  62M Jan 23 02:18 initrd.img
-rw-r--r-- 1 root root  62M Dec 10 07:55 initrd.img-5.13.0-1-librem5
-rw-r--r-- 1 root root  62M Jan  9 08:14 initrd.img-5.15.0-1-librem5
-rw-r--r-- 1 root root  62M Jan 23 02:17 initrd.img-5.16.0-1-librem5
-rw-r--r-- 1 root root  62M Jan  9 08:14 initrd.img.bak
drwx------ 2 root root  12K Sep 11 07:31 lost+found
-rw-r--r-- 1 root root 4.7M Nov 29 09:31 System.map-5.13.0-1-librem5
-rw-r--r-- 1 root root 4.7M Dec 20 17:34 System.map-5.15.0-1-librem5
-rw-r--r-- 1 root root 4.8M Jan 17 11:33 System.map-5.16.0-1-librem5
-rw-r--r-- 1 root root  24M Jan 23 02:18 vmlinuz
-rw-r--r-- 1 root root 8.3M Nov 29 09:31 vmlinuz-5.13.0-1-librem5
-rw-r--r-- 1 root root 8.4M Dec 20 17:34 vmlinuz-5.15.0-1-librem5
-rw-r--r-- 1 root root 8.5M Jan 17 11:33 vmlinuz-5.16.0-1-librem5
-rw-r--r-- 1 root root  24M Jan  9 08:14 vmlinuz.bak

and decided to move the oldest file away:

sudo mv /boot/initrd.img-5.13.0-1-librem5 /home/purism

after this the sudo apt upgrade went fine and the device booted fine.

Why are the old initrd.img.... are keept? Which process should do the housekeeping there? The /boot partition remains 76% full and the problem could re-occure with next kernel update.

1 Like

Well done! Now (as you rebooted your Librem 5), you might/should check (again):
sudo dpkg --list | grep linux-image-librem5

And if still some additional/older Linux Kernel there (no need to have more than the current one), please:
sudo apt-get --purge remove X_5.15.9pureos1

It says:

sudo dpkg --list | grep linux-image-librem5
ii  linux-image-librem5  5.16.1pureos1 arm64  Linux kernel for the Librem 5 and its devkit
1 Like

This looks as very best output to me. Meaning as well that the old two ones are gone now. Please repeat your previous command: df /boot in order to confirm that you have enough space within /boot partition for the next Linux Kernel upgrade. Thanks for this feedback!

For me it seems that there are still two kernels:

-rw-r--r-- 1 root root 64325755 Jan 23 07:12 initrd.img
-rw-r--r-- 1 root root 64317791 Jan  9 08:14 initrd.img-5.15.0-1-librem5
-rw-r--r-- 1 root root 64325755 Jan 23 07:12 initrd.img-5.16.0-1-librem5
-rw-r--r-- 1 root root 64325426 Jan 23 02:18 initrd.img.bak
drwx------ 2 root root    12288 Sep 11 07:31 lost+found
-rw-r--r-- 1 root root  4900200 Dec 20 17:34 System.map-5.15.0-1-librem5
-rw-r--r-- 1 root root  4941866 Jan 17 11:33 System.map-5.16.0-1-librem5
-rw-r--r-- 1 root root 24610824 Jan 23 07:12 vmlinuz
-rw-r--r-- 1 root root  8762699 Dec 20 17:34 vmlinuz-5.15.0-1-librem5
-rw-r--r-- 1 root root  8815340 Jan 17 11:33 vmlinuz-5.16.0-1-librem5
-rw-r--r-- 1 root root 24610824 Jan 23 02:18 vmlinuz.bak

and the space is not much there:

df -kh /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p1  451M  323M  105M  76% /boot

Here is what my Ubuntu phone has:

phablet@ubuntu-phablet:~$ df -kh /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p6  2.0G  1.6G  389M  81% /

Yes, as a workaround to this you can remove the oldest kernel and then, try to update again or if the update was interrupted do a:

sudo dpkg --configure -a

1 Like

@guru you are using the landing repos?

1 Like

How should I remove the oldest kernel exactly?

What are the landing repos?

sudo dpkg --list | egrep -i --color 'linux-image'

will lead you into executing of following:
sudo apt-get --purge remove linux-image-5.15.0-1-librem5

Now you’ll get enough space within your Librem 5 /boot partition to put back following file:

Please repeat as above:
sudo dpkg --list | egrep -i --color 'linux-image'
sudo apt-get --purge remove linux-image-5.13.0-1-librem5

Just my proposal, hope this works, this time (for now).

I did:

sudo dpkg --list | egrep -i --color 'linux-image'
sudo apt-get --purge remove linux-image-5.15.0-1-librem5
  
sudo mv initrd.img-5.13.0-1-librem5 /boot
sudo dpkg --list | egrep -i --color 'linux-image'
sudo apt-get --purge remove linux-image-5.13.0-1-librem5

ls -lh /boot
total 307M
-rw-r--r-- 1 root root 2.3K Jan 23 07:12 boot.scr
-rw-r--r-- 1 root root 2.3K Jan 23 02:18 boot.scr.bak
-rw-r--r-- 1 root root 184K Jan 17 11:33 config-5.16.0-1-librem5
lrwxrwxrwx 1 root root   53 Jan 23 07:12 dtb -> dtbs/5.16.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
lrwxrwxrwx 1 root root   53 Jan 23 07:12 dtb-5.16.0-1-librem5 -> dtbs/5.16.0-1-librem5/freescale/imx8mq-librem5-r4.dtb
drwxr-xr-x 5 root root 1.0K Jan 23 02:17 dtbs
drwxr-xr-x 2 root root 1.0K Jul 13  2021 grub
-rw-r--r-- 1 root root  62M Jan 23 07:12 initrd.img
-rw-r--r-- 1 root root  62M Dec 10 07:55 initrd.img-5.13.0-1-librem5
-rw-r--r-- 1 root root  62M Jan 23 07:12 initrd.img-5.16.0-1-librem5
-rw-r--r-- 1 root root  62M Jan 23 02:18 initrd.img.bak
drwx------ 2 root root  12K Sep 11 07:31 lost+found
-rw-r--r-- 1 root root 4.8M Jan 17 11:33 System.map-5.16.0-1-librem5
-rw-r--r-- 1 root root  24M Jan 23 07:12 vmlinuz
-rw-r--r-- 1 root root 8.5M Jan 17 11:33 vmlinuz-5.16.0-1-librem5
-rw-r--r-- 1 root root  24M Jan 23 02:18 vmlinuz.bak

The /boot remains 76% full and the file initrd.img-5.13.0-1-librem5 which I moved to /boot again, was not purged. I think, I will just move it away again.

1 Like

I agree. I forgot to recommend to you sudo reboot, if this makes some adjustment for more space there. Anyway, before restarting your system please:
sudo dpkg --configure -a
sudo update-initramfs -u

EDIT: Because your initrd.img files looked indeed big to me, I just found this one:
sudo update-initramfs -u -k all