重裝Windows 10上的Linux子系統

之前聽說Windows 10上面可以裝Linux了,一時興起,就搗鼓了起來,長時間不用了,結果又忘記root密碼。哎,老了,記不住事情了。所以就上網查了一下如何卸載Linux子系統,再寫一篇筆記吧,免得以後又忘記了。

打開CMD,輸入lxrun,就會提示這條命令的使用方法,見下:

C:\Users\admin>lxrun
Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore

Usage:
    /install - Installs the subsystem
        Optional arguments:
            /y - Do not prompt user to accept or create a subsystem user
    /uninstall - Uninstalls the subsystem
        Optional arguments:
            /full - Perform a full uninstall
            /y - Do not prompt user to confirm
    /setdefaultuser - Sets the default subsystem user. If the user account does not exist it will be created.
        Optional arguments:
            username - Supply the username
            /y - If username is supplied, do not prompt to create a password

輸入:lxrun /uninstall 就可以開始卸載原來的Linux子系統了。

C:\Users\admin>lxrun /uninstall
Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore

This will uninstall Ubuntu on Windows.
This will remove the Ubuntu environment as well as any modifications and new applications with the exception of:

C:\Users\admin\AppData\Local\lxss\home
C:\Users\admin\AppData\Local\lxss\root

Type "y" to continue: y
Uninstalling...

再輸入bash查看一下,驗證Ubuntu已經被卸載。

C:\Users\admin>bash
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
Press any key to continue...

接下來安裝Ubuntu Linux,輸入命令:lxrun /install

C:\Users\admin>lxrun /install
Warning: lxrun.exe is only used to configure the legacy Windows Subsystem for Linux distribution.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore

This will install Ubuntu on Windows, distributed by Canonical and licensed under its terms available here:
https://aka.ms/uowterms

Type "y" to continue: y
Downloading from the Microsoft Store... 100%
Extracting filesystem, this will take a few minutes...
Error: 0x800706ba

擦,有Error,本機電腦沒有權限?查了一下,我確實沒有admin權限。但是我重試了一下,結果這次成功了。

不過又在網上查了一下,如果你重試了,還是不行,請參考下面的方法有可能解決你的安裝失敗問題:
在下面的啓用或關閉Windows功能裏啓用適用於Linux的Windows子系統,然後再試一遍吧。
重裝Windows 10上的Linux子系統

重裝Windows 10上的Linux子系統

重裝Windows 10上的Linux子系統

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章