Skip to content

Distribution Keep-alive ​

Many users new to WSL2 run into a "puzzle": the Linux is installed, but why does it "shut itself down" a while after you close the terminal? Why can't it just keep running?

This article first describes this behavior, then explains why Microsoft designed WSL this way, and finally shows how to use WSL Dashboard to start a keep-alive Linux distribution.

1. Current Behavior: Linux Shuts Down Soon After the Terminal Is Closed ​

Have you experienced the following:

  1. Open a terminal for a Linux distribution, and Linux starts automatically — no commands needed;
  2. After closing the terminal window, Linux doesn't keep running — it's automatically shut down about 60 seconds later;
  3. Open the terminal again, and Linux starts automatically once more — and so the cycle repeats.

NOTE

WSL2's default "idle timeout" is about 60 seconds: when there are no running processes in the distribution (for example, when you've closed all terminals), the WSL virtual machine shuts down automatically to free up system resources such as memory.

This behavior is WSL2's default design — neither a fault nor an error.

2. Why Did Microsoft Design WSL This Way? ​

2.1 WSL2 Is Essentially a Lightweight Virtual Machine ​

WSL2 runs a full Linux kernel in a Hyper-V lightweight virtual machine (utility VM). Every running distribution genuinely consumes memory resources. If all distributions stayed resident in the background, a machine running several distributions at once would waste hundreds of MB or even GB of memory, slowing the whole system down.

2.2 A Design Philosophy of Allocating Resources on Demand ​

Windows' design philosophy is "allocate resources on demand, release what's not in use":

  • For most users: opening a terminal = needing Linux; closing a terminal = not needing it for now;
  • Only a small number of users need Linux running 7×24.

That's why WSL uses a "start on demand, stop when idle" strategy, returning resources such as memory to the system automatically when they aren't needed. It's like turning off the light when you leave a room: power-efficient, but inconvenient for users who need the light to stay on (persistent services) — and that's exactly where the keep-alive need comes from.

TIP

If you need Linux to keep running (e.g. deploying services, running scheduled tasks, hosting a dev server, etc.), read the next section and use WSL Dashboard to keep your distribution alive.

3. Starting a Keep-alive Linux with WSL Dashboard ​

WSL Dashboard provides two simple ways to keep your Linux distribution running.

Method 1: Click the "Start" button ​

In the "Installed Linux distributions" list in WSL Dashboard:

  1. Find the distribution you want to keep alive;
  2. Click the "Start" button on that distribution's row.

After clicking, the distribution wakes up immediately and keeps running; as long as you don't stop it yourself, it won't be shut down for idling. This method suits temporary keep-alive scenarios where you need Linux running "now".

Method 2: Check "Start this distribution automatically when Windows starts" ​

In the "Installed Linux distributions" list in WSL Dashboard:

  1. Click the "Settings" button on the target distribution's row to open the settings dialog;
  2. In the dialog, check "Start this distribution automatically when Windows starts";
  3. Save the settings.

Once checked, the distribution starts automatically every time Windows boots/signs in, with no manual action needed — "alive from boot". This method suits scenarios where Linux needs to be online long-term (such as dev servers or resident services).

TIP

  • Only need it temporarily → use Method 1 (click "Start");
  • Need it online long-term → use Method 2 (check "Start this distribution automatically when Windows starts").