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:
sudo dpkg --
configure -a
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 dpkg --
configure -a
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!
°ºÒθÓº°
☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻
Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!
In my case I was removing a kernel in order to do an upgrade (XBMC Live). Something messed up along the line and removed the init img in /boot but initramfs-tools still thought there was a kernel. I had to do what I found in this comment:
https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/523903/comments/3
In my case:
$ sudo rm /var/lib/initramfs-tools/2.6.31.12-xbmclive
Followed by a quick:
$ sudo update-initramfs -u
to make sure it worked.
Hi I ran the comand sudo update-initramfs -u But it gave me
ubuntu@ubuntu:~$ sudo update-initramfs -u
update-initramfs is disabled since running on read-only media
ubuntu@ubuntu:~$
what to do now
Hi. Without more info, I can’t offer a solution, since there are a few possible causes, but I assume you Googled the error message? Plenty of info out there if not: http://www.google.com.au/search?hl=en&q=update-initramfs+is+disabled+since+running+on+read-only+media. This can occur on hard drives, or systems running off a USB device. If you find the answer relevant to your situation, please feel free to come back and share it with us! All the best.
PS: the short of it is the drive or device is locked, which is why it’s coming up as read-only. You will need to look into that, because this isn’t common. But checking Google results for that error message should eventually get you the answers.
I’m having a similar problem, where update-initramfs hangs when trying to install a new kernel. I started a thread about it here http://ubuntuforums.org/showthread.php?p=10381602#post10381602 , but no luck so far. I tried everything in your thread, but the problem persists. Any ideas for my particular variation?
Did you look at the comment by Alecks? He was removing a kernel, so possibly there are similarities? Tried booting in with a previous kernel? That worked for me when I had kernel issues, and successfully got to the desktop and removed the offending kernel and related packages via Synaptic. If that works, you can always try and reinstall it via Synaptic (me, I didn’t chance it, and just waited for the next kernel to come out).
I tried what Alecks suggested, but it didn’t work for me. update-initramfs froze updating my current kernel 2.6.35-24. This makes me think that waiting for the next kernel to come out isn’t going to help my situation.
I haven’t rebooted, so I’m still in Gnome running the 2.6.35.24 kernel.
Tried this yet?: sudo apt-get clean or sudo apt-get autoclean or sudo apt-get autoremove
The of course there’s: sudo apt-get upgrade
If that didn’t work, you can always try: sudo apt-get dist-upgrade
The latter upgrades all packages on system, handling dependency changes (it removes obsolete packages). This command prepares the system for upgrade, but since /etc/sources.list has not changed to the sources for the newer distribution it will not actually upgrade to the newest version. apt-get upgrade is safer, as it won’t remove packages if there’s a conflict (ie: use with caution, and as a
last resort
, as it could render the system unstable).
One apparent fix was uncommenting line 23 in /etc/default/grub (#GRUB_GFXMODE=640×480), but not sure if that will help in your case (as I assume you can boot in, just not install that kernel).
Next?
All tried, none worked. Both “sudo apt-get dist-upgrade” and “sudo apt-get upgrade” result in:
E: dpkg was interrupted, you must manually run ‘sudo dpkg –configure -a’ to correct the problem.
and “sudo dpkg –configure -a” results in:
update-initramfs: Generating /boot/initrd.img-2.6.35-25-generic
…The update-initramfs hang. I appreciate you still helping though.
Upgraded my RAM from 8GB to 16GB, and took out a GTS250 and put in an ATI5450.
Tried to install FGLRX via Hardware Drivers, did everything right, until it got stuck at:
update-initramfs: Generating /boot/initrd.img-2.6.32-24-generic
I turned off initramfs update in config file and dpkg –configure -a successfully.
So the first thing after that, is I asked for a reinstall of initramfs-tools in Synaptic,
and now, yet again, it is stuck at
Unpacking replacement initramfs-tools ..
Processing triggers for man-db ..
Setting up initramfs-tools (0.92bubuntu78) ..
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools ..
update-initramfs: Generating /boot/initrd.img-2.6.32-24-generic
Please, any insight?
You can try this, if it’s a “firmware” issue:
gksu gedit /usr/share/initramfs-tools/hooks/udev
Look for the line:
copy_exec /lib/udev/firmware.sh /lib/udev
… and get rid of the .sh, so that middle part just says firmware. See if that helps. And in case you can’t boot, replace gksu gedit in the first command with sudo nano when booting to a command prompt.
Let me know how you go.
[…] It is possible that you don't have all the drivers/modules needed compiled into your kernel to access hard drives and file systems on the system you are trying to boot. That usually causes booting problems with a newly compiled kernel booting. Without knowing anything about the hardware you have and your menuconfig options, I can't help you there. This may help if it is just a initramfs problem. https://ubuntugenius.wordpress.com/20…re-you-reboot/ […]
I have both Windows 7 and Ubuntu 10.04 installed on my laptop with a memory allocation of 220 GB and 100 GB respectively. Suddenly my system is not able to log on into Ubuntu and am getting an error like this:
[mount: mounting /dev /root/dev failed: no such file or directory]
[mount: mounting /dev /root/sys failed: no such file or directory]
[mount: mounting /dev /root/proc failed: no such file or directory]
[Target filesystem doesn’t have /sbin/init.]
[No init found. Try passing init= bootarg]
[BusyBox v1.13.3 (Ubuntu 1:1.13.3-1ubuntu11) built-in shell (ash)]
[Enter ‘Help’ for a list of built-in commands.]
(initramfs)
What do I do? Please help
Hi. OK, the answers can vary greatly depending on your exact situation. But try this:
1. Boot from the Ubuntu Live CD
2. Open a Terminal
3. Type sudo fdisk -l (to get the device name) then press ENTER
Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: **********
Device Boot Start End Blocks Id System
/dev/sda1 * 1 30238 242886703+ 83 Linux
/dev/sda2 30239 30401 1309297+ 5 Extended
/dev/sda5 30239 30401 1309266 82 Linux swap / Solaris
The device name in the above example is /dev/sda1
4. Type sudo fsck /dev/sda1 (replace “sda1” if need be with correct partition name; if sharing a drive with Windows, “sda1” would likely be NTFS, and Ubuntu’s partition would be something like /dev/sda3) then press ENTER
5. Restart the system and boot normally.
Hopefully that helps as it has for others. Cheers.
what if i don’t have a live CD or live USB of Ubuntu is there’s any other way to fix the INITRAMFS?? any suggestions?
Well, you can try booting into Recovery Mode and running commands from there. But it’s not hard to get a Live DVD, even if you have to do it from someone else’s computer. Just download the ISO and burn it to a blank DVD, then you can boot into a live session and away you go.
thanks a lot mr ubuntu genius
i tried to update my ubuntu 11.10 but it showed error msg ‘broken count >0’ and then i chosed repaire option but agait it showed msg cannot instal or delete…. then i rebooted my pc and instead of ubuntu a screen came up with BusyBox v1.
17.3 (#something ubuntu written in here) built-in shell (ash)]
initramfs:
and every time i boot this is the ultimate screen i lead to … how to fix this issue…
also in grub sudo command is not recognized
Sorry to hear about your problem. OK, sudo is for the Linux command-line, not GRUB, so that won’t work (no Linux commands at the GRUB prompt will). When you get to the GRUB menu, try booting an earlier kernel; unless you’ve cleared some old ones away manually, you should have older kernels under the default one you boot. I’m assuming you can get to the GRUB menu from your comment – if not, hold down your Shift key while booting. If you can’t get to the desktop, try the recovery option which takes you to a (Linux) command prompt. All I can suggest past that is to Google terms like “BusyBox v1 cant boot ubuntu”; if you don’t find your answer in the first dozen or so pages of search results, try again with as much specific info as possible (I suggest writing down EXACTLY what the error message says). Best of luck!
I am having trouble with this and while, I’ve worked through the different solutions none mention “casper”.
I believe there’s something circular going on. Here’s my problem in a nut shell. After running:
* sudo dpkg –configure -a
The result is a problem with casper:
“casper depends on initramfs-tools (>= 0.92bubuntu55); however:
Package initramfs-tools is not configured yet.
But, but, but … when I run the
* update-initramfs -u
I get a bunch of messages complaining about the state of the casper-functions script:
update-initfrmfs: Generating /boot/initrd.img-2.6.32-41-generic-pae
.: 13: can’t open /scripts/casper-functions
.: 6: can’t open /scripts/casper-functions
So as I see it these two ‘bits’ depend on each other in a circular fashion.
Is there a way out of this deadlock?
Thanks, Will.
OK, this will probably fix it, but involves removing stuff and getting updates; at the command-line:
rm /etc/initramfs-tools/modules && sudo apt-get update && sudo apt-get upgrade
I’m guessing you’re at the stage where anything goes, so give it a shot and report back. All the best!
http://www.ubuntuupdates.org/package/core/quantal/main/base/initramfs-tools-bin
I am using win xp and ubuntu 10.4 i have recieved initramfs error after that i have followed that first i have booted from cd open terminal then mounted the file system of the system then i run the command grub-install –root-directory=/mnt /dev/sda after that i have rebooted.then its gives error of grub please give me guide to solve the problem
OK, I’d need to know the specific GRUB error, but you can find many GRUB guides out there, including official ones. Your best bet is to write down word for word the error message, then Google that. Whatever the error is (and there’s many of them) you wouldn’t be the first to encounter it, so the answer is likely on the web already, either as a guide someone put up, or as an answer in a forum.
easy solution to this problem
http://about-linux-system.blogspot.in/2011/10/initramfs-error.html
[…] nemu deh postingan yang berhubungan dengan problem tersebut di weblognya OzzyFrank yang ini: ubuntugenius.com/fix-a-failed-initramfs-update-do-it-before-you-reboot. Langsung deh saya praktekkan jurus-jurus yang ada disana via Terminal (Command-Line) untuk […]
I had the error “update-initramfs: failed for /boot/initrd.img-#.#.#-#-generic” after updating to 14.04. I tried the suggestions above and none of them quite did the trick. It turned out that I had a space issue which was ultimately resolved by:
1. Verifying the current kernel with:
2. Checking installed kernels with:
3. Removing old kernels, except for the current one identified in 1, above, and the previous one (just in case!) with: where the # represent the old kernel(s) identified in 2, above
4. Followed up with a grub update:
After step 3 above, the first ‘old’ kernel I removed did not clear up enough space but the second ‘old’ kernel was removed and the initramfs update completed automatically as soon as the space was available.
my simple first for this was
fsck /dev/sda2 (hit enter) then yes to everything until it boots normally. thats it !
Repairs are great and have worked everytime, which is several times a day.
So why does 16.04 crash several times a day?
And is anything to be fixed?
Given the volume of help questions, this is a well known issue.
Mostly when using youtube for music.
And opera.
But not with chrome. Chrome works, so far.
I have damaged something after an nvidia driver update. After the reboot, it no longer brings up the display. The display remains black when I reboot (nothing showsup). I can still ssh to the machine and execute commands through terminal (no graphic interfacec). So it seems I have damaged something related to the graphics in the boot file. This is what I get when I try “sudo update-initramfs -u“:
update-initramfs: Generating /boot/initrd.img-4.13.0-32-generic
/usr/bin/objcopy:/boot/efi/EFI/ubuntu/shimx64.efi: No such file or directory
/usr/bin/objcopy: –change-section-vma .initrd=0x0000000003000000 never used
/usr/bin/objcopy: –change-section-vma .linux=0x0000000000040000 never used
/usr/bin/objcopy: –change-section-vma .cmdline=0x0000000000030000 never used
/usr/bin/objcopy: –change-section-vma .osrel=0x0000000000020000 never used
update-initramfs: Failed to generate Linuxium bootscript.
Is there a way to fix this?
For a rather old post this is still pretty much useful in 2020! This is cross-related, but this info just saved my day on Raspbian / Raspberry Pi 4 when a regular software update seemingly didn’t finish correctly leaving inconsistent kernel library metadata.