- Here are some default vars for the process
ISO_DIR=~/fedora;
ROOTFS_MOUNT_DIR=/mnt/contents
DISTRO_LOCATION=
-
Install Ubuntu Bash
-
Install 7zip in ubuntu
sudo apt-get install p7zip
-
Download the distro of your choice (i.e Fedora)
-
Move the ISO to its own folder, i.e
~/fedora
-
Navigate to the directory and Extract using 7Zip
mkdir $ISO_DIR; cd $ISO_DIR;
7z x Fedora-Cinnamon-Live-x86_64-31-1.9.iso
You should see the following files or similar
artman41@DESKTOP-TQGCI07:~/fedora$ ll | less
total 2139660
drwxr-xr-x 7 artman41 artman41 4096 Mar 31 16:04 ./
drwxr-xr-x 10 artman41 artman41 4096 Mar 31 16:03 ../
drwx------ 3 artman41 artman41 4096 Oct 24 00:15 EFI/
-rwxr-xr-x 1 artman41 artman41 2203779072 Mar 31 16:03 Fedora-Cinnamon-Live-x86_64-31-1.9.iso*
drwx------ 2 artman41 artman41 4096 Oct 24 00:15 LiveOS/
drwx------ 2 artman41 artman41 4096 Mar 31 16:04 [BOOT]/
drwx------ 3 artman41 artman41 4096 Oct 24 00:15 images/
drwx------ 2 artman41 artman41 4096 Oct 24 00:15 isolinux/
- Navigate to
LiveOS
(or where thesquashfs
is) and 'unsquash' thesquash.img
:
cd LiveOS;
sudo unsquashfs -d squashfs squashfs.img
- Navigate to
squashfs/LiveOS
and mount therootfs.img
:
sudo mkdir $ROOTFS_MOUNT_DIR;
sudo mount -o loop squashfs/LiveOS/rootfs.img $ROOTFS_MOUNT_DIR;
- Navigate to
$ROOTFS_MOUNT_DIR
and tar.gz the files:
cd $ROOTFS_MOUNT_DIR;
sudo tar -zcvf $ISO_DIR/distro.tar.gz .
- Navigate to
$ISO_DIR
and import the .tar.gz usingwsl
cd $ISO_DIR
wsl.exe --import $DISTRO_NAME $DISTRO_LOCATION distro.tar.gz
- Open your distro and create a user
wsl.exe -d $DISTRO_NAME
useradd -m $USER
Note: Don't forget to add yourself to visudo
or you'll be unable to perform super-user actions until you set the DefaultUser
field in regedit
to 0
- Get your uid
grep $USER /etc/passwd
# The return will be something like artman41:x:1000:1000:root:/root:/bin/bash
# where the format is $USER:x:$USER_ID:$GROUP_ID:$GROUP:$HOME:$SHELL
- Install Windows Terminal and Open the JSON Settings
#in powershell
notepad.exe $env:LocalAppData\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\profiles.json
- Look for the profile with
$DISTRO_NAME
and note the GUID (referred to as$DISTRO_GUID
in the guide)
- copying the GUID to
defaultProfile
will make you load in to your custom distro by default using the windows terminal
-
Open
regedit
and navigate toComputer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss\$DISTRO_GUID
-
Ensure the following values are set
Name | Type | Data |
---|---|---|
DefaultEnvironment |
REG_MULTI_SZ |
HOSTTYPE=x86_64 LANG=en_US.UTF-8 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games TERM=xterm-256color |
DefaultUid |
REG_DWORD |
$USER_ID |
- Restart your custom distro shell