Comment 12 for bug 1667512

Revision history for this message
Michael Neuffer (neuffer) wrote : Re: update-initramfs hangs on upgrade, dpkg unusable, unbootable system

This problem also still exists with much newer kernels, for me with 4.15.0-12 on Ubuntu 18.04 (alpha)

------------------------------------
 diff -uN /var/lib/dpkg/info/initramfs-tools.postinst~ /var/lib/dpkg/info/initramfs-tools.postinst
--- /var/lib/dpkg/info/initramfs-tools.postinst~ 2018-02-20 22:34:46.000000000 +0100
+++ /var/lib/dpkg/info/initramfs-tools.postinst 2018-03-22 13:08:09.989213260 +0100
@@ -38,10 +38,10 @@
 # Regenerate initramfs whenever we go to dpkg state `installed'
 if [ "x$1" != xtriggered ]; then
  # this activates the trigger, if triggers are working
- update-initramfs -u
+ update-initramfs -u -v
 else
  # force it to actually happen
- DPKG_MAINTSCRIPT_PACKAGE='' update-initramfs -u
+ DPKG_MAINTSCRIPT_PACKAGE='' update-initramfs -u -v
 fi

 # Automatically added by dh_installdeb/11.1.4ubuntu1
-----------------------------------------
diff -uN /usr/sbin/update-initramfs~ /usr/sbin/update-initramfs
--- /usr/sbin/update-initramfs~ 2018-01-05 13:15:45.000000000 +0100
+++ /usr/sbin/update-initramfs 2018-03-22 13:11:34.440124524 +0100
@@ -158,7 +158,9 @@
   mv -f "${initramfs}.new" "${initramfs}"
   set_sha1
   # Guard against an unclean shutdown
- sync
+ # The sync never returns and seems to deadlock for some reason
+ # so comment it out for the time beeing
+ #sync
  else
   mkinitramfs_return="$?"
   remove_initramfs_bak
---------------------------------------------------------------
Also take sync out of commission in order to allow for a clean shutdown (important: re-enable after the reboot!). Also give the system enough time to sync all its buffers on its own before restarting.

cd /bin
mv sync sync.real
cp ls sync

This helped me before and now I have the deadlocked sync issue again.
root@charion:~# ps auxwww | grep sync
systemd+ 1949 0.0 0.0 146076 3364 ? Ssl 11:56 0:00 /lib/systemd/systemd-timesyncd
root 19420 0.0 0.0 7796 780 pts/7 D+ 12:03 0:00 sync
root 22919 0.0 0.0 14756 1120 pts/2 S+ 13:20 0:00 grep --color=auto sync

So I'll try to restart and try to run the
update-initramfs -u -v manually with these changes and then try to finish the apt-get upgrade