update-initramfs hangs on debian Stretch

7,507

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.

Share:
7,507
Christian
Author by

Christian

Updated on September 18, 2022

Comments

  • Christian
    Christian over 1 year

    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) ...
    /etc/kernel/postinst.d/initramfs-tools:
    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.

    • Rui F Ribeiro
      Rui F Ribeiro about 6 years
      if you do sudo dpkg --purge os-prober, is it able to complete?
    • Ferenc Wágner
      Ferenc Wágner about 6 years
      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.
    • bryn
      bryn about 6 years
      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
    • hayath786
      hayath786 about 6 years
      Use ps fux to identify the process that hangs (the last process spawned during installation).
  • CDuv
    CDuv over 5 years
    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.
  • Luciano Andress Martini
    Luciano Andress Martini over 4 years
    +1 You just saved me fixing a database that runs nightly upgrades.