Skip to content

Instantly share code, notes, and snippets.

@BusterNeece
Last active August 12, 2022 04:32
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save BusterNeece/ce9e28adcec55504f3ed7d1fdc8ef573 to your computer and use it in GitHub Desktop.
Save BusterNeece/ce9e28adcec55504f3ed7d1fdc8ef573 to your computer and use it in GitHub Desktop.
My WSL2 Ubuntu 20.04 Environment

My local Ubuntu 20.04 WSL2 setup.

Enable and Install WSL2

From Windows, as admin:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Install the latest WSL2 kernel.

Restart, then:

wsl --set-default-version 2

Set up X410 Settings

  • Install X410 from Windows Store
  • Launch X410
  • Right click tray menu, click "Allow Public Access", then allow through Windows Firewall

Set up Ubuntu 20.04

Initial setup inside Ubuntu Bash:

sudo apt-get update
sudo apt-get upgrade

# Installing common deps
sudo apt-get install git gpg vim tasksel

# Set up desktop environment
sudo tasksel

# Select "Ubuntu minimal desktop" in tasksel.

# Install the Dotnet Core framework repository
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

# Install Genie (for creating a pseudo-systemd-compatible environment to run in)
curl -s https://packagecloud.io/install/repositories/arkane-systems/wsl-translinux/script.deb.sh | sudo bash

sudo apt install -y systemd-genie
  • Create file desktop.sh in user root (below).
  • chmod a+x desktop.sh

Launching

  • Create a file launch-desktop.bat somewhere on the host OS (perhaps Desktop); contents listed below.
  • Run the batch script to start up.

Shutting Down

Shut down the WSL2 instance by running:

wsl -t Ubuntu-20.04
#!/bin/bash
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0;
export XDG_SESSION_TYPE="x11"
export XDG_RUNTIME_DIR=~/xdg
export XDG_SESSION_CLASS="user"
export XDG_SESSION_DESKTOP=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export DESKTOP_SESSION=ubuntu
export GDMSESSION=ubuntu
gnome-session
start /B x410.exe /desktop
ubuntu2004.exe run "genie -c ~/desktop.sh"
@avoidik
Copy link

avoidik commented Mar 29, 2021

two more actions will be needed to be able to start the genie process on ubuntu 20.04

sudo systemctl mask multipathd.socket
sudo systemctl mask systemd-remount-fs.service

@HuStmpHrrr
Copy link

HuStmpHrrr commented May 23, 2021

I am not sure whether the comment above still applies, as arkane-systems/genie#122 is closed.

and I confirm as of today the previous two steps are still necessary.

the procedure of installing genie has changed and the one shown here no longer works: https://github.com/arkane-systems/genie#debian

@brccabral
Copy link

brccabral commented Aug 7, 2021

I had to mask these too

sudo systemctl mask multipathd.service
sudo systemctl mask systemd-modules-load.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment