WSL (Windows Subsystem for linux): Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
 
(4 dazwischenliegende Versionen des gleichen Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
== Useful commands ==
 
== Useful commands ==
 
'''Get WSL instances state an version:''' wsl -l -v <br>
 
'''Get WSL instances state an version:''' wsl -l -v <br>
'''Shutdown WSL:''' wsl --shutdown <br>
+
'''Shutdown WSL-Instance:''' wsl --shutdown <wsl-instance><br>
 
'''Set WSL default version to 2 for new distributions:''' wsl --set-default-version 2 <br>
 
'''Set WSL default version to 2 for new distributions:''' wsl --set-default-version 2 <br>
 
'''Set WSL instance version 2 (example with kali-linux distribution):''' wsl --set-version kali-linux 2 <br>
 
'''Set WSL instance version 2 (example with kali-linux distribution):''' wsl --set-version kali-linux 2 <br>
 +
 +
 +
== WSL 2: Configure Kali Linux (GUI from Windows) ==
 +
'''Install WSL 2'''
 +
* Run PowerShell as administrator
 +
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
 +
*Restart Computer
 +
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
 +
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
 +
*Restart Computer
 +
*Download the newest Linux Kernel: https://aka.ms/wsl2kernel
 +
 +
'''Install GUI'''
 +
sudo apt update && sudo apt upgrade -y
 +
sudo apt install kali-desktop-xfce -y
 +
 +
'''Install XRDP'''
 +
sudo apt install xrdp -y
 +
sudo service xrdp start
  
  
Zeile 10: Zeile 29:
 
== Troubleshooting ==
 
== Troubleshooting ==
 
=== Error: WslRegisterDistribution failed with error: 0xc03a001a (example Ubuntu) ===
 
=== Error: WslRegisterDistribution failed with error: 0xc03a001a (example Ubuntu) ===
NTFS has this feature that '''compresses directories''' to save space. If some or all of your icons are marked by 2 opposing blue arrows, that's your sign that said feature is indeed on. [[Datei:Win compression.png]]
+
NTFS has this feature that '''compresses directories''' to save space. If some or all of your icons are marked by 2 opposing blue arrows [[Datei:Win compression.png]], that's your sign that said feature is indeed on. <br>
Now, because of this, the directory that hosts your Store downloads might also have the same issue.
+
Now, because of this, the directory that hosts your Store downloads might also have the same issue. <br>
Go to '''C:\Users\<your_UserName>\AppData\Local\Packages''' folder. If not apparent, it's probably hidden.  
+
 
Once inside directory, search subdirectory with 'ubuntu' string/keyword. Once located, right click the directory '''Properties -> Advanced -> uncheck the compression -> Apply'''.  
+
==== Solution ====
 +
Go to '''C:\Users\<your_UserName>\AppData\Local\Packages''' folder. If not apparent, it's probably hidden. <br>
 +
Once inside directory, search subdirectory with 'ubuntu' string/keyword. Once located, right click the directory '''Properties -> Advanced -> uncheck the compression -> Apply'''. <br>
 
Now the ubuntu directory should have the arrows removed, which means you should have a better chance at actually running the distro install. (thanks to [https://github.com/microsoft/WSL/issues/5325 rs-droid])  
 
Now the ubuntu directory should have the arrows removed, which means you should have a better chance at actually running the distro install. (thanks to [https://github.com/microsoft/WSL/issues/5325 rs-droid])  
  
Zeile 22: Zeile 43:
 
[[Kategorie:PowerShell]]
 
[[Kategorie:PowerShell]]
 
[[Kategorie:Windows]]
 
[[Kategorie:Windows]]
 +
[[Kategorie:Linux]]

Aktuelle Version vom 16. Juli 2020, 12:25 Uhr

Useful commands

Get WSL instances state an version: wsl -l -v
Shutdown WSL-Instance: wsl --shutdown <wsl-instance>
Set WSL default version to 2 for new distributions: wsl --set-default-version 2
Set WSL instance version 2 (example with kali-linux distribution): wsl --set-version kali-linux 2


WSL 2: Configure Kali Linux (GUI from Windows)

Install WSL 2

  • Run PowerShell as administrator
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • Restart Computer
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Install GUI

sudo apt update && sudo apt upgrade -y
sudo apt install kali-desktop-xfce -y

Install XRDP

sudo apt install xrdp -y
sudo service xrdp start



Troubleshooting

Error: WslRegisterDistribution failed with error: 0xc03a001a (example Ubuntu)

NTFS has this feature that compresses directories to save space. If some or all of your icons are marked by 2 opposing blue arrows Win compression.png, that's your sign that said feature is indeed on.
Now, because of this, the directory that hosts your Store downloads might also have the same issue.

Solution

Go to C:\Users\<your_UserName>\AppData\Local\Packages folder. If not apparent, it's probably hidden.
Once inside directory, search subdirectory with 'ubuntu' string/keyword. Once located, right click the directory Properties -> Advanced -> uncheck the compression -> Apply.
Now the ubuntu directory should have the arrows removed, which means you should have a better chance at actually running the distro install. (thanks to rs-droid)