Sunday, February 27, 2022

How to install ChromeOS to your USB stick for your old PC

(1) Prepare an USB stick with at least 16G. I am using 64G for demo and you need this size to download and install Linux in ChromeOS. Your PC should x86_64 based computer with UEFI boot support and ave Intel gen 1 to 9 to download rammus recovery image. For detail requirements see here https://github.com/sebanc/brunch.

(2) For Windows OS, first install WSL2 and Ubuntu 20.04 and you must enable this in "Turn On Windows features on and off"

(3) Alternativey, you can use Linux machine with Ubuntu 20.04 to do this

(4) According to the Brunch USB guide The ChromeOS recovery image is based on your CPU of your PC.
For Intel
"rammus" is suggested for 1st gen -> 9th gen.
"volteer" is suggested for 10th & 11th gen.
11th gen (and some 10th gen) may need kernel 5.10
For AMD
"grunt" is suggested for Stoney Ridge & Bristol Ridge.
"zork" is suggested for Ryzen.
Ryzen 4xxx devices need kernel 5.10 when Brunch Framework boot up

(5) After setting up the Ubuntu user and password run these scripts to create the image file (e.g. rammus for USB 64G drive)
sudo apt update
sudo apt -y install pv cgpt tar unzip
mkdir rammus
cd rammus
wget https://github.com/sebanc/brunch/releases/download/r97-stable-20220121/brunch_r97_stable_20220121.tar.gz
tar xzvf brunch_r97_stable_20220121.tar.gz
wget https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_14388.61.0_rammus_recovery_stable-channel_mp-v2.bin.zip
unzip chromeos_14388.61.0_rammus_recovery_stable-channel_mp-v2.bin.zip
# 64G USB has only about 58G for actual usage, so the size parameter here is 58.
sudo bash chromeos-install.sh -src chromeos_14388.61.0_rammus_recovery_stable-channel_mp-v2.bin -dst /mnt/c/Users/Public/Downloads/chromeos_rammus_58g.bin -s 58


(6) Then use ChromeOS Recovery Utility to flash the images, Use local image in Settings and select the "C:/Users/Public/Downloads/chromeos_rammus_58g.bin" image. See here

(7) If you are lazy to create this image, you can use mine and download it from chromeos_rammus_58g.bin.zip (3.61GB). You don't need to unzip it for creation of USB flash drive in ChromeOS Recovery Utility or Rufus

(8) If your PC has secure boot enabled, either disable it (ig you have set the supervisor password) or import the key from USB. To enroll the key directly from a USB, select OK -> Enroll key from disk -> EFI-SYSTEM -> brunch.der -> Continue and reboot. Moreoover, enable of UEFI support and change the boot order to USB is needed in BIOS.

Friday, February 25, 2022

How to download and resize Chrome OS Flex Image for USB boot Install

While you can live boot Chrome OS Flex from the USB installer, Google recommends that you fully install it on devices. When you live-boot Chrome OS Flex, limited storage (4GB) is available because of the layout of Chrome OS Flex's partition table. To overcome this limitation, we have to resize the partition to fully utilise your USB storage space.

How to download and resize Chrome OS Flex Image to 20GB, which is suitable to be use on a 32GB USB drive.
# use a linux machine, or Windows WSL Ubuntu 20.04 # see here https://github.com/sebanc/brunch/blob/master/install-with-windows.md

