Skip to main content

WSL Clean Setup

Overview

This guide describes a clean installation workflow using WSL2 (Linux) without relying on a prior Windows-based setup or migration.

This approach will create the project in a linux subsystem on Windows, making execution of jobs much faster. Experience shows a reduction of the time it takes for a job to execute to similar levels when using native linux.

It is assumed Docker Desktop is installed. If you haven't, do it before Step 0.

It is recommended to do the full project setup on wsl, as else you have copies of the projects which may create issues further down the line. In case you already have the project on windows, do the following Step 0.

Step 0: (Optional) Clean Windows Environment

Stop and Remove Docker Resources

Run in PowerShell:

docker ps
docker stop $(docker ps -q)
docker system prune -a --volumes

When using this method, you should use VS Code in wsl directly, so you can get rid of the project folder on Windows.

Step 1: WSL installation and setup for development

Execute in powershell:

wsl --install

This will install ubuntu as a subsystem. Afterwards type wsl and set your linux username and password. Go into Docker Desktop afterwards to Settings → Resources → WSL Integration and enable "Ubuntu" (it should be disabled).

As this is a whole new subsystem, you will need to create a new key for your GitLab Account - just execute these commands in powershell while in wsl:

sudo apt update
sudo apt install git

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

ssh-keygen -t ed25519 -C "your@email.com"

cat ~/.ssh/id_ed25519.pub

Afterwards add the generated key to ur GitLab Account (Profile → Preferences → SSH Keys)

When this is done, execute this command for permissions for the user:

sudo usermod -aG docker $USER
newgrp docker

Afterwards you can clone the Firmware Vault Folder into wsl:

cd ~
git clone ssh://git@gitlab.informatik.hs-augsburg.de:2222/firmware-analysis/firmware_vault.git firmware_vault
cd firmware_vault

When it is done cloning, you need to use the Linux init script - it is recommended to activate the dev mode, it will ask y/no - pick yes:

chmod +x init_script.sh
./init_script.sh

After it is done, you can start the build just like on windows:

cd docker_compose_dir
docker compose up -d --build

Step 2: VSCode in WSL

Finally to use VSCode in wsl, you need to install the WSL Extension on Visual Code Studio. Other Coding Environments work as well, but VSCode is easy to use. After you installed the extension, you can just start VSCode in the WSL Terminal by typing

code .

This will start VSCode from your current folder, so make sure to navigate to ~/firmware_vault. If your VSCode didn't log in to ur Git yet, make sure to do this for Code management.

Step 3: Daily usage

When using WSL, make sure to start Docker Desktop every time first. Then open PowerShell and type wsl, after navigate to ~/firmware_vault and type "code ." Git Commits etc work just like VSCode on Windows from here on.