using apt-get upgrade on Debian left me with the decision to update to kernel 4.9.0-6 but the installation never finishes. It always stalls at the following stage:

Setting up linux-image-4.9.0-6-amd64 (4.9.82-1+deb9u3) ...
update-initramfs: Generating /boot/initrd.img-4.9.0-6-amd64

Nothing happens after that. I do end the processes and start update-initramfs -v -u so see what happens and what not. The update-initramfs stalls at:

Building cpio /boot/initrd.img-4.9.0-6-amd64.new initramfs

Does anyone have an idea what to do? The update from jessie to stretch (some days ago) went without any problems and I do not have modified anything since then.

  • if you do sudo dpkg --purge os-prober, is it able to complete? – Rui F Ribeiro Mar 4 '18 at 8:38
  • 4
    Building the new initramfs file can take minutes. Find the PID of the cpio process under update-initramfs in the output of ps af, and run strace -p <PID> to see if it's chugging along. Also check your kern.log for disk errors. – Ferenc Wágner Mar 4 '18 at 9:29
  • 1
    I have the same problem: Building cpio /boot/initrd.img-4.15.0-1-amd64.new initramfs hangs forever. I can't find any cpio process running on my system :o – bryn Mar 6 '18 at 9:43
  • Use ps fux to identify the process that hangs (the last process spawned during installation). – scai Mar 6 '18 at 17:19

thank you for all your answers. I solved the problem by using ps faux and identified that sync does nothing/waits forever.

As i had an usb drive which somehow died and got disconnected the drive still showed up as being mounted.

I renamed /bin/sync to /bin/sync2, copied /bin/ls to /bin/sync and ran apt-get upgrade. It was successful so I renamed the files, rebooted and finally got rid of the disconnected drive.

  • Thanks, I had this issue on Ubuntu while performing an aptitude upgrade, it hanged on update-initramfs: Generating /boot/initrd.img-4.4.0-133-generic. I used mv /bin/sync /bin/sync2 ; cp -a /bin/ls /bin/sync, killed the /bin/sh /usr/sbin/update-initramfs -u and re-ran aptitude upgrade. – CDuv Aug 24 '18 at 8:00
  • +1 You just saved me fixing a database that runs nightly upgrades. – Luciano Andress Martini Oct 23 '19 at 14:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.