microsoft / microsoft/WSL

.wslconfig option to cleanly shutdown long-running WSL processes on Windows shutdown

Open
#6,872 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
C++
Stars
33.7k
Forks
1.8k
Avg merge
3d 17h
Merged PRs (30d)
116

Description

Is your feature request related to a problem? Please describe.

When Windows shuts down, WSL is abruptly terminated. If you have long-running processes (systemd, servers, or just long jobs) running in WSL at the time that Windows shuts down, these processes do not get a chance to exit cleanly. While this can be worked around by manually terminating these processes when the Windows shutdown is user-initiated, it is obviously more of a problem for automatic shutdowns due to update installs, etc.

Describe the solution you'd like
I would like an option to be provided in .wslconfig or wsl.conf to specify a command/script to be executed inside WSL/a particular WSL distro when Windows shutdown runs, and which will delay the continuation of Windows shutdown until such time as the command/script returns, indicating that long-running processes inside WSL have been shut down cleanly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names .wslconfig and wsl.conf but no source files, tests, or entry points. Start by reviewing how those configuration files are documented and handled, then trace the WSL and Windows shutdown lifecycle. Done would require a defined configuration format and verified clean shutdown behavior for targeted distributions.

Written by the indexing model from the issue text.

Assessment

Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.