[Tutorial] Clearlinux on WSL2 - Tutorials and Guides - Clear Linux OS ... https://community.clearlinux.
org/t/tutorial-clearlinux-on-wsl2/1835/print
DEVELOPER COMMUNITY DOCUMENTATION
[Tutorial] Clearlinux on WSL2
nunixtech #1 October 9, 2019, 4:56pm
swupd bundle-add clearlinux-on-wsl2
Introduction
This tutorial describes how to install, configure, and start Clear Linux on Windows WSL2.
Description
Prerequisites
Configuration: Windows side
Configuration: Linux side
Conclusion
Description
Welcome to this first tutorial talking about Clear Linux on WSL2.
This tutorial will describe how to install Clear Linux on WSL2 from the (Windows) console and few
configuration tips that will make the Linux feeling even more authentic.
So if you want to test it out just for curiosity, or because you simply love Clear Linux and need to run Windows
for work or specific tasks, then this tutorial is definitively for you.
NOTE: WSL2 is only available in the Windows 10 Insider Fast ring (read: beta).
This means that, while is quite stable, it is not suited, yet, for production environments.
Prerequisites
In order to have the best experience while reading this tutorial, the following prerequisites need to be checked:
Windows 10 Insider Fast 18917 or newer
Windows Subsystem for Linux (WSL) installed
[Optional] One Windows Store distro installed
Clear Linux rootfs - This tutorial will use the server rootfs
Configuration: Windows side
1 of 6 11/8/2021, 9:53 AM
[Tutorial] Clearlinux on WSL2 - Tutorials and Guides - Clear Linux OS ... https://community.clearlinux.org/t/tutorial-clearlinux-on-wsl2/1835/print
Now that all prerequisites are gathered, it’s time to start the configuration.
In order to keep everything ordered, the first task will be to create a directory “structure”. This will help when
very specific configurations need to be done (read: custom kernel):
Start a new Powershell session. TIP: press the keyboard keys WINDOWS+R to show the run popup and type
powershell
Create the top directory: PS> mkdir /mywsldistros
Create one sub-directory to store the inital rootfs: PS> mkdir /mywsldistros/sources
Copy (or move) the rootfs to the sources directory: PS> cp -v $HOME/Downloads
/Clear_Linux_Server_WSL_rootfs_clean.tar.gz /mywsldistros/sources/
2 of 6 11/8/2021, 9:53 AM
[Tutorial] Clearlinux on WSL2 - Tutorials and Guides - Clear Linux OS ... https://community.clearlinux.org/t/tutorial-clearlinux-on-wsl2/1835/print
Register Clear Linux as a new WSL2 distro: wsl.exe --import clearlinux /mywsldistros
/clearlinux /mywsldistros/sources/Clear_Linux_Server_WSL_rootfs_clean.tar.gz
--version 2
TIP: if the --version flag is omitted, the distro can be migrated using wsl.exe --set-version
clearlinux 2
Ensure the distro has been imported correctly
Finally, login to the newly created distro
Configuration: Linux side
Once running Clear Linux on WSL, the only (current) limitation is, there’s no virtualization capabilities (read:
no KVM or other hypervisor based technologies).
With that said, here is the 4 main tasks that should be performed after the first login:
1. Update the system: swupd update
3 of 6 11/8/2021, 9:53 AM
[Tutorial] Clearlinux on WSL2 - Tutorials and Guides - Clear Linux OS ... https://community.clearlinux.org/t/tutorial-clearlinux-on-wsl2/1835/print
2. Create a new user and assign a password:
useradd -m -s /bin/bash clearuser
passwd clearuser
3. Add basic bundles: swupd bundle-add sysadmin-basic sudo
The sudoers config has 2 predifined groups, add the user created to one of them as follow:
# Requires password when using sudo <command>
usermod -aG wheel clearuser
# Does NOT require password when using sudo <command>
usermod -aG wheelnopw clearuser
4. Create the wsl.conf config file for optimal Interopability
vi /etc/wsl.conf
[automount]
4 of 6 11/8/2021, 9:53 AM
[Tutorial] Clearlinux on WSL2 - Tutorials and Guides - Clear Linux OS ... https://community.clearlinux.org/t/tutorial-clearlinux-on-wsl2/1835/print
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 = clearuser
At this point, the initial configuration is finalised. Close the session, shutdown the WSL VM and start a new
Clear Linux session:
exit
PS> wsl.exe --shutdown
PS> wsl.exe -d clearlinux
sudo swupd update
NOTE: the full settings are explained here: https://devblogs.microsoft.com/commandline/automatically-
5 of 6 11/8/2021, 9:53 AM
[Tutorial] Clearlinux on WSL2 - Tutorials and Guides - Clear Linux OS ... https://community.clearlinux.org/t/tutorial-clearlinux-on-wsl2/1835/print
configuring-wsl/
Conclusion
Congratulations, a new Clear Linux WSL distro is now up and running.
As seen during the system update or when adding new packages, there’s some errors. Do not sweat, these are
not blocking the system.
Now you can enjoy all the incredible blog posts out there on how to use to the best WSL while running the
distro we like the most, Clear Linux.
>>> Nunix out <<<
15 Likes
Clear Linux for WSL (2)
Clear Linux on WSL2 tutorial: anyone wants an update?
Clear Linux for WSL (2)
nvmd #2 April 22, 2020, 2:24pm
It took me 3 hours and 3 separate executions of swupd to fully update the OS, and I always get a warning from
curl:
Warning: Curl - Unable to create a thread pool - downloading files synchronously
Is that just me or what?
6 of 6 11/8/2021, 9:53 AM