Score:1

Errors encountered while processing linux-firmware, linux-image-raspi, linux-raspi, and initramfs-tools on RasPi Zero W2 Ubuntu 21.10

cg flag

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)
Nmath avatar
ng flag
Can you provide more details about the exact actions you were taking when you "configured WiFi" -- if this is the only thing that you did after a clean installation, then that's probably the cause of your problems
Someone avatar
my flag
Your system has messed up! It is recommended to do a fresh install!
Someone avatar
my flag
can you please post the output of `sudo apt -f install`
Score:1
dk flag

I also had the same issue on a Pi Zero 2 using 64-bit Ubuntu Server 21.10. Unless you have a swapfile enabled, the update process can run out of memory.

Example swapfile creation -

sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile swap swap defaults 0 0" | sudo tee -a /etc/fstab

Reference: https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/

in flag
Spot on.. I've seen this error on a 1GB CM4 as well..
Score:1
my flag

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.

cg flag
This is an OoM issue. [ 1340.883260] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=user.slice,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/session-1.scope,task=zstd,pid=22733,uid=0 [ 1340.883402] Out of memory: Killed process 22733 (zstd) total-vm:499392kB, anon-rss:224628kB, file-rss:988kB, shmem-rss:0kB, UID:0 pgtables:500kB oom_score_adj:0 [ 1340.983190] oom_reaper: reaped process 22733 (zstd), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB
Someone avatar
my flag
@funnsoup How is this a OOM issue?
cg flag
Running the upgrade results in the OOM issue.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.