Clear Linux for WSL (2)

thank you @puneetse for the reference, I saw it and wanted to answer after WSLConf :slight_smile:

Please start here: [Tutorial] Clearlinux on WSL2

I will have to update it for showing how you can do the same from the Docker image.
If you have docker installed, here is a the commands (in a nutshell):

  1. docker run -it --name wslclear clearlinux
  2. [inside the container]
    2.1 swupd update
    2.2 useradd -m -s /bin/bash USERNAME # replace USERNAME by your own
    2.3 vi /etc/wsl.conf # edit it to add your user to be the default
    Windows Terminal

[automount]
enabled = true
options = “metadata,uid=1000,gid=1000,umask=22,fmask=11,case=off”
mountFsTab = true
crossDistro = true

[network]
generateHosts = false
generateResolvConf = true

[interop]
enabled = true
appendWindowsPath = true

[user]
default = USERNAME
2.4 swupd install sudo
2.5 usermod -aG wheelnopw
2.6 exit

  1. docker export -o wslcleartemp.tar wslclear
  2. mkdir wslcleartemp
  3. sudo tar -xf wslcleartemp.tar --same-owner -C wslcleartemp
  4. cd wslcleartemp
  5. sudo tar -cf …/wslclear.tar --same-owner --hard-dereference *
  6. cd …
  7. mkdir /mnt/c/wsldistros
  8. mv wslclear.tar /mnt/c/wsldistros/
  9. [start Powershell]
  10. wsl.exe --import wslclear c:\wsldistros\wslclear c:\wsldistros\wslclear.tar

The issue (currently) is that WSL does not handle the hard links in the TAR files, so we need to extract and re-tar the content with the “–harde-dereference”

Hope this helps, and I will monitor this thread in case you have further questions or encounter any issues (hopefully not eheh)