OPERATING SYSTEMSOS Windows

Fix Windows Subsystem for Linux Errors, Problems and Issues


Like all software, the Windows Subsystem (WSL2) too has its fair shares of issues. In this guide, we are going to troubleshoot Windows Subsystem for Linux Error Messages and Codes.

Fix Windows Subsystem for Linux Errors, Problems & Issues

These are messages for which we are going to troubleshoot Windows Subsystem for Linux Error Messages and Codes.

  1. Do not see options for WSL 2
  2. Error: 0x1bc
  3. Error: 0x80040306 on Installation
  4. Cannot access WSL files from Windows
  5. Can’t start WSL 2 distribution and only see ‘WSL 2’ in output
  6. Command Not Found
  7. Error: 0x80370102 The virtual machine could not be started because a required feature is not installed
  8. Error: 0x80040154 after Windows update
  9. WSL Stops working with Error 0x80070003
  10. Display language changing in WSL
  11. Installation issues after Windows system restore
  12. No internet access in WSL
  13. Permission Denied when using Ping
  14. Unable to boot after installing WSL 2
  15. Not able to run Windows Commands inside a distributor
  16. ICS is disabled
  17. Bash is hung
  18. OpenSSH-Server connection issues
  19. The referenced assembly could not be found
  20. Correct (SSH related) permission errors

Let us talk about them in detail.

1] Do not see options for WSL 2

Many Windows users have complained that even though they are at built no 1903, they are unable to see options for WSL 2. This happens when your computer machine has not yet taken the backport for WSL 2.

To fix this, you just need to check for updates, and you will be good to go.

2] Error: 0x1bc

You may see the following error when the “Display Language” or “System Locale” is not set to English.

wsl --set-default-version 2

Error: 0x1bc

For information on key differences with WSL 2 please visit https://aka.ms/wsl2

To fix the error, you need to check if the Kernel is installed on your computer. To do that, use the following command.

dir %SystemRoot%system32lxsstoolskernel

If you don’t have Kernel, download it from aka.ms. Make sure to download it as an administrator and install the Kernel on your machine to fix the error.

3] Error: 0x80040306 on Installation

Fix Windows Subsystem for Linux Errors, Problems & Issues

If you are seeing Error: 0x80040306 on Installation. To fix this you need to disable Legacy Console. To do that, follow the given steps.

  1. Open Command Prompt as an administrator from the Start Menu.
  2. Right-click on the cmd logo and select Properties.
  3. Now, uncheck Use legacy console” and click Ok.

Finally, check if it fixes the issue.

4] Cannot access WSL files from Windows

If you are unable to access Windows Subsystem for Linux by \wsl$ on Windows, this could be mean that the 9P protocol file server fails to start.

The easiest fix is to update your computer and enable “updates for Microsoft products on Windows Update”. To do that, you can follow the given steps.

  1. Launch Settings by Win + I.
  2. Click Update & Security > Advanced options.
  3. Use the toggle to disable “Receive updates for other Microsoft products when you update Windows“.

This will fix the issue for you.

5] Can’t start WSL 2 distribution and only see ‘WSL 2’ in output

This error is inevitable if your display language is not set to English. You will see the following output when trying to start WSL 2.

C:Usersme>wsl

WSL 2

To fix the error, you need to download and install the Kernel manually. You can download the file from aka.ms/wsl2kernel. Install the Kernel to fix the error easily.

6] Command Not Found

This is one of the common errors one sees when they run a .exe file of Windows in Linux. You may see the following error when trying to do the same.

$ notepad.exe

-bash: notepad.exe: command not found

This happens when the $PATH fails to find the .exe file. The best solution for this error is to run the following command in the Terminal.

export PATH=$PATH:/usr/sbin

Do this and check if it fixes the error.

7] Error: 0x80370102 The virtual machine could not be started because a required feature is not installed

Many have experienced this error when trying to install a Linux distributor. Unlike previous errors, this error has more than one solution. So, buckle up and read all the solutions.

These are the things you can do to fix Error: 0x80370102 The virtual machine could not be started because a required feature is not installed.

  1. Enable Hyper-V
  2. Enable Hardware Virtualization
  3. Enable Nested Virtualization

Let us talk about them in detail.

Enable Hyper-V

Without Hyper-V, you won’t be able to create a Virtual Environment. So, enable it with the help of the following steps.

  1. Open Control Panel from the Start Menu.
  2. Click Programs and Features > Turn Windows features on or off
  3. Scroll down to find Hyper-V, check it, and click Ok.

After enabling Hyper-V check if the issue is fixed.

Enable Hardware Virtualization

Hardware Virtualization is a must when trying to run Virtual Machine. So, if you facing the Error: 0x80370102, try to enable Hardware Virtualization from the BIOS to fix the issue.

Enable Nested Virtualization

Nested Virtualization allows you to run Hypervisor inside a VM. So, if you are still facing the error, try enabling Nested Virtualization. To do that, you need to run PowerShell as an administrator and run the following command.

Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true

Let this command run and check if it fixes the issue.

8] Error: 0x80040154 after Windows update

troubleshoot Windows Subsystem for Linux Error Messages and Codes

