Skip to content

WSL: which version of Ubuntu to upgrade to (and how)? #31043

Closed

Description

@severinbeauvais

Developers using Windows desktops typically use WSL2 (Windows Subsystem for Linux v2) to build and run the FE and BE services. Within WSL2, typically Ubuntu (Linux distro) is installed.

Many devs are still using the previous Long-Term Support (LTS) version of Ubuntu -- v20.04.6. Standard support for this version expired in May 2025 although Extended Security Maintenance (ESM) is available until April 2030 (with a Ubuntu Pro subscription). Ref

image.png

Hence, devs should upgrade to a current LTS version -- v22.04.5 (standard support until April 2027) or v24.04.3 (standard support until April 2029).

Impact of not doing this: TBD

To do:

  • Decide which version to upgrade to. Note that the SRE front-end CI script calls for ubuntu-latest.
  • Provide instructions for upgrading from v20.04.6 to the new version.

See also #30842, which talks about which Node and npm versions to use.

Analysis

Our SRE front-end CI/CD scripts use Ubuntu 24.04.3, so that is the recommended version for developer workstations as well.

Ie,
image.png

Activity

  1. added
    Entities Team
    on Oct 21, 2025
  2. severinbeauvais commented on Oct 21, 2025

    @severinbeauvais
    CollaboratorAuthor
  3. thorwolpert commented on Oct 21, 2025

    @thorwolpert
    Collaborator

    This seems mostly a local thing?
    Staff devs should follow what the core gov't decides as they get some level of support from within the larger group.
    Contractors, we're responsible for our own thing.
    Deliverable targets are set by the SRE team, so as long as the deliverable runs successfully in the CI it is accepted.

  4. severinbeauvais commented on Oct 22, 2025

    @severinbeauvais
    CollaboratorAuthor

    @thorwolpert Yes, I agree: it's "my" problem. Still, I think it will be valuable to post my findings (how-to) here for others to follow.

    If this takes longer than a couple of hours then I'll do it on my own time.

  5. severinbeauvais commented on Oct 27, 2025

    @severinbeauvais
    CollaboratorAuthor

    Steps to upgrade

    Step 0: Check your current Ubuntu version:
    image.png

    Step 1: upgrade from Ubuntu 20.04 to 22.04

    Step 2: upgrade from Ubuntu 22.04 to 24.04

    Example instructions:
    https://www.tecmint.com/upgrade-ubuntu-20-04-to-24-04/#:~:text=You%20must%20first%20upgrade%20from,follow%20if%20done%20in%20order.

    Another example that includes a backup step:
    https://dev.to/equiman/upgrade-ubuntu-version-on-wsl-3h10

    My issue

    On the last step (do-release-upgrade), I always got this (even after trying some of the workarounds suggested in different places):

    image.png

    My solution

    So I decided to follow the "Delete and reinstall" step here:
    https://askubuntu.com/questions/1428423/upgrade-ubuntu-in-wsl2-from-20-04-to-22-04

    1. backup your config or home folder or entire system
    2. run Powershell
    3. list current distros: wsl -l -v
    4. remove existing distro: wsl --unregister Ubuntu-20.04
    5. list available distros: wsl.exe --list --online
    6. install new distro: wsl.exe --install Ubuntu-24.04

    image.png

    Then reinstall all necessary packages:

    # Install build libraries and tools.
    sudo apt upgrade
    sudo apt install build-essential
    sudo apt install libbz2-dev libffi-dev libreadline-dev libsqlite3-dev libssl-dev zlib1g-dev
    sudo apt install npm
    
    # Install nvm and set to Node 20.
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
    nvm install --lts
    nvm install 20
    nvm use 20
    
    # Install Pyenv, pnpm (previous version) and Lerna (if needed).
    curl https://pyenv.run | bash
    sudo npm install -g pnpm@9
    sudo npm i -g lerna@4.0.0
    
    # Fix xdg-utils that can't find a browser.
    sudo apt-get install --reinstall xdg-utils
    ln -s /mnt/c/'Program Files'/Google/Chrome/Application/chrome.exe
    export BROWSER=~/chrome.exe
    
    # Or just install wslu.
    sudo apt install wslu
    
    # Install GitHub CLI (gh).
    (type -p wget >/dev/null || (sudo apt update && sudo apt install wget -y)) \
    	&& sudo mkdir -p -m 755 /etc/apt/keyrings \
    	&& out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \
    	&& cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
    	&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
    	&& sudo mkdir -p -m 755 /etc/apt/sources.list.d \
    	&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
    	&& sudo apt update \
    	&& sudo apt install gh -y
    gh repo set-default
    gh auth login
    
    # Install the repos you need
    cd ~/repos
    gh repo clone bcgov/bcregistry
    gh repo clone bcgov/bcrs-shared-components
    gh repo clone bcgov/business-ar
    gh repo clone bcgov/business-create-ui
    gh repo clone bcgov/business-dashboard-ui
    gh repo clone bcgov/business-edit-ui
    gh repo clone bcgov/business-filings-ui
    gh repo clone bcgov/business-ui
    gh repo clone bcgov/business-schemas
    gh repo clone bcgov/entity
    gh repo clone bcgov/lear
    gh repo clone bcgov/namerequest
    gh repo clone bcgov/namex
    gh repo clone bcgov/sbc-auth
    gh repo clone bcgov/sbc-common-components
    gh repo clone bcgov/search-ui
    
    # You may also need to update .git/config in each repo.
    # You may also need to install your SSH certificates (if you use them).
    # You may also need to create local .env files in each repo.
    
  6. severinbeauvais commented on Oct 29, 2025

    @severinbeauvais
    CollaboratorAuthor

    Per Patrick (Oct 28, 2025):

    image.png

  7. OlgaPotiagalova commented on Nov 18, 2025

    @OlgaPotiagalova
    Collaborator

    It was communicated to the dev team that each developer is responsible for maintaining and upgrading their own environment. This ticket can be closed.

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

Metadata

Metadata

Labels

Entities Teamtechdebt

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions