2

The kernel on booting initrd, shows the error 'Initramfs unpacking failed: junk in compressed archive', with a message of kernel panic. Is this an issue with cpio, as I'm using Ubuntu 16.04 or some internal error caused by the /init daemon script?

2 Answers2

1

I have met similar problems when I am trying to install 4.19-longterm in ubuntu21.10.

The reason is that 4.x kernels don't support zstd compressing algorithm, but with which cpio compresses initramfs.

To solve it, edit /etc/initramfs-tools/update-initramfs.conf and replace the compressing algorithm to gzip or others supported by your kernel.

run update-grub to refresh the rootfs in /boot/ and reboot.

ppw
  • 11
0

I had a very similar error on 20.04 on a Thinkpad X220. (Core i5, 8GB RAM, dual-booting with Win10; Ubuntu and Win10 are on separate SSDs.)

20.04 worked for a while and then started failing to boot with errors about being unable to unpack the initrd and disk errors on the console.

I found if I went back to an older kernel (via GRUB's Advanced Options menu) it would boot.

It was scary: I thought my SSD was dying, so I bought a new one.

I copied my partitions onto a new disk with Gparted off a live USB and put it in a different machine. I booted off a USB key, checked my partitions for errors with fsck -f, and managed to boot into recovery mode (VERY slowly) and then installed the newer HWE kernel.

This fixed it. It booted fine, without errors except a missing resume device (I used ZRAM and had no swap partition, in order to avoid undue SSD wear).

I have read that newer SSDs are much more robust so I created a swap partition, put a line for it into /etc/fstab. The errors continued. I had to rebuild my initrd which I've never had to do before, but this fixed it.

So, emboldened, I tried to fix the old laptop. I fsck-ed the partitions, I ran trim on them, I installed the HWE kernel, I created a swap partition on the other (Windows) SSD and purged ZRAM and rebuilt my initrd.

The machine is still running just fine and now I have a spare SSD I don't really need, which is a bit annoying. But it only cost me as much as a takeaway meal, so that is not too bad.