shell script    Select all
sudo apt update sudo apt -y install pv cgpt tar unzip curl cloud-guest-utils mkdir -p ~/Downloads cd ~/Downloads # download ChromeOS Flex image based on this conf file https://dl.google.com/dl/edgedl/chromeos/recovery/cloudready_recovery.conf # curl -OL https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_14516.0.0_reven_recovery_dev-channel_mp-v2.bin.zip curl -OL https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_14574.0.0_reven_recovery_dev-channel_mp-v2.bin.zip unzip chromeos_14574.0.0_reven_recovery_dev-channel_mp-v2.bin.zip ls -lh chromeos_14574.0.0_reven_recovery_dev-channel_mp-v2.bin # 20G is seek=20971520 # 28G is seek=29360128 (there is only 28G for 32G USB stick) # 58G is seek=60817408 (there is only 58G for 64G USB stick) # don't do method 1 on removable HD # grow image method 1 dd if=/dev/zero of=chromeos_14516.0.0_reven_recovery_dev-channel_mp-v2.bin seek=20971520 obs=1024 count=0 # grow image method 2, slower but works on removeable HD # 58G is count=52452 (there is only 58G for 64G USB stick) expr 20 \* 1024 - 6940 # calculate 20G = 13540 expr 28 \* 1024 - 6940 # calculate 28G = 21732 expr 58 \* 1024 - 6940 # calculate 58G = 52452 dd if=/dev/zero bs=1M count=13540 >> ./chromeos_14574.0.0_reven_recovery_dev-channel_mp-v2.bin # rename the file mv chromeos_14574.0.0_reven_recovery_dev-channel_mp-v2.bin chromeosflex20g.bin # grow partition 1, growpart is part of cloud-guest-utils package growpart chromeosflex20g.bin 1 # show new data partition 1, start is 5152768 , size is now 36790239 (17G) cgpt show chromeosflex20g.bin | grep -B 5 STATE cgpt repair chromeosflex20g.bin



Then use ChromeOS Recovery Utility to flash the images, Use local image in Settings and select the chromeosflex20g.bin image.
See here



IMPORTANT
The final step is to put the USB drive to linux system and check the drive using
sudo fdisk -l
# e.g. the USB drive partition 1 is sda1

# first check
sudo e2fsck -f /dev/sda1
# then resize it
sudo resize2fs /dev/sda1


However, one of the limitations of live-boot USB is that the ChromeOS cannot be updated live. So your work has to be able to backup to Google Drive, Dropbox (using File System for Dropbox), OneDrive (using File System for OneDrive) or your LAN network share drive.

Tuesday, January 25, 2022

How to install vs code-server in Windows WSL2 and setup firewall rules to access from other LAN machines

(1) Start Ubuntu 20.04 of WSL2 and install code-server
curl -fsSL https://code-server.dev/install.sh | sh

(2) Modify bind IP address port settings and password of the code-server
Get Ubuntu IP address
ifconfig eth0 | grep 'inet '
Edit bind address and password in
~/.config/code-server/config.yaml

(3) start code-server in Ubuntu
code-server

(4) Modify firewall rule and add forward port in Windows using PowerShell with Admin Right. Create the following file vscode_server_port_wsl2.ps1 and run in PowerShell with Admin Right
.\vscode_server_port_wsl2.ps1
vscode_server_port_wsl2.ps1    Select all
# Get network information $network_information = bash.exe -c "ifconfig eth0 | grep 'inet '"; # Define ip address pattern $ip_address_pattern = "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"; # Get ip address $ip_address = $network_information -match $ip_address_pattern # Proceed if ip address is found if ($ip_address) { # Get remote address $remote_address = $matches[0]; } # Define rule name $rule_name = "VS Code Server (WSL2)"; # Define port for the VS Code Server - default is 8080 $port = 8080; # Check if rule exists $rule_exists = Get-NetFirewallRule -DisplayName $rule_name 2> $null; # Proceed if rule doesn't exists if (-Not $rule_exists) { # Add new inbound rule New-NetFirewallRule -DisplayName $rule_name -Direction Inbound -LocalPort $port -Protocol TCP -Action Allow } # Define listen address $listen_address = "0.0.0.0"; # Update ip address iex "netsh interface portproxy delete v4tov4 listenport = $port listenaddress = $listen_address"; iex "netsh interface portproxy add v4tov4 listenport = $port listenaddress = $listen_address connectport = $port connectaddress = $remote_address";

Do this in powershell with admin right.

Set-ExecutionPolicy Unrestricted -Force





(5) Test access of code-server from other machine in the LAN
Use browser to access this address and enter password as in
http://<IP address of your windows machine>:8080/

(6) Test access of code-server from VPN connection from Internet.
First use OpenVPN to connect to your home/office network
Then use browser to access
http://<IP address of your windows machine>:8080/

