Skip to content

Commit 56bcf44

Browse files
committed
Rewrite of troubleshoot pg draft 1
1 parent 29bfbb0 commit 56bcf44

1 file changed

Lines changed: 75 additions & 28 deletions

File tree

WSL/troubleshooting.md

Lines changed: 75 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,31 @@
22
title: Troubleshooting the Windows Subsystem for Linux
33
description: Provides detailed information about common errors and issues people run into while running Linux on the Windows Subsystem for Linux.
44
keywords: BashOnWindows, bash, wsl, windows, windowssubsystem, ubuntu
5-
ms.date: 11/15/2017
5+
ms.date: 01/20/2020
66
ms.topic: article
7-
ms.assetid: 6753f1b2-200e-49cc-93a5-4323e1117246
8-
ms.custom: seodec18
97
ms.localizationpriority: high
108
---
119

1210
# Troubleshooting Windows Subsystem for Linux
1311

12+
For support related to the Windows Subsystem for Linux:
13+
14+
- **Windows Subsystem for Linux user documentation**
15+
16+
-- If you are experiencing a problem, please search the **Issues** section of the WSL MicrosoftDocs github repo: https://github.com/MicrosoftDocs/WSL/issues
17+
-- If you cannot find an existing issue that addresses your problem, please select **New issue** and describe your issue in as much detail as possible. Consider including the version number of Windows that you are currently running. This can be found by entering `Run` in the start window, then entering `winver` and selecting **OK**.
18+
19+
- **Windows Subsystem for Linux feature request**
20+
21+
-- If you would like to request a new feature, please visit the **Issues** section of the WSL Microsoft github repo: https://github.com/microsoft/WSL
22+
-- Please search the existing **Issues** to see whether there is a similar request that has already been addressed. If not, please select the **New issue** and explain your request in detail.
23+
24+
- **Windows Terminal, Console and Command-Line issues**
25+
26+
-- For issues related, to Windows Terminal or Console host, please visit the **Issues** section of the Windows Terminal repo: https://github.com/microsoft/terminal
27+
28+
## Common issues
29+
1430
### Bash loses network connectivity once connected to a VPN
1531

1632
If after connecting to a VPN on Windows, bash loses network connectivity, try this workaround from within bash. This workaround will allow you to manually override the DNS resolution through `/etc/resolv.conf`.
@@ -27,6 +43,7 @@ If after connecting to a VPN on Windows, bash loses network connectivity, try th
2743
c. Close the file. <br/>
2844

2945
Once you have disconnected the VPN, you will have to revert the changes to `/etc/resolv.conf`. To do this, do:
46+
3047
1. `cd /etc`
3148
2. `sudo mv resolv.conf resolv.conf.new`
3249
3. `sudo ln -s ../run/resolvconf/resolv.conf resolv.conf`
@@ -37,20 +54,21 @@ Follow [these instructions](https://github.com/Microsoft/WSL/blob/master/CONTRIB
3754

3855
### Updating Bash on Ubuntu on Windows
3956

40-
There are two components of Bash on Ubuntu on Windows that can require updating.
57+
There are two components of Bash on Ubuntu on Windows that can require updating.
4158

4259
1. The Windows Subsystem for Linux
4360

44-
Upgrading this portion of Bash on Ubuntu on Windows will enable any new fixes outlines in the [release notes](https://msdn.microsoft.com/en-us/commandline/wsl/release_notes). Ensure that you are subscribed to the Windows Insider Program and that your build is up to date. For finer grain control including resetting your Ubuntu instance check out the [command reference page](https://msdn.microsoft.com/en-us/commandline/wsl/reference).
61+
Upgrading this portion of Bash on Ubuntu on Windows will enable any new fixes outlines in the [release notes](./release-notes.md). Ensure that you are subscribed to the Windows Insider Program and that your build is up to date. For finer grain control including resetting your Ubuntu instance check out the [command reference page](./reference.md).
4562

46-
2. The Ubuntu user binaries
63+
2. The Ubuntu user binaries
4764

4865
Upgrading this portion of Bash on Ubuntu on Windows will install any updates to the Ubuntu user binaries including applications that you have installed via apt-get. To update run the following commands in Bash:
4966

5067
1. `apt-get update`
5168
2. `apt-get upgrade`
5269

5370
### Apt-get upgrade errors
71+
5472
Some packages use features that we haven't implemented yet. `udev`, for example, isn't supported yet and causes several `apt-get upgrade` errors.
5573

5674
To fix issues related to `udev`, follow the following steps:
@@ -62,18 +80,21 @@ To fix issues related to `udev`, follow the following steps:
6280
exit 101
6381
```
6482

65-
2. Add execute permissions to `/usr/sbin/policy-rc.d`
83+
2. Add execute permissions to `/usr/sbin/policy-rc.d`:
84+
6685
``` BASH
6786
chmod +x /usr/sbin/policy-rc.d
6887
```
6988

70-
3. Run the following commands
89+
3. Run the following commands:
90+
7191
``` BASH
7292
dpkg-divert --local --rename --add /sbin/initctl
7393
ln -s /bin/true /sbin/initctl
7494
```
7595

7696
### "Error: 0x80040306" on installation
97+
7798
This has to do with the fact that we do not support legacy console.
7899
To turn off legacy console:
79100

@@ -82,50 +103,63 @@ To turn off legacy console:
82103
1. Click OK
83104

84105
### "Error: 0x80040154" after Windows update
85-
The Windows Subsystem for Linux feature may be disabled during a Windows update. If this happens the Windows feature must be re-enabled. Instructions for enabling the Windows Subsystem for Linux can be found in the [Installation Guide](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide#enable-the-windows-subsystem-for-linux-feature-gui).
106+
107+
The Windows Subsystem for Linux feature may be disabled during a Windows update. If this happens the Windows feature must be re-enabled. Instructions for enabling the Windows Subsystem for Linux can be found in the [Installation Guide](./install-win10.md).
86108

87109
### Changing the display language
110+
88111
WSL install will try to automatically change the Ubuntu locale to match the locale of your Windows install. If you do not want this behavior you can run this command to change the Ubuntu locale after install completes. You will have to relaunch bash.exe for this change to take effect.
89112

90113
The below example changes to locale to en-US:
114+
91115
``` BASH
92116
sudo update-locale LANG=en_US.UTF8
93117
```
94118

95119
### Installation issues after Windows system restore
96-
1. Delete the `%windir%\System32\Tasks\Microsoft\Windows\Windows Subsystem for Linux` folder. <br/>
120+
121+
1. Delete the `%windir%\System32\Tasks\Microsoft\Windows\Windows Subsystem for Linux` folder. <br/>
97122
**Note: Do not do this if your optional feature is fully installed and working.**
98-
2. Enable the WSL optional feature (if not already)
99-
3. Reboot
100-
4. lxrun /uninstall /full
101-
5. Install bash
123+
2. Enable the WSL optional feature (if not already)
124+
3. Reboot
125+
4. lxrun /uninstall /full
126+
5. Install bash
102127

103128
### No internet access in WSL
129+
104130
Some users have reported issues with specific firewall applications blocking internet access in WSL. The firewalls reported are:
105131

106132
1. Kaspersky
107-
1. AVG
108-
1. Avast
133+
2. AVG
134+
3. Avast
109135

110136
In some cases turning off the firewall allows for access. In some cases simply having the firewall installed looks to block access.
111137

112138
### Permission Denied error when using ping
113-
#### [Anniversary Update](https://msdn.microsoft.com/en-us/commandline/wsl/release_notes#build-14388-to-windows-10-anniversary-update)
114139

115-
Administrator privileges in Windows are required to run ping in WSL. To run ping, run Bash on Ubuntu on Windows as an administrator, or run bash.exe from a CMD/PowerShell prompt with administrator privileges.
140+
For [Windows Anniversary Update, version 1607](./release-notes.md#build-14388-to-windows-10-anniversary-update),
141+
**administrator privileges** in Windows are required to run ping in WSL. To run ping, run Bash on Ubuntu on Windows as an administrator, or run bash.exe from a CMD/PowerShell prompt with administrator privileges.
116142

117-
#### [Build 14926+](https://msdn.microsoft.com/en-us/commandline/wsl/release_notes#build-14926)
118-
Administrator privileges no longer required.
143+
For later versions of Windows, [Build 14926+](./release-notes.md#build-14926), administrator privileges are no longer required.
119144

120145
### Bash is hung
121-
If while working with bash, you find that bash is hung (or deadlocked) and not responding to inputs, help us diagnose the issue by collecting and reporting a memory dump. Note that these steps will crash your system. Do not do this if you are not comfortable with that or save your work prior to doing this. <br/>
122-
To collect a memory dump:
146+
147+
If while working with bash, you find that bash is hung (or deadlocked) and not responding to inputs, help us diagnose the issue by collecting and reporting a memory dump. Note that these steps will crash your system. Do not do this if you are not comfortable with that or save your work prior to doing this.
148+
149+
To collect a memory dump
150+
123151
1. Change the memory dump type to "complete memory dump". While changing the dump type, take a note of your current type.
152+
124153
2. Use the [steps](https://techcommunity.microsoft.com/t5/Core-Infrastructure-and-Security/How-to-Force-a-Diagnostic-Memory-Dump-When-a-Computer-Hangs/ba-p/257809) to configure crash using keyboard control.
154+
125155
3. Repro the hang or deadlock.
156+
126157
4. Crash the system using the key sequence from (2).
158+
127159
5. The system will crash and collect the memory dump.
160+
128161
6. Once the system reboots, report the memory.dmp to [email protected]. The default location of the dump file is %SystemRoot%\memory.dmp or C:\Windows\memory.dmp if C: is the system drive. In the email, note that the dump is for the WSL or Bash on Windows team.
162+
129163
7. Restore the memory dump type to the original setting.
130164

131165
### Check your build number
@@ -134,35 +168,45 @@ To find your PC's architecture and Windows build number, open
134168
**Settings** > **System** > **About**
135169

136170
Look for the **OS Build** and **System Type** fields.
137-
![Screenshot of Build and System Type fields](media/system.png)
138-
171+
![Screenshot of Build and System Type fields](media/system.png)
139172

140173
To find your Windows Server build number, run the following in PowerShell:
174+
141175
``` PowerShell
142176
systeminfo | Select-String "^OS Name","^OS Version"
143177
```
144178

145179
### Confirm WSL is enabled
180+
146181
You can confirm that the Windows Subsystem for Linux is enabled by running the following in PowerShell:
182+
147183
``` PowerShell
148184
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
149185
```
150186

151187
### OpenSSH-Server connection issues
188+
152189
Trying to connect your SSH server is failed with the following error: "Connection closed by 127.0.0.1 port 22".
190+
153191
1. Make sure your OpenSSH Server is running:
192+
154193
``` BASH
155194
sudo service ssh status
156195
```
196+
157197
and you've followed this tutorial:
158198
https://help.ubuntu.com/lts/serverguide/openssh-server.html.en
199+
159200
2. Stop the sshd service and start sshd in debug mode:
201+
160202
``` BASH
161203
sudo service ssh stop
162204
sudo /usr/sbin/sshd -d
163205
```
206+
164207
3. Check the startup logs and make sure HostKeys are available and you don't see log messages such as:
165-
```
208+
209+
```BASH
166210
debug1: sshd version OpenSSH_7.2, OpenSSL 1.0.2g 1 Mar 2016
167211
debug1: key_load_private: incorrect passphrase supplied to decrypt private key
168212
debug1: key_load_public: No such file or directory
@@ -179,6 +223,7 @@ Trying to connect your SSH server is failed with the following error: "Connectio
179223
```
180224

181225
If you do see such messages and the keys are missing under `/etc/ssh/`, you will have to regenerate the keys or just purge&install openssh-server:
226+
182227
```BASH
183228
sudo apt-get purge openssh-server
184229
sudo apt-get install openssh-server
@@ -188,6 +233,8 @@ sudo apt-get install openssh-server
188233

189234
This error is related to being in a bad install state. Please complete the following steps to try and fix this issue:
190235

191-
* If you are running the enable WSL feature command from PowerShell, try using the GUI instead by opening the start menu, searching for 'Turn Windows features on or off' and then in the list select 'Windows Subsystem for Linux' which will install the optional component.
192-
* Update your version of Windows by going to Settings, Updates, and clicking 'Check for Updates'
193-
* If both of those fail and you need to access WSL please consider upgrading in place by reinstalling Windows 10 using installation media and selecting 'Keep Everything' to ensure your apps and files are preserved. You can find instructions on how to do so at the [Reinstall Windows 10 page](https://support.microsoft.com/en-us/help/4000735/windows-10-reinstall).
236+
- If you are running the enable WSL feature command from PowerShell, try using the GUI instead by opening the start menu, searching for 'Turn Windows features on or off' and then in the list select 'Windows Subsystem for Linux' which will install the optional component.
237+
238+
- Update your version of Windows by going to Settings, Updates, and clicking 'Check for Updates'
239+
240+
- If both of those fail and you need to access WSL please consider upgrading in place by reinstalling Windows 10 using installation media and selecting 'Keep Everything' to ensure your apps and files are preserved. You can find instructions on how to do so at the [Reinstall Windows 10 page](https://support.microsoft.com/help/4000735/windows-10-reinstall).

0 commit comments

Comments
 (0)