Vinfall / ClearWSL

Clear Linux OS as a WSL instance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ClearWSL

Clear Linux OS on WSL2 (Windows 10 FCU or later) inspired by ClearWSL based on wsldl.

PRs Welcome License

Notice: This is Clear Linux OS backed by Intel. Not to be confused with Clear OS, which is a completely different CentOS/RHEL-based distro.

Requirements

  • Windows 10 1803 April 2018 Update x64 or later.
  • Windows Subsystem for Linux feature is enabled.
  • Latest WSL recommended.

Install

  1. Download installer zip from release or action build (recommended)
  2. Extract all files in zip file to same directory (e.g. C:\WSL\Clear)
  3. Run Clear.exe to Extract rootfs and Register to WSL

Exe filename is using to the instance name to register. If you rename it, you can register with a different name and have multiple installs.

Init

For now there would be a warning WSL (XX) ERROR: CreateProcessEntryCommon:XXX: getpwuid(0) failed 2 during startup, but it's harmless despite annoying. I will accept and appreciate it if anyone opens a PR regarding this!

By default, ClearWSL comes with no sudo package. To install sudo and make it function properly:

# Create /etc/passwd as it's not available by default
passwd
# Install `sudo`
swupd bundle-add --assume=yes sudo
# Check update
sudo swupd check-update
# Update
sudo swupd update

Telemetrics

It's worth mentioning that Clear Linux OS has a built-in telemetry function and opt-in by default. In ClearWSL the client is not active (maybe due to the fact that SystemD needs to be explicitly enabled in /etc/wsl.conf).

If you use SystemD, it's better to ensure the telemetrics are disabled if you don't want this feature:

# Disabling after install
sudo telemctl stop
# Opt out of telemetry
sudo telemctl opt-out

If you get sudo: telemctl: command not found, it means that you don't have telemetrics bundle installed, so no worries about telemetry.

For further information, please read the official documentation for Clear Linux* Project.

How-to-Use (for Installed Instance)

Usage

Usage :
    <no args>
      - Open a new shell with your default settings.

    run <command line>
      - Run the given command line in that distro. Inherit current directory.

    runp <command line (includes windows path)>
      - Run the path translated command line in that distro.

    config [setting [value]]
      - `--default-user <user>`: Set the default user for this distro to <user>
      - `--default-uid <uid>`: Set the default user uid for this distro to <uid>
      - `--append-path <on|off>`: Switch of Append Windows PATH to $PATH
      - `--mount-drive <on|off>`: Switch of Mount drives
      - `--default-term <default|wt|flute>`: Set default terminal window

    get [setting]
      - `--default-uid`: Get the default user uid in this distro
      - `--append-path`: Get on/off status of Append Windows PATH to $PATH
      - `--mount-drive`: Get on/off status of Mount drives
      - `--wsl-version`: Get WSL Version 1/2 for this distro
      - `--default-term`: Get Default Terminal for this distro launcher
      - `--lxguid`: Get WSL GUID key for this distro

    backup [contents]
      - `--tgz`: Output backup.tar.gz to the current directory using tar command
      - `--reg`: Output settings registry file to the current directory

    clean
      - Uninstall the distro.

    help
      - Print this usage message.

Uninstall

.\Clear.exe clean

How-to-Build

ClearWSL can be built on GNU/Linux or WSL.

curl, bsdtar, jq and unzip is required for build.

# Install build tools
sudo apt install -y curl libarchive-tools jq unzip
# Make release
# Use of `sudo` recommended to avoid weird file permission in rootfs
sudo make
# Clean-up using `sudo` as some files are owned by root
sudo make clean

Todo

  • Add CI (GitHub Actions)
  • Fix warning about WSL (XX) ERROR: CreateProcessEntryCommon:XXX: getpwuid(0) failed 2 according to microsoft/WSL#5923 or another issue I forgot to take note, or do some dirty hack on /etc/fstab or /etc/wsl.conf

About

Clear Linux OS as a WSL instance.

License:MIT License


Languages

Language:Makefile 100.0%