====== Windows Subsystem for Linux ====== ===== What is a Windows Subsystem for Linux? ===== >Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables (in ELF format) natively on Windows 10 and Windows Server 2019. In May 2019, WSL 2 was announced, introducing important changes such as a real Linux kernel, through a subset of Hyper-V features. Since June 2019, WSL 2 is available to Windows 10 customers through the Windows Insider program, including the Home edition. [[https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux|Wikipedia - Windows Subsystem for Linux]] ===== Installation ===== Go to Windows features and activate "Windows Subsystem for Linux" {{:windows:windows10:pasted:20201210-000241.png?400|{{:windows:windows10:pasted:20201210-000241.png}} Afterwards go to the Microsoft Store, search for Linux and install a distribution of your choice {{:windows:windows10:pasted:20201210-000559.png}} ===== Start ===== Start Linux via "Start -> " or type for example "ubuntu" via CLI ===== Configuration ===== Configure your Linux for whatever you want. You can find various configs on my page. Maybe start with [[linux:general:sudoers|Sudoers]] ==== Mount shares ==== #mount a local drive from your windows host on linux mkdir /drivez mount -t drvfs 'Z:' /drivez ===== Commands ===== ==== Powershell ==== Certain tasks like reboots cant be done inside Linux and need to be executed via Powershell ^ Command ^ Function ^ | wsl.exe --shutdown | Shutdown everything (Build 18917+) | | wsl.exe -t | Terminate the session (Windows 1903+) | | Restart-Service LxssManager | Restart the Manager (older Versions) | | wsl.exe -l | List all Distros | ===== Troubleshooting ===== ==== Rescue login via root ==== Open regedit, go to "Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\" Inside your Distrofolder you will find "DefaultUid", reset the value to your root UID (mostly 0). Reopen your shell and you should be root. After your rescue job is done, reset the value to your default users UID (mostly 1000) {{:windows:windows10:pasted:20201210-003532.png?800|{{:windows:windows10:pasted:20201210-003532.png}}