Linux – Bash hangs in Linux subsystem in Windows 10

windows 10windows-subsystem-for-linux

In Windows 10, I am using Linux subsystem. I first open a cmd terminal with administrator, and then start bash in the cmd terminal, and then use the bash shell.

Sometimes my bash hangs upon running in a terminal.

For example, when a file is opened by some software in Windows, I try to rename the parent directory of the file by mv fileParentDir fileParentDirnew in bash, and then bash will hang.
If I force to close the bash terminal, and then reopen a new cmd terminal to start bash again, the command bash will hang too. The problem can be solved by restarting Windows.

is there a solution to the hang problem, not by restarting Windows?

I googled and some said that multiple partition files might be the reason. But I am only using one single partition and partition file.

Thanks.

Best Answer

NOTICE: The fix for this bug has now been released publicly. If you still have the issue, make sure Windows 10 is up-to-date.


This is a known issue, and apparently, you must restart the computer to recover:
Issue 671 - mv empty subfolder causes deadlock - BashOnWindows GitHub.

The issue was fixed in the Windows Insider Preview Build 14901 back in August.

Bash on Ubuntu on Windows - Release Notes (Build 14901)

First Insider build for the post Windows 10 Anniversary Update release.

For general Windows information on build 14901 visit the Windows Blog. To track or report an issue visit our Github page.

Fixed trailing slash issue Commands such as $ mv a/c/ a/b/ now work

Solutions:

  1. Install any Windows Insider Preview Build 14901 or later
  2. Wait for the Anniversary Update to be released for all
  3. Avoid command-line arguments ending in a slash.
Related Question