(7) If you have installed docker for Windows, this command will help you to install and run code-server in docker.
command prompt shell    Select all
# Testing on local host machine docker run --name code-server -p 127.0.0.1:8080:8080 -v "$HOME/.config:/home/coder/.config" -v "$HOME/:/home/coder/project" -e "USER=$env:UserName" -e "DOCKER_USER=$env:UserName" codercom/code-server:latest #or publish to the host machine IP address with port no 8081, to allow access from other LAN machines docker run --name code-server -p 8081:8080 -v "$HOME/.config:/home/coder/.config" -v "$HOME/:/home/coder/project" -e "USER=$env:UserName" -e "DOCKER_USER=$env:UserName" codercom/code-server:latest # stop container docker stop code-server # start container docker start code-server
run this command to get the password in config.yaml and then edit it of wanted.
docker exec -it code-server cat .config/code-server/config.yaml
or
type $HOME\.config\code-server\config.yaml
. . .

Thursday, January 13, 2022

Decompile and Recompile an Android APK using apktool

You need these tools to do the jobs

Android Studio (with build tools such as keytool, jarsigner)
apktool download from https://bitbucket.org/iBotPeaches/apktool/downloads/ and extract and rename to apktool.jar
apktool wrapper script https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/windows/apktool.bat
Java SE 8 JDK download from https://www.oracle.com/java/technologies/javase/javase8u211-later-archive-downloads.html
dex2jar download from https://sourceforge.net/projects/dex2jar/
JD_GUI download from http://jd.benow.ca/
smalidea download from https://github.com/JesusFreke/smalidea
Online Decompiler for apk https://appscms.com/apk-decompiler
jadx download from https://github.com/skylot/jadx/releases

apktool — tool for reverse engineering Android apk files. In this case we are using to extract files from apk and rebuild.
keytool — Java tool for creating keys/certs, that comes with the Java SE JDK.
jarsigner Java tool for signing JAR/APK files, that comes with the Java SE JDK.
zipalign — archive alignment tool, that comes with the Android SDK.
JD-GUI — To view java code
dex2jar — Converts Android dex files to class/jar files.
smalidea is a smali language plugin for AS and to edit the file in Android Studio
jadx — convert single smali file to java code to test the modification of smali

For smali syntax, please refer to this doc
https://programmer.help/blogs/smali-introduction-manual.html
or http://source.android.com/devices/tech/dalvik/dalvik-bytecode.html

Instructions:
First, Take any apk file and unpack(decompile) it. This will create an “application” directory with assets, resources, compiled code, etc.
# To decompile an apk
apktool d -r -s my_application.apk
or
apktool d my_application.apk

Then, you can use Android Studio to open the smali file and edit it. Use APKRepacker to test the single smali file conversion.

# To recompile(build) the apk
apktool b -f -d my_application -o my_application2.apk

After recompiling (building) the apk the new apk (my_application2.apk) will be generated in directory.

The APK must be signed before you run on your device. If you want an official key from google play signing key, you should register with https://play.google.com/console/u/0/signup first and pay $25 registration key
Before signing an apk, create a self-signing key if you don't have an existing one from google play. If prompted for a password, create your own password.
These tools are installed withn JDK e.g. in "c:\Program Files\Java\jdk1.8.0_301\bin\". Add this to the environment PATH.

macOS binary are here /Applications/Android Studio.app/Contents/jre/Contents/Home/bin

# To generate a key. And remember the store password
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000

# if want to generate SHA256withRSA keystore (in order to get rid of the warning of security when signing with SHA1), use this command
keytool -genkey -v -keystore my-release-key256.keystore -alias mykey256 -sigalg SHA256withRSA -keyalg RSA -keysize 2048 -validity 10000 -deststoretype pkcs12

Now sign the APK with the key:
# Sign the apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application2.apk alias_name

# if Sign with SHA256withRSA (in order to get rid of the warning of security when signing with SHA1)
jarsigner -verbose -sigalg SHA256withRSA -keystore my-release-key256.keystore my_application2.apk mykey256

# Verify apk
jarsigner -verify -verbose -certs -keystore my-release-key.keystore my_application2.apk

# Verify apk with SHA256withRSA
jarsigner -verify -verbose -certs -keystore my-release-key256.keystore my_application2.apk

# Finally, the apk must be aligned for optimal loading:
zipalign is installed with Android SDK e.g. in c:\Users\User\AppData\Local\Android\Sdk\build-tools\28.0.3\zipalign.exe Add this to the environment PATH.
zipalign -v 4 my_application2.apk my_application2-aligned.apk
you have a my_application2-aligned.apk file, which you can install onto your device.


