Safely removing USB 3.0 drive freezes the system - why and how to fix?

I'm running Ubuntu 16.04.5 LTS amd64 with 4.4.0-140-generic Linux kernel.

After one of recent upgrades I got new unexpected behavior - when I

  • select Safely remove drive in Caja
  • click Power off the disk button in GNOME Disks

for my USB 3.0 external drive - the Ubuntu system freezes without any error messages. I can loose unsaved documents and other personal data.

Why this happens? How should I fix this problem?


Solution 1:

This is known problem with latest 4.4.0-139-generic, 4.4.0-140-generic and 4.4.0-141-generic Linux kernels.
On launchpad it is known as bug 1803929 (currently confirmed by 17 users).

The temporary solution is to use 138 ( 4.4.0-138-generic ) kernel.

So I have deleted 139, 140 and 141 kernels by:

sudo apt-get purge linux-image-4.4.0-139-generic linux-headers-4.4.0-139-generic \
linux-image-4.4.0-140-generic linux-headers-4.4.0-140-generic \
linux-image-4.4.0-141-generic linux-headers-4.4.0-141-generic
sudo apt-get install amd64-microcode intel-microcode thermald
sudo apt-get autoremove

and wait for 142+ kernel with the fix.

Warning: do not upgrade kernel to 4.4.0-139-generic, 4.4.0-140-generic or 4.4.0-141-generic if you need to keep your data safe on USB 3.0 external disks. Subscribe to the bug 1803929 and after the confirmation of the fix - install newest kernel back with sudo apt-get install linux-image-generic linux-headers-generic .

Solution 2:

As for me, I went ahead and upgraded my Linux kernel to 4.13.16 for my Ubuntu 16.04 OS. This fixed the problem since my kernel was over 2 years old and about due for an upgrade.

My Configuration: Ubuntu 16.04 - amd64 architecture

Please revise accordingly with regards to your choice of kernel.

Steps:

  • Execute $dpkg --print-architecture to view the processor's architecture.
  • Go to the 4.13.16 kernel here: kernel.ubuntu.com
  • Download the linux-headers-4.13.16-041316_4.13.16-041316.201711240901_all.deb located under your processor's architecture.
  • Download the linux-headers-4.13.16-041316-generic_4.13.16-041316.201711240901_XXX.deb located under your processor's architecture, where XXX stands for your processor's architecture.
  • Download the linux-image-4.13.16-041316-generic_4.13.16-041316.201711240901_XXX.deb located under your processor's architecture, where XXX stands for your processor's architecture.
  • [Optional] Move the .deb files into a folder.
  • Open a terminal, change directory to where the downloaded packages are stored, and execute $sudo dpkg -i *.deb to install the packages (Note: this will attempt to install any and all .deb packages in the folder. It is easier to move the downloaded packages into a separate folder to avoid this situation).
  • Reboot.
  • Execute $uname -r in a terminal to verify the kernel change.

References:

  • AskUbuntu: How to update kernel...
  • TecMint: How to install latest kernel...