Mel*_*ham 5 windows-subsystem-for-linux
wsl由于驱动器存储空间不足,我最近将目录移动到另一个驱动器C:。根据StackOverflow 帖子中提供的答案,我使用了lxrunoffline工具并将我的Ubuntu发行版移动到另一个驱动器(E:\wsl在我的例子中)。一旦分配成功移动,我就跑去wsl测试,它就像一个魅力。
一切都很顺利,直到有一天我不小心将该E:\wsl文件夹重命名为其他名称。嗯,正如预期的那样,wsl没有成功。然后,我恢复了该名称wsl并期望它能够工作,但令我惊讶的是,即使安装了它,此后也没有找到任何已安装的发行版......
E:> wsl
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
Run Code Online (Sandbox Code Playgroud)
有什么方法可以恢复到旧目录或指向wsl手动位置吗?
编辑:我不想重置,Ubuntu因为我想保留已安装的软件包和首选项...
好吧,我终于找到了解决这个问题的办法。
这就像使用or命令使用lxrunoffline工具注册发行版一样简单。rgregister
E:\LxRunOffline\LxRunOffline-v3.3.3>lxrunoffline rg
[ERROR] the option '-d' is required but missing
Options:
-n arg Name of the distribution
-d arg The directory containing the distribution.
-c arg The config file to use. This argument is optional.
Run Code Online (Sandbox Code Playgroud)
运行注册命令后,我可以wsl像往常一样启动。但这将使您以“root”用户身份登录,从而在“/root”目录中启动。我运行以下命令以wsl不同用户身份启动(适用于 Ubuntu):
ubuntu config --default-user <user-name>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10741 次 |
| 最近记录: |