This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| win10:wsl [2020/03/11 13:35] – [Mounting encrypted drives] Bernard Condrau | win10:wsl [2025/11/23 12:01] (current) – [Osiris, Cassandra, Hera, Vulcan, Hercules, Poseidon, Iapetus] Bernard Condrau | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Windows Subsystem for Linux ===== | + | ====== Windows Subsystem for Linux - Debian 10.3 ===== |
| + | ===== Osiris, Hera, Vulcan, Heracles, Poseidon, Iapetus ===== | ||
| + | This guide has been tested under Windows 10 / Debian 10 and Windows 11 / Debian 13. | ||
| ===== Installation ===== | ===== Installation ===== | ||
| - | * Open Windows Power Shell as Administrator, | + | |
| - | * Open the Microsoft Store and search for " | + | - Press Windows key + R and run **optionalfeatures.exe**. Enable //Windows Subsystem for Linux//. Restart the computer. |
| - | | + | - Open Windows Power Shell as Administrator, |
| - | | + | |
| + | dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum > | ||
| + | for /f %%i in (' | ||
| + | del hyper-v.txt | ||
| + | Dism /online / | ||
| + | pause</ | ||
| + | - Restart your computer | ||
| + | - Open the Microsoft Store and search for " | ||
| + | | ||
| + | | ||
| sudo apt upgrade</ | sudo apt upgrade</ | ||
| - | | + | |
| sudo apt install wget | sudo apt install wget | ||
| sudo apt install zip | sudo apt install zip | ||
| sudo apt install rsync</ | sudo apt install rsync</ | ||
| - | | + | |
| - | | + | - Create |
| - | | + | |
| + | | ||
| + | |||
| + | ===== Files ===== | ||
| + | * WSL2 image file is located at '' | ||
| + | * You can copy file '' | ||
| + | * To read files from an ext4.vhdx file, which is commonly used by Windows Subsystem for Linux (WSL) 2, you can utilize the wsl --mount command. This process involves mounting the VHDX file within Windows and then accessing its contents from within your WSL environment. See following steps to read files from ext4.vhdx using WSL. | ||
| + | * Terminate WSL Instances: Ensure all running WSL instances are shut down to prevent conflicts with the VHDX file.< | ||
| + | * Mount the VHDX in Windows (with Administrator privileges): | ||
| + | * Alternatively, | ||
| + | select vdisk file="< | ||
| + | attach vdisk</ | ||
| + | * Identify the Disk Path in Windows: After mounting, you need to find the disk path assigned by Windows. You can use Get-Disk in PowerShell or list disk in diskpart to identify the newly mounted disk. | ||
| + | * Mount the Disk in WSL: Open your WSL distribution (e.g., Ubuntu) and mount the disk path identified in the previous step. Replace < | ||
| + | sudo mkdir -p < | ||
| + | sudo mount < | ||
| + | * Access Files within WSL: Once mounted, you can navigate to the < | ||
| + | ls -l</ | ||
| + | * Unmount and Detach (after use): When you are finished, unmount the disk within WSL and detach the VHDX from Windows.< | ||
| + | wsl --unmount < | ||
| + | * If you used Mount-VHD:< | ||
| + | * If you used diskpart:< | ||
| + | select vdisk file="< | ||
| + | detach vdisk</ | ||
| + | * Alternative Method (for viewing only): For simply viewing the contents of an ext4.vhdx file without mounting, you can use tools like 7-Zip. 7-Zip can open and browse the contents of various disk image formats, including ext4.vhdx, allowing you to extract files without needing to mount the entire disk. | ||
| ===== SSH Server ===== | ===== SSH Server ===== | ||
| Line 25: | Line 60: | ||
| - General | - General | ||
| * Name : Start Bash SSH Server | * Name : Start Bash SSH Server | ||
| - | * Description: | + | * Description: |
| * Run only when user is logged on | * Run only when user is logged on | ||
| * Run with highest privileges | * Run with highest privileges | ||
| - Trigger | - Trigger | ||
| - | * Begin the task: At log on | + | * Begin the task: At log on [OR] On an event |
| + | * (if you mount VeraCrypt volumes during boot it's better to use //On an event// and begin the task when the volumes are mounted) | ||
| * Specific user: < | * Specific user: < | ||
| * Enabled | * Enabled | ||
| Line 35: | Line 71: | ||
| * Action: Start a program | * Action: Start a program | ||
| * Program/ | * Program/ | ||
| - | * Add arguments (optional): -c "sudo / | + | * Add arguments (optional): -c "/usr/bin/sudo / |
| - Conditions | - Conditions | ||
| * Start the task only if the computer is on AC power | * Start the task only if the computer is on AC power | ||
| - Settings | - Settings | ||
| * //Uncheck// Stop the task if it runs longer than: | * //Uncheck// Stop the task if it runs longer than: | ||
| + | - Alternative Action when starting a non elevated script " | ||
| + | * Action: Start a program | ||
| + | * Program/ | ||
| + | * Add arguments (optional): -c "/ | ||
| + | * Script " | ||
| + | sudo / | ||
| + | |||
| + | ===== LAMP ===== | ||
| + | * [[deb12: | ||
| + | * [[deb9: | ||
| + | * [[deb9: | ||
| ===== Mounting encrypted drives ===== | ===== Mounting encrypted drives ===== | ||
| * WSL can mount encrypted drives, but they must be mounted at the time wsl or bash runs the first time after boot. | * WSL can mount encrypted drives, but they must be mounted at the time wsl or bash runs the first time after boot. | ||
| * If you do not execute any tasks when the host boots up, then just make sure your encrypted drives are mounted when you run wsl or bash. | * If you do not execute any tasks when the host boots up, then just make sure your encrypted drives are mounted when you run wsl or bash. | ||
| - | * If you **do** execute | + | * If you **do** execute |
| <Query Id=" | <Query Id=" | ||
| - | <Select Path=" | + | <Select Path=" |
| </ | </ | ||
| </ | </ | ||
| + | * Remember to " | ||
| + | |||
| + | ===== Mounting external drives ===== | ||
| + | mkdir /mnt/f | ||
| + | mount -t drvfs f: /mnt/f | ||
| ===== Links ===== | ===== Links ===== | ||
| * [[https:// | * [[https:// | ||