Other useful tools using command prompt under Windows
# Command Prompt to list android virtual devices %USERPROFILE%\AppData\Local\Android\Sdk\emulator\emulator -list-avds
# PowerShell command to list android virtual devices & $env:UserProfile\AppData\Local\Android\Sdk\emulator\emulator -list-avds
# Command Prompt to list android virtual device in background
start /b %USERPROFILE%\AppData\Local\Android\Sdk\emulator\emulator -avd Pixel_3a_API_30_x86 -netdelay none -netspeed full
# Command Prompt to show running emulator devices
%USERPROFILE%\AppData\Local\Android\Sdk\platform-tools\adb devices
# Command Prompt to attach to running emulator device shell
%USERPROFILE%\AppData\Local\Android\Sdk\platform-tools\adb -s emulator-5554 shell
# Command Prompt to install apk to running emulator device
%USERPROFILE%\AppData\Local\Android\Sdk\platform-tools\adb -s emulator-5554 install %USERPROFILE%\Downloads\my_application2-aligned.apk
export ANDROID_HOME="%USERPROFILE%\AppData\Local\Android\Sdk"




Other useful tools using Terminal under macOS
# macOS Terminal to list android virtual devices $HOME/Library/Android/sdk/emulator/emulator -list-avds
# macOS Terminal to show running emulator devices
$HOME/Library/Android/sdk/platform-tools/adb devices
# macOS Terminal to attach to running emulator device shell
$HOME/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell
# macOS Terminal to install apk to running emulator device
$HOME/Library/Android/sdk/platform-tools/adb -s emulator-5554 install ~/Downloads/my_application2-aligned.apk
export ANDROID_HOME="$HOME/Library/Android/sdk" export JAVA_HOME="/Applications/Android Studio.app/Contents/jre/Contents/Home" export PATH=$ANDROID_HOME/build-tools/30.0.3:$ANDROID_HOME/platform-tools:$JAVA_HOME/bin:$PATH


