Mastodon
//Ris Adams;

Automatically Update WSL on Startup

Cover image for Automatically Update WSL on Startup.

How to keep your WSL instance up to date

If you are like me, you prefer to always keep your packages as up-to-date as possible. You also like to automate things when possible to avoid repetitive admin tasks.

This script will call your default WSL instance 1, and update/upgrade all packages.

wsl -u root -e apt update
wsl -u root -e apt upgrade -y

Once this script is saved, use the Windows Task Scheduler to automate its execution. I have it set to run at login, and once per week.

  1. I use Ubuntu, adjust as needed. You can also adjust to use a specific distro if required. I only use a single instance. 

§