英文:
Can I edit wsl.conf for vm which fails to boot?
问题
我在Windows10上安装了Fedora38,按照https://www.linuxfordevices.com/tutorials/linux/install-fedora-on-windows的步骤进行操作。一切顺利。
然后我尝试切换Fedora以使用systemd,通过创建/etc/wsl.conf
文件,内容如下:
[boot]
systemd=true
我猜我应该先安装systemd包,因为我遇到了以下错误:
PS C:\Users\xxxxx> wsl
Catastrophic failure
Error code: Wsl/Service/CreateInstance/E_UNEXPECTED
现在的问题是,我可以编辑wsl.conf以阻止虚拟机启动吗?
英文:
I installed Fedora38 on Windows10 following https://www.linuxfordevices.com/tutorials/linux/install-fedora-on-windows.
That was OK.
Then I tried to switch fedora to use systemd, by creating /etc/wsl.conf
as
[boot]
systemd=true
I guess I should install systemd pkg first,
because I got
PS C:\Users\xxxxx> wsl
Catastrophic failure
Error code: Wsl/Service/CreateInstance/E_UNEXPECTED
Now the question is can I edit wsl.conf for not-booting VM
?
答案1
得分: 1
Mounting the vhdx image file on another distro made possible to edit the /etc/wsl.conf on faulty system.
On Windows:
wsl -d <working system> --mount --vhd <path to image>/<image name>.vhdx --bare
Example: wsl -d Ubuntu-20.04 --mount --vhd c:\wsl\vms\Ubuntu-22.04\Ubuntu-22.04.vhdx --bare
Inside the working system:
- Mount the device on a mount point (Example: $ sudo mount /dev/sdc /mnt);
Note: You can use lsblk to discover the new /dev/sd?
- Edit the
/etc/wsl.conf, removing the [boot] systemd=true part; - Umount and exit the system.
Back on Windows, umount the image:
wsl --unmount \\?\c:\wsl\vms\Ubuntu-22.04\Ubuntu-22.04.vhdx
Example: wsl --unmount \\?\c:\wsl\vms\Ubuntu-22.04\Ubuntu-22.04.vhdx
Check if the former faulty system boot up.
英文:
Mounting the vhdx image file on another distro made possible to edit the /etc/wsl.conf on faulty system.
On Windows:
wsl -d <working system> --mount --vhd <path to image>\<image name>.vhdx --bare
Example: wsl -d Ubuntu-20.04 --mount --vhd c:\wsl\vms\Ubuntu-22.04\Ubuntu-22.04.vhdx --bare
Inside the working system:
-
Mount the device on a mount point (Example: $ sudo mount /dev/sdc /mnt);
> Note: You can use lsblk to discover the new /dev/sd? -
Edit the <mount point>/etc/wsl.conf, removing the [boot] systemd=true part;
-
Umount and exit the system.
Back on Windows, umount the image:
wsl --unmount \\?\<path to image>\<image name>.vhdx
Example: wsl --unmount \\?\c:\wsl\vms\Ubuntu-22.04\Ubuntu-22.04.vhdx
Check if the former faulty system boot up.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论