You may see this error if Windows Subsystem for Linux is disabled because of a Windows Update. So, to fix the issue, we need to enable this option. To do that, follow the given steps.

  1. Launch Control from the Start Menu.
  2. Click Programs and Features > Turn Windows features on or off
  3. Scroll down to find Windows Subsystem for Linux, check it, and click Ok.

Finally, restart your computer and check if the issue persists.

9] WSL Stops working with Error 0x80070003

If WSL stops with this error code 0x80070003, solve it with this guide.

10] Display language changing in WSL

WSL automatically changes the Ubuntu locale, for it to match the language of your Windows computer. If you are not a fan of this move, use the following command to set the display language according to your needs.

Note: The following command will change the language to en-US.

sudo update-locale LANG=en_US.UTF8

Do this and check if it fixes the issue.

11] Installation issues after Windows system restore

If you are facing Installation issues after Windows system restore, try deleting the Windows Subsystem for Linux folder. The following is its path.

%windir%System32TasksMicrosoftWindowsWindows Subsystem for Linux

Restart your computer, reinstall Bash and check if it fixes the issue.

12] No internet access in WSL

Many users have reported that they are not able to access the Internet in WSL. However, the solution might be easier than you think. This happens because of any third-party antivirus that you may have. As the firewall blocks the Internet. So, to fix this, remove the anti-virus and you will be good to go.

13] Permission Denied when using Ping

If you are not able to Ping in WSL then this means that you don’t have administrative privilege. So, you need to run Ubuntu and Linux with administrative privilege or Bash.exe on your command line interpreter with administrative privilege.

Hopefully, this will fix the issue easily.

14] Unable to boot after installing WSL 2

The reason why you are unable to boot after installing WSL 2  is still uncanny but Microsoft is trying to work on an update to fully diagnose the issue. However, there are two things that you can do and see if it fixes the issue.

15] Not able to run Windows Commands inside a distributor

There are a few distributors in Windows Store that are not completely optimized to run all Windows Commands. You may get any of the following errors.

-bash: powershell.exe: command not found
powershell.exe /c start

To fix this error, run the following command.

echo $PATH

Now, check if the output includes “/mnt/c/Windows/system32”, if you are facing the error, then most probably the path won’t be there.

Now, check your Profile settings by

cat /etc/profile

Now, check if a Path assignment starts with “#”, if it does, comment out the block. Also, check if wsl.conf is present and make sure that it doesn’t have appendWindowsPath=false. If it does, comment it out.

After doing this, you need to restart distribution. You can use the following command to do that.

wsl -t <name of the distributor>

or

wsl --shutdown

Hopefully, the issue will be fixed.

16] ICS is disabled

A WSL can not operate without ICS or Internet Connection Sharing. The Host Network Service (HNS) uses the ICS to build a fundamental virtual network for WSL 2 to create NAT, DNS, DHCP, and host connection sharing.

To fix the error, we need to enable ICS. So, follow the given steps to enable ICS.

  1. Launch Services from the Start Menu.
  2. Double-click on Internet Connection Sharing (ICS), and click Start if it’s stopped.
  3. Finally, click Apply > Ok.

You should also edit some policies. So, launch Group Policy Editor and navigate to the following location.

Computer Configuration > Administrative Templates > Network > Network Connections

And disable the following policies.

  • Prohibit installation and configuration of Network Bridge on your DNS domain network
  • Prohibit the use of Internet Connection Firewall on your DNS domain network
  • Prohibit the use of Internet Connection Sharing on your DNS domain network
  • Require domain users to elevate when setting a network’s location

17] Bash is hung

When Bash hangs or deadlocks and stops responding to your input you can either restart your machine as that will fix the error or report a memory dump. The latter may lead to a system crash, so, save your work prior to reporting.

18] OpenSSH-Server connection issues

If you are seeing any OpenSSF-Server connection issue, the first thing you need to do is to check if the OpenSSH-Server is running. You can use the following command to do that.

sudo service ssh status

If it’s not running, use the following command to start the service.

sudo service ssh start

If it’s running, you should restart the service with the following command and check if it fixes the issue.

sudo service ssh restart

If it’s unable to fix the issue, try to start SSHD in debug mode. Before that, use the following command to stop SSH service.

sudo service ssh stop

Now, use the following command to start SSHD in debug mode.

sudo /usr/sbin/sshd -d

Hopefully, this fixes the error.

19] The referenced assembly could not be found

Many users are encountering “The referenced assembly could not be found” when they try to enable WSL additional feature. If you are one of them, try enabling Windows Subsystem for Linux from Control Panel and updating your computer. Hopefully, that will fix the error.

20] Correct (SSH related) permission errors

If you are seeing the following error, thread this section for the solution.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/home/artur/.ssh/private-key.pem' are too open.

To fix this issue, Microsoft suggests that you go to /etc/wsl.conf file and append the following:

[automount]
enabled = true
options = metadata,uid=1000,gid=1000,umask=0022

This will fix the error. Before, doing this, make sure you have adequate permission.

These were some of the Windows Subsystem for Linux Error Messages and Codes and their troubleshooting tips. We hope that they help you fix WSL Errors, Problems, and Issues.

Fix Windows Subsystem for Linux Errors, Problems & Issues

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *