当使用LxRunOffline.exe想把wsl子系统从c盘移到d盘时,遇到两个报错,如下是解决方法。

迁移方法参考:Win10系统安装Ubuntu子系统 - 希望先生 - 博客园

报错1:“Couldn't get the value "DistributionName" of the registry key "Software\Microsoft\Windows\CurrentVersion\Lxss\AppxInstallerCache”

解决方法:

1. win+R 输入regedit

2. 打开:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\

3. 然后右键删除AppxInstallerCache文件夹

解决方法参考了.\LxRunOffline.exe list [ERROR] Couldn‘t get the value “DistributionName“ of the registry key “Softw_奇异空间里的猫的博客-CSDN博客problemsolved byproblem磁盘已满太吓人了我要把wsl从c盘移到d盘。参考这篇文章:https://blog.csdn.net/hxc2101/article/details/113652771但是出现了一个问题:然后查看了教程https://githubmemory.com/repo/DDoSolitary/LxRunOffline/issues/171删除AppxInstallerCache这个文件夹随即成功!继续如下教程操作:...https://blog.csdn.net/qq_43861133/article/details/121630620

报错2:Couldn't set the case sensitive attribute of the directory "\\?\C:\Users\xxx\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\".
Reason: Indicates that the directory trying to be deleted is not empty.

出现这个错误时使用的是官方最新版的“LxRunOffline-v3.5.0-msvc.zip”,官方LxRunOffline下载地址:https://github.com/DDoSolitary/LxRunOffline/releases 

按报错搜到这篇文章

迁移WSL时的报错:0x80073d21 此应用的发布者不允许将其移动到其他位置_AYO_YO的博客-CSDN博客

按提示说出现此错误时,需要另外下一个LxRunOffline版本:https://ddosolitary-builds.sourceforge.io/LxRunOffline/LxRunOffline-v3.5.0-11-gfdab71a-msvc.zip

上面网址报错的话,在CSDN下载:https://download.csdn.net/download/miaoye520/87076953

再按之前的步骤:

查看安装的Linux版本:
.\LxRunOffline.exe list  

迁移:
.\LxRunOffline.exe move -n Ubuntu -d D:\Ubuntu

查看迁移后的子系统安装目录:
.\LxRunOffline.exe get-dir -n Ubuntu-18.04

至此,再无任何报错,并成功迁移。 

再看D盘,多出一个7G多的虚拟镜像,说明迁移成功了。

迁移完成后,打开ubuntu又报错了,

报错3:拒绝访问

1. 因此还需要给迁移后的目录授权:

icacls D:\Ubuntu /grant “用户名:(OI)(CI)(F)”

上面用户名替换成自己windows的默认用户名

2. 通过任务管理器,或计算机管理>服务,右键重启LxssManager服务

 

之后wsl下的Ubuntu就可以正常运行了。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