Clear Linux Windows WSL Installation
Features:
- Works in 2024
- The latest releases, provided weekly
- Fully automated via GitHub Actions
-
Update your Windows (min 2 Apr 2023, required for importing from
.xz) -
Activate WSL if not have been activated yet
-
Download the latest Clear Linux server rootfs tarball (main purpose of this repo is maintaing of this tarball):
https://github.com/gh0st-work/clear-linux-wsl/releases/latest/download/clear_linux_rootfs.tar.xz -
Start a new Powershell session:
<WIN + r>powershell<ENTER>
Or just run Powershell from Windows Start Menu -
Create sources directory:
mkdir /wsl_distros/sources
-
Copy (or move) the
clear_linux_rootfs.tar.xzto the/wsl_distros/sources/directory:cp -v $HOME/Downloads/clear_linux_rootfs.tar.xz /wsl_distros/sources/ -
Update WSL (min 2 Apr 2023, required for importing from
.xz):wsl.exe --update
-
Register Clear Linux as a new WSL2 distro:
wsl.exe --import ClearLinux /wsl_distros/ClearLinux /wsl_distros/sources/clear_linux_rootfs.tar.xz --version 2
-
Ensure the distro has been imported correctly:
wsl.exe --list --verbose
-
Create on your desktop shortcut with path:
%windir%\system32\cmd.exe /k cd %userprofile% && wsl.exe -d ClearLinux --cd ~
and name
ClearLinux
Recomended:- Change icon in Properties to
https://raw.githubusercontent.com/gh0st-work/clear-linux-wsl/main/clear_linux_logo.ico
- Change icon in Properties to
-
Run it
-
Update the system:
swupd update
-
Create a new user (change
USERNAMEto your username):useradd -m -s /bin/bash USERNAME
passwd USERNAME
-
Add basic bundles:
swupd bundle-add sysadmin-basic sudo
-
Add user to sudoers (change
USERNAMEto your username):usermod -aG wheel USERNAME
-
Write default
wsl.confconfig:cat >> /etc/wsl.conf << 'EOF' [automount] enabled = true options = "metadata,uid=1000,gid=1000,umask=22,fmask=11,case=off" mountFsTab = true crossDistro = true [network] generateHosts = true generateResolvConf = true [interop] enabled = true appendWindowsPath = true [user] default = USERNAME
Don't forget to change
USERNAMEto your username, and then exit writing withEOFat a new line:EOF
-
Shutdown WSL machine with:
exit wsl.exe -d ClearLinux --shutdown exit
-
Edit your shortcut path (in Properties) adding
-u USERNAME(changeUSERNAMEto your username) before--cd ~:%windir%\system32\cmd.exe /k cd %userprofile% && wsl.exe -d ClearLinux -u USERNAME --cd ~
-
Run it
And here you are, logged as your user without any errors
-
Recommended:
- Pin to taskbar after running
-
Happy hacking :)
And don't forget to star the repo pls!
For more experienced users: you can use get_latest_rootfs.sh script to get official images yourself, if you assume this repo GitHub releases can be compromised
- Install Ubuntu WSL and run it
- Download the script:
wget https://raw.githubusercontent.com/gh0st-work/clear-linux-wsl/main/get_latest_rootfs.sh
- Run it:
Where:
bash get_latest_rootfs.sh 1 1
- First argument sets xz compression level to 1 as you are not limited by GitHub size limit and don't want to waste time
- Second argument sets threads count to 1, you can calculate it yourself using
lscpu
- Copy result tarball to Windows
Downloadsfolder (changeWINDOWS_USERNAMEto your Windows user username):sudo cp clear_linux_rootfs.tar.xz /mnt/c/Users/WINDOWS_USERNAME/Downloads/
- Follow default installation instructions
-
The main idea is to update & maintain this installation method
extract rootfs to .tarthat was mentioned in this tutorial to contain the latest version (not 4 years old version as it is in the original tutorial) -
Was decided to use GitHub Action to provide the latest version & to save my 20yo laptop resources (mainly my time lol) & just for fun of automation
-
GitHub only allows to store maximum 2GB files
-
Was decided to experiment with compression
-
gzip compression of any level did not give satisfying result
-
Found that
wslsupports.xzcompression container (w lzma2 compression, generally available on any unix machine) as of 2 Apr 2023 as mentioned here -
Found unix compressions benchmark #1 & benchmark #2
-
xz -4level of compression gives1.9Goutput that is alright (for now, may change in future, have ~10-15% to compress where) -
xz -T2threads specified to speedup compression (takes ~14min to compress & ~9min to upload artifact & ~1min to upload artifact to release draft, ~24min together) -
Found an article that explains some math behind determining the optimal threads count. This task does not require such kind of complexity to measure lzma2 algo params, but just found it interesting for further reading
-
Works as 4 Dec 2023, provided detailed
README.md&Installation from sourceinstructions, trust nobody not even yourself kekw -
Now accepts
get_latest_rootfs.sharguments & changedInstallation from sourceinstructions & tested -
Auto-releases enabled: Every GHA run automatically publishes a release
-
xz -5level of compression set, as 40580 release reaches1.9-2.0GB. New5level of compression gives1.85GB result (takes ~18min to compress & ~8min to upload artifact & ~1min to upload artifact to release draft, ~27min together) -
xz -7level of compression is set, as 41780 release reaches2.1GB. New 7 level of compression gives1.43GB result. GitHub runners drive space limit19GB is exceeded, so the order of operations has been changed to save space. Takes ~17min in total.