Setup sdk and decompile tools in WSL2 Ubuntu 20.04    Select all
#!/bin/bash sudo apt install -y libarchive-tools export ANDROID_SDK_TOOLS_VERSION=6858069 export ANDROID_SDK_TOOLS_CHECKSUM=87f6dcf41d4e642e37ba03cb2e387a542aa0bd73cb689a9e7152aad40a6e7a08 export ANDROID_HOME="/opt/android-sdk-linux" export ANDROID_SDK_ROOT="/opt/android-sdk-linux" export ANDROID_DECOMPILE_TOOLS="$ANDROID_HOME/Decompile" curl -s https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip > ./tools.zip && echo "$ANDROID_SDK_TOOLS_CHECKSUM ./tools.zip" | sha256sum -c && sudo mkdir -p $ANDROID_HOME && sudo chown $(id -u):$(id -g) $ANDROID_HOME && unzip -qq ./tools.zip -d $ANDROID_HOME && rm -v ./tools.zip sudo mkdir -p $ANDROID_HOME/licenses/ && sudo chown $(id -u):$(id -g) $ANDROID_HOME/licenses && echo "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > $ANDROID_HOME/licenses/android-sdk-license && echo "84831b9409646a918e30573bab4c9c91346d8abd\n504667f4c0de7af1a06de9f4b1727b84351f2910" > $ANDROID_HOME/licenses/android-sdk-preview-license --licenses && yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --licenses --sdk_root=${ANDROID_SDK_ROOT} curl -OL https://raw.githubusercontent.com/MobileDevOps/android-sdk-image/master/packages.txt $ANDROID_HOME/cmdline-tools/bin/sdkmanager --update --sdk_root=${ANDROID_SDK_ROOT} && while read -r pkg; do PKGS="${PKGS}${pkg} "; done < $HOME/packages.txt && $ANDROID_HOME/cmdline-tools/bin/sdkmanager $PKGS > /dev/null --sdk_root=${ANDROID_SDK_ROOT} curl -OL https://nchc.dl.sourceforge.net/project/dex2jar/dex2jar-2.0.zip && unzip dex2jar-2.0.zip -d $ANDROID_HOME/Decompile && chmod +x $ANDROID_HOME/Decompile/dex2jar-2.0/*.sh && rm -v dex2jar-2.0.zip mkdir -p $ANDROID_DECOMPILE_TOOLS/apktool && pushd $ANDROID_DECOMPILE_TOOLS/apktool && curl -OL https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_2.6.0.jar && ln -s apktool_2.6.0.jar apktool.jar && curl -OL https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool && chmod +x apktool && popd curl -OL https://github.com/skylot/jadx/releases/download/v1.3.3/jadx-1.3.3.zip && unzip jadx-1.3.3.zip -d $ANDROID_DECOMPILE_TOOLS/jadx && rm -v jadx-1.3.3.zip mkdir -p $ANDROID_DECOMPILE_TOOLS/java2smali && curl -OL https://github.com/izgzhen/java2smali/releases/download/1.1/dist.zip && bsdtar xvf dist.zip --strip-components=1 -C $ANDROID_DECOMPILE_TOOLS/java2smali/ && rm -v dist.zip mkdir -p $ANDROID_DECOMPILE_TOOLS/java2smali && pushd $ANDROID_HOME/Decompile/java2smali && curl -OL https://github.com/JesusFreke/smali/releases/download/v2.0b6/smali-2.0b6.jar && curl -OL https://github.com/JesusFreke/smali/releases/download/v2.0b6/baksmali-2.0b6.jar && curl -OL https://raw.githubusercontent.com/JesusFreke/smali/master/scripts/smali && curl -OL https://raw.githubusercontent.com/JesusFreke/smali/master/scripts/baksmali && popd pushd $ANDROID_DECOMPILE_TOOLS/java2smali && ln -s baksmali-2.0b6.jar baksmali.jar && ln -s smali-2.0b6.jar smali.jar && chmod +x baksmali && chmod +x smali && popd # Then append these lines to ~/.profile export ANDROID_HOME="/opt/android-sdk-linux" export ANDROID_SDK_ROOT=$ANDROID_HOME export ANDROID_DECOMPILE_TOOLS=="$ANDROID_HOME/Decompile" export PATH=$ANDROID_HOME/cmdline-tools:$ANDROID_HOME/cmdline-tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools/30.0.3:$ANDROID_DECOMPILE_TOOLS/jadx/bin:$ANDROID_DECOMPILE_TOOLS/java2smali:$ANDROID_DECOMPILE_TOOLS/apktool:$ANDROID_DECOMPILE_TOOLS/dex2jar-2.0:$PATH



Friday, November 12, 2021

Termux pkg update error on Android devices

If you have pkg update error on your old installation of Android devices

pkg install termux-tools
termux-change-repo

Tuesday, July 13, 2021

Personal Installation Guide for new Chromebook

(1) For new chromebook, there is free Google One 100GB and DropBox 100GB both for 1 year. See here. https://www.google.com/chromebook/perks/

(2) To enable google drive on Files app of Chrome OS, Bottom right clock -> Settings Icon -> Advanced -> Files -> Disconnect Google Drive account set to off.

(3) To enable DropBox on Files app of Chrome OS, Install DropBox app from Android Play Store and login dropbox.

(4) To enable smb share on Files app of Chrome OS, Open Files App and select the 3 dots menu on top right and Choose "Service" and then "SMB File Share".

(5) To enable OneDrive (readonly) on Files app of Chrome OS, Install OneDrive App from Google Play Store.

(5.1) How to share files or Google Drive with Linux apps on Chrome OS
    Select all
(a) Open the My Files app. (b) From within that app, locate the directory housing the documents you want accessible by the installed Linux apps. (c) Right-click the folder in question and then select Share With Linux. The sharing happens immediately. (d) Google Drive is in /mnt/chromeos/GoogleDrive/MyDrive/ (e) MyFiles is in /mnt/chromeos/MyFiles/




(6) If you cannot install Chrome OS Linux Beta Crostini now, install Termux App as a temporary solution, Download the apk file from here https://f-droid.org/en/packages/com.termux/ (Google Play Version was outdated).

(7) How to install Linux Web Development Environment on Chrome OS, see here https://www.youtube.com/watch?v=3CWUAisN-vo

