Keeping Your Windows Subsystem for Linux Up-To-Date

mr.smashy
3 min readMar 20, 2021

Because cron and unattended-upgrades don’t work

WSL is a Great Tool for the Windows Development Environment

The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.

I’m a big fan of WSL and Windows Terminal. I have direct access to a Linux shell from my Windows desktop, allowing me to utilize the dev and system tools of Linux without messing with a VM. But sometimes it just simple things. Windows has a host of good shell commands, and PowerShell is flexible, but sometimes I just want to use dig.

One issue with WSL is that, like any Linux distro, it needs updates. When Baron Samedit was disclosed, I needed to update my sudo just like any other Linux user. But setting up a cron job to schedule updates isn’t really feasible; Since there is no boot process, the cron daemon is not launched. If you make it run it only runs while the shell is open. The same goes for unattended-upgrades, no cron daemon.

So What Do?

Have Bash.exe run updates outside the shell. You need to allow apt-get to run without sudo, and setup a scheduled task, so there are a couple steps.

In your bash shell, type sudo visudo and add the following to the bottom of the file:

--

--

mr.smashy
mr.smashy

Written by mr.smashy

Cybersecurity architect. Security dev and researcher. Infosec nerd. Linux enthusiast. All opinions and views are my own. Polite, professional, prepared.

No responses yet