microsoft / microsoft/WSL

WSL should at least very verbosely warn that distro unregister will destroy /home

Open
#8,466 2 comments 6 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.
Currently if you wsl.exe --unregister a distro on WSL2 (did not test behavior on WSL1) all files on .vhd with its root filesystem will be gone too. As people usually keep their e.g. source code, configs, notes, etc. inside the .vhd because of native ages unresolved host filesystem slowness it would be great if wsl.exe gave more verbose warning about that than blurry Unregisters the distribution and deletes the root filesystem description (had to explain to someone who lost all their work that root filesystem is literally / and /home was on it).

C:\> wsl.exe --help
...
    --unregister <Distro>
        Unregisters the distribution and deletes the root filesystem.
...
C:\> wsl.exe --unregister Ubuntu
C:\> Unregistering...
C:\>

Describe the solution you'd like
I'd at least want to get verbose prompt (skippable with --force)

C:\> wsl.exe --help
...
    --unregister <Distro>
        Unregisters the distribution and irreversibly deletes all files on its filesystem.
...
C:\> wsl.exe --unregister Ubuntu
This will irreversibly remove Ubuntu and all its files, are you sure (Y/N): ...

Ideally, there should be an additional options for wsl.exe to:

  • unregister but keep root filesystem .vhd (such option should be mentioned in that verbose warning, .vhd should be mountable from e.g. other distro)
  • maybe during installation allow mounting separate .vhd for /home that would be always retained by default and only deleted if said so?

Describe alternatives you've considered

  • using /mnt/c/Users/user as persistent home for all distros (with benefit of being able to share configs across distributions AND Windows, unfortunately impossible because of WSL2 slowness accessing native filesystem and problems with symlinks on Windows side).

Additional context
As WSL2 grows more and more popular, UX should be smooth and without unexpected surprises. Nowadays not everyone who uses Linux knows what root filesystem is and what consequences has deleting one.

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

Start by locating the wsl.exe command-line handling for --help and --unregister, then review the existing wording and execution flow. Done means the unregister experience clearly explains that all files on the distro filesystem are irreversibly deleted, with the requested confirmation or force behavior defined and covered by the relevant CLI checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, operating-systems
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.