Errors encountered while processing linux-firmware, linux-image-raspi, linux-raspi, and initramfs-tools on RasPi Zero W2 Ubuntu 21.10
I installed and configured WiFi on a Raspberry Pi Zero W 2 running Ubuntu 21.10 Server. I ran apt update
and then apt upgrade
with the below output. It's a brand new board and a fresh installation so I'm not sure at all what might be going on.
sudo apt upgrade
:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up initramfs-tools (0.140ubuntu6) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-firmware (1.201.1) ...
update-initramfs: Generating /boot/initrd.img-5.13.0-1008-raspi
Killed
E: mkinitramfs failure zstd -q -19 -T0 137
update-initramfs: failed for /boot/initrd.img-5.13.0-1008-raspi with 1.
dpkg: error processing package linux-firmware (--configure):installed linux-firmware package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-raspi:
linux-image-raspi depends on linux-firmware; however:
Package linux-firmware is not configured yet.
dpkg: error processing package linux-image-raspi (--configure):
dependency problems - leaving unconfigured
Setting up linux-image-5.13.0-1011-raspi (5.13.0-1011.13) ...
No apport report written because the error message indicates its a followup error from a previous failure.
dpkg: dependency problems prevent configuration of linux-raspi:
linux-raspi depends on linux-image-raspi (= 5.13.0.1011.17); however:
Package linux-image-raspi is not configured yet.
dpkg: error processing package linux-raspi (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Processing triggers for initramfs-tools (0.140ubuntu6) ...
update-initramfs: Generating /boot/initrd.img-5.13.0-1008-raspi
Killed
E: mkinitramfs failure zstd -q -19 -T0 137
update-initramfs: failed for /boot/initrd.img-5.13.0-1008-raspi with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Processing triggers for linux-image-5.13.0-1011-raspi (5.13.0-1011.13) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.13.0-1011-raspi
Killed
E: mkinitramfs failure zstd -q -19 -T0 137
update-initramfs: failed for /boot/initrd.img-5.13.0-1011-raspi with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.13.0-1011-raspi (--configure):
installed linux-image-5.13.0-1011-raspi package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-firmware
linux-image-raspi
linux-raspi
initramfs-tools
linux-image-5.13.0-1011-raspi
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
Your system has messed up, I doubt that it is a fresh install as this problem should not be there on a fresh install, anyways, I would recommend reinstalling as the first choice but if you cannot then here is an answer which may help you to get out of these errors.
Note
- I am putting "*" after every solution that will most probably work.
Short answer *
Simple remove and reinstall packages:-
You can remove the packages by:-
$ sudo dpkg --remove --force-remove-reinstreq linux-firmware
$ sudo dpkg --remove --force-remove-reinstreq linux-image-raspi
$ sudo dpkg --remove --force-remove-reinstreq linux-raspi
$ sudo dpkg --remove --force-remove-reinstreq initramfs-tools
$ sudo dpkg --remove --force-remove-reinstreq linux-image-5.13.0-1011-raspi
$ sudo apt-get -f install
Then reinstall them
sudo apt-get install linux-firmware linux-image-raspi linux-raspi initramfs-tools linux-image-5.13.0-1011-raspi
Advanced solutions:-
Using force install. *
Generally, using apt -f install
works!
Run:
sudo apt -f install
If the error is fixed then congratulations but if not then proceed.
Going a little advance *
You may want to clear the cache files of apt
to fix this issue. Generally, it wouldn't harm your OS in any way.
You can run
sudo rm -rf /var/cache/apt/archives/*.deb
More likely, it will fix the error! If not then proceed.
Another solution.
You can try this also -
sudo -E apt-get install aptitude
sudo -E aptitude safe-upgrade
sudo -E aptitude dist-upgrade
After that
mkdir ~/debs
cd ~/debs
ls
sudo apt download linux-firmware linux-image-raspi linux-raspi initramfs-tools linux-image-5.13.0-1011-raspi
sudo dpkg -i --force-all ./*.deb
Removing and reinstalling the packages.
You can remove the packages by:-
$ sudo dpkg --remove --force-remove-reinstreq linux-firmware
$ sudo dpkg --remove --force-remove-reinstreq linux-image-raspi
$ sudo dpkg --remove --force-remove-reinstreq linux-raspi
$ sudo dpkg --remove --force-remove-reinstreq initramfs-tools
$ sudo dpkg --remove --force-remove-reinstreq linux-image-5.13.0-1011-raspi
$ sudo apt-get -f install
Then reinstall them
sudo apt-get install linux-firmware linux-image-raspi linux-raspi initramfs-tools linux-image-5.13.0-1011-raspi
Last option *
As a last option, you could try removing the post-installation files of the error packages. This won't solve the error, but your system will ignore the errors.
cd /var/lib/dpkg/info/
mkdir ~/backup
mv linux-firmware ~/backup
mv linux-image-raspi ~/backup
mv linux-raspi ~/backup
mv initramfs-tools ~/backup
mv linux-image-5.13.0-1011-raspi ~/backup
sudo apt -f install
Did it work?
If it didn't work then there is no luck. If these commands didn't work then your system is more messed up than it was before. As you said, it is a fresh install so just reinstall ubuntu.