Dpkg update failing on 'update-initramfs: Generating /boot/initrd.img-5.15.0-53-generic'

Well, this is interesting. I've never experienced this on a package update. The final steps of an update are usually to update the initramfs, which is the first place the system looks for processes at boot time. So, failure to update/initialize this boot process appears to be a recipe for failure.

So, what can I do? I've tried removing and re-installing initramfs-tools, I've run sudo dpkg --configure -a (which also calls the hook script to update initramfs) checked the space on my /boot partition (I'm using 5.3Mb of a 500Mb partition) and can find no easy resolution.

I'm afraid rebooting will leave me bricked at this point. I'm now searching for answers and asking for help!

Hi, @OldStrummer (Fred) :slight_smile:

That scenario doesn't look good :worried: When you say that a dpkg update is failing on "update-initramfs: Generating /boot/initrd.img-5.15.0-53-generic" do you get any error message? In case you do, what is the error message? Or does it simply "hang" there?

Can you check the "apt" log file "/var/log/apt/term.log" and see if anything that looks relevant / informative appears there?

There's this very recent "Ask Ubuntu" question (posted on 19th November 2022) that may eventually apply to your case, if you see that the situation is actually the same that's happening to you:

In that question, the asker ("John") wrote the following:

"whenever I want to install or uninstall any .deb packages I got this error:

dpkg was interrupted, you must manually run 'sudo dpkg --configure -a'

when I run this command sudo dpkg --configure -a the /etc/default/grub sourcing goes into an unbreakable loop


Processing triggers for linux-image-5.15.0-53-generic (5.15.0-53.59) ...
* dkms: running auto installation service for kernel 5.15.0-53-generic
update-initramfs: Generating /boot/initrd.img-5.15.0-53-generic
Sourcing file `/etc/default/grub`
Sourcing file `/etc/default/grub`
Sourcing file `/etc/default/grub`

Another user ("nobody") replied to that question with the following comment that apparently worked for the asker case:


mkdir $HOME/backup and sudo mv /etc/default/grub $HOME/backup Restore default file with sudo cp /usr/share/grub/default/grub /etc/default/grub and try your dpkg command again.

2 days ago

@OldStrummer: Is that the same case as yours (are you getting an infinite loop of "Sourcing file `/etc/default/grub`" when you run "sudo dpkg --configure -a ")? If you are, can you try the above suggestion by "nobody" of making a backup of the current "/etc/default/grub" file and then overwriting that file with "/usr/share/grub/default/grub" and then try to run again the "sudo dpkg --configure -a" and check the result?

1 Like

Hi Ricardo, thanks for the reply. I experienced none of the above. I found no log files, no error messages, and didn't even find any processes (using variations on ps, like ps faxu) searching for cpio or anything that would indicate a zombie process or some form of deadlock. Zilch. Nada.

I even moved the latest initrd.img out of /boot and tried to create a new one. Several times. No luck.

Then I decided to see if update-initramfs would revert to the previous version so I ran update-initramfs -c -k 5.15.0-52-generic and lo and behold, it completed moments later. Crossing my fingers, I rebooted and found the system came up nominally and everything seems to be running smoothly.

I'm inclined to mark this as solved, but I'm not sure if it's permanent, or whether it will occur again on the next apt update.


Hi, Fred :slight_smile: You're welcome. Thanks for the feedback and congratulations for your solution!

1 Like