Initramfs failure during update. Now have to reflash

So I ssh’ed into my L5 and did

  • sudo apt update
  • sudo apt upgrade

One of the changes was a new kernel. The initramfs initialization step failed at the end. Last time I had this I tried to fix it and bricked the phone and had to reflash. This time, I rebooted and it won’t start. I got past the step where I entered the encryption passphrase for the hard disk but after that nothing. So it looks like I have to reflash again.

Any idea how I can avoid this in the future? Also, BTW, I was continually getting a warning about not enough space (180MB) on root partition. So can I adjust the partition sizes in the flash installation script since I have to reflash anyway?

Hopefully I won’t have to reflash every time there is a new kernel.


I don’t think you can adjust the partition size during installation (it’s burned into the image), but you could resize it using Jumpdrive.

As for the future, we’re working on reducing the initramfs size, so that things won’t run out of space.

Reflashing is not strictly necessary, it’s just simplest. One of the uuu scripts in the flasher repository will boot your L5 with a selected kernel. You need to know what kernel version you had and then edit the script, but I managed to recover my L5 like this at least twice. Sadly, I don’t remember which script it was.


When I updated (Pure Store) some days ago, it was only Millipixels (or Lollypop?).
It failed, saying no space on /boot. I scratched my head why boot would even be touched.
But I solved it with “apt autoremove” which removed the 5.13 kernel, leaving 5.15 and 5.16.
I assume it’s on purpose that a backup kernel stays installed, but the autoremove should be automatic when using the UI for updates.

I now have 105MB available. Wondering whether I should remove one more kernel before the next update.

We are working to make the next kernel updates to take less space in the boot partition.
I assume that you are using full disk encryption. The package osk-sdl the virtual keyboard that allows to type the LUKS passphrase takes some space in the /boot partition. We are working to reduce it.


On Ubuntu

  • it automatically keeps one previous kernel (seems a good idea to me) and any older kernels are candidates for ‘autoremove’
  • nothing is ever automatically removed - the update UI asks whether you would like ‘autoremove’ to occur (when there is something to remove, which there typically will be after a new kernel is installed)
1 Like

I’ve had the same problem and the /boot partition went full, see No space left on device while update-initramfs
I had to remove the 5.13 kernel (see there) and now I only have the 5.16 one:

purism@pureos:~$ ls -l /boot
total 251153
-rw-r--r-- 1 root root     2328 Jan 23 07:12 boot.scr
-rw-r--r-- 1 root root     2328 Jan 23 02:18 boot.scr.bak
-rw-r--r-- 1 root root   187855 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     1024 Jan 23 02:17 dtbs
drwxr-xr-x 2 root root     1024 Jul 13  2021 grub
-rw-r--r-- 1 root root 64325755 Jan 23 07:12 initrd.img
-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  4941866 Jan 17 11:33
-rw-r--r-- 1 root root 24610824 Jan 23 07:12 vmlinuz
-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
purism@pureos:~$ df -kh /boot
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p1  451M  248M  180M  59% /boot

Still, Purism aims to make devices that can be used by non-techies. Even for advanced users, having to open a terminal on a phone just to clean up boot is not ideal. I’m okay with being asked “To make space for this system update, old unused packages need to be removed [packages: kernel 5.13]”.
Something like that :slight_smile:


On Ubuntu that behaviour applies to both UIs i.e. terminal when you do apt upgrade or GUI - either way it tells you when apt autoremove would remove something and prompts you in some way about it.

(In the case of the GUI, the update itself by default includes updating anything that needs updating and removing anything that autoremove would remove, but you can uncheck whatever you want in either the update section or the remove section.)

For non-techies it would probably be best to click OK without unchecking anything i.e. one click automation and leave it to the operating system.

1 Like

Thanks for posting this. I was unable to update.

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:
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk0p1  451M  398M   30M  94% /boot

After autoclean/autoremove, got my space back and the update-initramfs process automatically kicked off, and this time, completed successfully.

/dev/mmcblk0p1  451M  323M  105M  76% /boot

I had tried the UI (PureOS Store) and it did not accomplish what the autoremove did.