如何在 Windows 上重置我的 Ubuntu 安装?

Car*_*lin 34 windows-subsystem-for-linux

我已经在我的机器上安装了适用于 Windows 的 Linux 子系统。它工作得很好!

从那以后,我对我的安装做了一些难以形容的事情。什么都不起作用了。我如何从头开始?

Qwe*_*rty 25

您可以从设置中重置 Ubuntu,只需在开始菜单中找到它,右键单击转到App settings,然后按reset按钮即可。

在开始时找到 ubuntu

从设置重置

  • 妈的……没想到这么直接! (4认同)
  • 结尾为:“错误代码:Wsl/Service/CreateInstance/MountVhd/ERROR_FILE_NOT_FOUND” (2认同)

Car*_*lin 19

打开命令提示符(AKA cmd.exe),然后输入lxrun /uninstall. 这应该会擦除您的 Ubuntu 映像。

完成后,您可以使用lxrun /install.

参考:


mur*_*uru 8

使用新的发行版特定商店应用程序,例如

C:\> ubuntu /?
Launches or configures a linux distribution.

Usage:
    <no args>
      - Launches the distro's default behavior. By default, this launches your default shell.

...

    clean
      - Uninstalls the distro. The appx remains on your machine. This can be
        useful for "factory resetting" your instance. This removes the linux
        filesystem from the disk, but not the app from your PC, so you don't
        need to redownload the entire tar.gz again.
Run Code Online (Sandbox Code Playgroud)

所以,ubuntu clean应该够了。

如果ubuntu clean失败,则您必须从商店中卸载该应用程序并重新安装。参见WSL #2387


vla*_*don 8

WSL 2 之后就很简单了:

wsl --unregister Your_Ubuntu_distro
Run Code Online (Sandbox Code Playgroud)

如何获取发行版名称?

wsl --list
Run Code Online (Sandbox Code Playgroud)

根据https://docs.microsoft.com/en-us/windows/wsl/basic-commands

注意:一旦取消注册,与该发行版相关的所有数据、设置和软件都将永久丢失。从商店重新安装将安装发行版的干净副本。例如, wsl --unregister Ubuntu 将从 WSL 中可用的发行版中删除 Ubuntu。运行 wsl --list 将显示它不再列出。

您可能需要在取消注册发行版之前备份您的主目录和其他数据。