4

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.

  • What are you doing when it hangs? – Steven Feb 7 '17 at 16:50
  • I don't know. it also happens when inside a bash session running some commands there. – Tim Feb 7 '17 at 16:57
  • When a command hangs inside bash, it hangs only when hitting return key to run it, not when I am typing. Can I kill and restart the process which is for running the linux subsystem in Windows? – Tim Feb 7 '17 at 17:04
  • For example, some commands for some file operations may hang, especially when they are changing the same file as some process in Windows. How can I kill and restart the processes related to the Linux subsystem? Will that solve the problem? – Tim Feb 7 '17 at 17:09
  • For example, I mv a file in bash, and the file is also opened by a process in Windows. Most of time it will abort and report error, but sometimes it will hang and not return. – Tim Feb 7 '17 at 17:57
4

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.
  • Thanks. I am installing a Windows Iniser Preview Build, and it says that my files, apps and settings can’t be kept because I am installing an edition of Windows that’s different than the one I am currently using. I guess that means that my setups will be removed and I will have to redo everything, correct? I am weighing between fixing the bash bug vs losing and redoing everything. – Tim Feb 8 '17 at 19:15
  • Your assessment seems to be the case. I have never installed an Insider Build. That's your call to make. – Steven Feb 8 '17 at 19:36
  • @Tim What did you decide to do? – Steven Feb 23 '17 at 9:58
1

So I was having this issue as well. I am on a domain joined PC and this was part the problem I believe.

When running commands, after pressing "Enter" the shell would hang and it would tell me (sometimes) that it couldn't find my "hostname". I noticed this occurred every time I used sudo or when I would expect DNS to come into play.

I ran these commands:

# hostname --short
host    

hostname --domain
[error message]

From this I decided to check the hostname file and ensure that my FQDN was set (it wasn't)

/etc/hostname

Once I set that to host.domain.com, I ran the following:

sudo hostname -F /etc/hostname

I no longer have any hanging after running commands and no more complaints about unable to find hostnames. I'm not sure if you are on a domain, but if you are, it may be worth checking out.

NOTE: For some reason, I have to do this every time I open bash. It's really frustrating...

ANOTHER NOTE: I find it best to run bash as an administrator. You can't even use ping without doing that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.