When initramfs (the initial ramdisk filesystem used to boot into Ubuntu) is updated, whether it be during an official upgrade or through some manual tinkering, the last thing you want to happen is get an error message. More often than not, when you reboot, you won’t be able to get to your desktop, so it’s best to tackle any issues before you do so.
If you were lucky enough to see the initramfs update fail in the terminal, you can usually have success by running it again. If you updated or upgraded your system and didn’t even know anything went wrong until you failed to log in again, there are still ways to get around this.
You’ll find a few different approaches to various error messages, so hopefully something here will be of use to you. When it comes to specific firmware issues, you may need to start a thread at the Ubuntu forums (quite often, someone will point you towards a patch). Best of luck!
Last Resort for Boot Failure Due to initramfs Error
I’ve listed this first, as in most cases it will work, but it should be your last resort. When booting, choose an earlier kernel from the GRUB list, and you should be able to get to your desktop to fix things. Technically, you really should avoid this, especially if you’ve just upgraded Ubuntu and the kernel along with it, since running certain commands may complicate things, or just waste your time. For example, it’s no use recompiling initrd.img when you’ll be doing so to the one for the previous kernel.
But you can use this method to get to your desktop, search the forums and web for answers, and edit configuration files. And, as an absolute last resort, you can even open Synaptic and remove the latest kernel, then reinstall it (take note of all package names when uninstalling, to make sure you reinstall everything correctly).
Failure Generating /boot/initrd.img
This error is unfortunately common, and the message you’ll see is like:
update-initramfs: failed for /boot/initrd.img-2.6.32-22-generic
Quite often, running the following command will let the update start again:
sudo update-initramfs -u
Continued “dpkg was interrupted” Error
This error occurs when the initramfs update has halted, sometimes because something has interfered, but generally when it gives up trying to get the files from the server:
dpkg was interrupted, you must manually run ‘sudo dpkg
--configure -a’ to correct the problem
While it gives you the answer, you might find yourself in an endless loop of running sudo dpkg
--configure -a over and over again. If it just won’t stop, the last thing you want to do is reboot without having tackled this, so here is a work-around that may help. You’ll be editing a text configuration file as superuser, so paste the following into a terminal:
sudo gedit /etc/initramfs-tools/update-initramfs.conf
Locate the line “update_initramfs=yes” and change it to “update_initramfs=no“. Save and exit the file, then run:
Hopefully, everything should be fine when you reboot, and later you can try changing the “no” back to “yes” in update-initramfs.conf.
initramfs Update Aborted & Recovery Fails
This problem is fairly common, and can generally be remedied easily, even though it produces a long and rather sinister error message that looks like:
Processing triggers for initramfs-tools … update-initramfs: Generating /boot/initrd.img-2.6.32-22-generic dpkg: subprocess post-installation script killed by signal (Interrupt) Could not install the upgrades The upgrade aborts now. Your system could be in an unusable state. A recovery will run now (dpkg
--configure -a). Please report this bug against the ‘update-manager’ package and include the files in /var/log/dist-upgrade/ in the bugreport. E:Sub-process /usr/bin/dpkg returned an error code (2) Setting up initramfs-tools (0.85eubuntu36) … update-initramfs: deferring update (trigger activated) Processing triggers for initramfs-tools … update-initramfs: Generating /boot/initrd.img-2.6.32-22-generic Could not install the upgrades The upgrade aborts now. Your system could be in an unusable state. A recovery will run now (dpkg
--configure -a). Please report this bug against the ‘update-manager’ package and include the files in /var/log/dist-upgrade/ in the bugreport. installArchives() failed
You might find that running sudo dpkg
--configure -a as suggested doesn’t help, but the following command should do the trick:
sudo update-initramfs -u
Delete Corrupted initrd.img Then Run Update Again
Here’s another way you may be able to get around the familiar update-initramfs: failed for /boot/initrd.img… error message. Some have success with the following commands, so you can try them first:
sudo apt-get update
But don’t be surprised to find yourself back where you started, but here is a trick that seems rather unlikely, but has worked before: move or delete initrd.img. If that file is corrupted, you would think it would just get overwritten in the update, yet deleting (or moving, if you want to play it safe) initrd.img has made all the difference in some instances.
It’s probably safer just to move the file, since if a replacement is successfully generated, you can delete it later. To move it to your home folder, enter the following command, remembering to replace the kernel number with the one you’re moving:
sudo mv /boot/initrd.img-2.6.32-22-generic ~/
Or you can open the /boot folder as root, and just drag the file to wherever you want:
gksu nautilus /boot
Now try those first two commands, and hopefully all goes well.
Hopefully a trick or two here saved your day; if not, godspeed in sorting it out!