shellscript.sh    Select all
# nodejs dependencies sudo apt install gnupg2 # install nodejs v14 and npm v6 curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - sudo apt-get install -y nodejs # try it out! Sweep for mines sudo apt install libnss3 git clone https://github.com/GoogleChromeLabs/proxx.git cd proxx npm install npm run build npm run serve # Install React npm install create-react-app # Create a React app npx create-react-app hello-world-react cd hello-world-react npm start # Install Angular npm install @angular/cli # Create an Angular app ng new my-angular-project cd my-angular-project ng serve # Docker Dependencies sudo apt install ca-certificates software-properties-common # Docker repository curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" # Install Docker-ce sudo apt update sudo apt install docker-ce docker-ce-cli containerd.io # Install docker client only and connect to docker desktop of windows machine cd $HOME wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.7.tgz tar xzvf docker-20.10.7.tgz ./docker/docker -H tcp://10.0.1.78:2375 images # Or simply add the corresponding variables to ~/.bashrc export DOCKER_HOST=tcp://192.168.1.78:2375 export PATH=$PATH:~/docker # # To detach the docker tty without exiting the shell, use the escape sequence Ctrl-p + Ctrl-q + Ctrl-c # # for docker desktop on mac, see this solution to open tcp port https://stackoverflow.com/questions/39411126/access-docker-daemon-remote-api-on-docker-for-mac # on Mac machine brew install socat socat TCP-LISTEN:2375,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock &




(8) System requirement for Android Studio for Chrome OS is 8GB RAM and Intel i5 CPU or above.

(9) Flatpak applications can be installed on Chrome OS with the Crostini Linux compatibility layer. See here https://flatpak.org/setup/Chrome%20OS/

(10) Popular shortcuts https://support.google.com/chromebook/answer/183101?hl=en

(11) How to access onedrive in linux partition

shellscript.sh    Select all
# download latest deb package from https://launchpad.net/~jstaf/+archive/ubuntu/onedriver/+packages wget https://launchpad.net/~jstaf/+archive/ubuntu/onedriver/+files/onedriver_0.11.1-1_amd64.deb # install the deb package in linux sudo apt install ./onedriver_0.11.1-1_amd64.deb # reference from https://github.com/jstaf/onedriver # create mount point mkdir -p ~/onedrive # determine the service name export SERVICE_NAME=$(systemd-escape --template onedriver@.service --path ~/onedrive) # mount onedrive systemctl --user daemon-reload systemctl --user start $SERVICE_NAME # automatically mount onedrive when you login systemctl --user enable $SERVICE_NAME # query the status of onedriver systemctl --user status $SERVICE_NAME # check onedriver's logs for the current day journalctl --user -u $SERVICE_NAME --since today




P.S. if you cannot install Chrome OS Linux Beta Crostini, please refer to the reason in this article https://chromeunboxed.com/google-pauses-chrome-os-update-breaks-linux-container/



Saturday, July 3, 2021

How to install Windows 11 WSL2 GUI App

(1) If you have unspported hardware, please follow this guide to install Dev Channel Preview of Windows 11 -> update-any-pc-to-windows11

(2) After installed Windows 11 Preview, Start Windows Terminal (install from Microsoft Store) in Administrative Role. The following commands are entered using Windows Terminal with elevated admin rights.

(3) wslconfig /u ubuntu # if wsl already installed previously in Windows 10 and want to remove old ubuntu distro

(4.1) wsl --update # if wsl already installed previously in Windows 10 and needs update to WSLg

(4.2) wsl --shutdown # wsl needs to be restarted after update

(5) wsl --install -d Ubuntu # this will install WSLg on Windows 11 and the new Ubuntu 20.04 instance

(6) sudo apt install audacity # this will install audacity linux gui app for ubuntu

(7) Use Windows search function to search for Audacity (Ubuntu) App to start the linux GUI App under Windows 11.

(8) You can even install and run Chrome, Edge, or Teams under Ubuntu on Windows 11 with WSLg.

(9) To install flatpak for GUI App

Shellscript   Select all
sudo apt install flatpak # add repo flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo # search app and install flatpak search gimp flatpak install flathub org.gimp.GIMP