Why is update-grub hanging, and what can I do to fix it?

Every time I boot into Ubuntu 16.04 (I dual-boot with Windows 10), I've run sudo apt-get update followed by sudo apt-get upgrade to keep the Ubuntu side of things up-to-date.

Several times in the past month, the second command hangs with the following output (only the last few lines included):

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-31-generic
Found initrd image: /boot/initrd.img-4.4.0-31-generic
Found linux image: /boot/vmlinuz-4.4.0-28-generic
Found initrd image: /boot/initrd.img-4.4.0-28-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin

Pressing Ctrl+C doesn't seem to have any effect.

Looking around online, it seems this is related to update-grub. I decided to use top to see if anything interesting was happening, or if it was just stuck waiting for something that never seems to come. The only remarkable process was mount.ntfs, which was using 99-100% CPU.

This question is very similar to this one: 14.04 Dpkg Found kernel: /memtest86+.bin issue (freeze during update-grub), and might even be a duplicate. In that question, the user was able to restart and audit/configure things via dpkg. (Is there a way to do this without restarting?) I've tried a similar thing, but my problem persists. I should not have to do that every couple days.

I've tried Ctrl+Z apt-get, but suspending the process doesn't really help. Interestingly, while suspended, mount.ntfs still goes at about 100% CPU. I closed the file backup program in case that may have been what was invoking mount.ntfs, but it still uses about 100% CPU.

Hopefully I've provided enough detail here to make this question specific and sufficiently unique:

What might be going on here, and how might it be fixed?


Solution 1:

To fix the issue of the problem - os-prober - you can:

# vi /etc/default/grub
GRUB_DISABLE_OS_PROBER=true