[Share Experiences] Deepin GNU/Linux的WSL 2发行版
Tofloor
poster avatar
诗羔羊
deepin
2022-11-18 17:01
Author

Deepin GNU/Linux的WSL 2发行版

本文旨在引导制作支持在WSL 2正式版上完整运行的Deepin GNU/Linux发行版。

系统要求

能够正常安装及使用WSL 2 1.0.0版本(Windows 11)。最少要求能够支持systemd。

使用虚拟机安装Deepin GNU/Linux

安装时选择手动安装,只需要创建一个boot分区以及一个root分区就行。
安装完成待到要重启时,按住Ctrl Alt F2切换到tty2。

导出根文件系统

  1. 切换到root用户
  2. 挂载安装的root分区,例如
# cd /tmp
# mkdir rootfs
# mount /dev/sda2 rootfs
  1. 打包根文件系统,例如
# cd rootfs
# echo > etc/fstab
# tar -zcvf deepin.tar.gz * --exclude=deepin.tar.gz
  1. 导出根文件系统
    可以通过重启,在grub界面选中第一行按Tab键编辑,把livecd-installer改成livecd,按F10。启动后通过smb等方式把安装的root分区下的deepin.tar.gz导出来。

为WSL 2安装Deepin GNU/Linux

  1. 导入WSL
    这个自己看LxRunOffline怎么用,例如
LxRunOffline i -n deepin -f C:\Users\feihong\Downloads\deepin.tar.gz -d C:\Users\feihong\AppData\Local\deepin
  1. 升级成WSL2
    例如:
wsl --set-version deepin 2

开启systemd支持

为wsl的deepin添加systemd支持
https://baijiahao.baidu.com/s?id=1744728044698772539&wfr=spider&for=pc

修改LightDM配置

  1. 修改/etc/lightdm/lightdm.conf及/etc/lightdm/lightdm.conf.real
    通过 ip route | grep default | awk '{print $3; exit;}'获取WSL 2网关。
    为lightdm.conf追加如下内容
type=xremote
xserver-hostname=[网关] //替换此处
xserver-display-number=0

修改lightdm.conf.real,找到 [Seat:*] 之后与上述追加内容相同的字段,去掉开头的 # ,修改成相同的内容。

配置X显示服务

打开X410,改成Floating Desktop模式,勾选Allow full public access。重启

重启WSL的Deepin GNU/Linux

例如

wsl -t deepin
wsl -d deepin

此时应当能够看到Deepin的初始化配置界面了

设置默认登录用户

图形界面登录似乎有一点点问题,因此需要设置成自动登录。
修改/etc/lightdm/lightdm.conf [Seat:*]组之后的autologin-user字段,去掉注释,后面添加你的用户名。

使用WSLg

Deepin自带的wine.cfg等会破坏WSLg的正常使用,因此需要替换并修复

  1. 删除/etc/binfmt.d/wine.cfg
  2. 添加/etc/binfmt.d/WSLInterop.conf
# Enable WSL Interop
:WSLInterop:M:0:MZ::/init:PF

支持Xnest的LightDM尚未完善,请待后续

结束

似乎窗口特效开不了,其他的没什么大问题。

原本是想修改LightDM使之适用于Xnest的显示服务器,这样就可以直接使用WSLg提供的显示服务运行Xnest为系统提供显示服务。但是Deepin似乎与WSLg存在兼容性问题,会导致WSLg崩溃。

论坛这个板块发个教程都不知道往哪里发。真是令人欲言又止。

Reply Favorite View the author
All Replies
诗羔羊
deepin
2022-11-18 17:13
#1

企业微信截图_16687338473382.png

企业微信截图_16687337872398.png

企业微信截图_16687337198362.png

Reply View the author
jjcui8595
Moderator
2022-11-18 17:28
#2

大赞like

Reply View the author
liwl
deepin
2022-11-18 18:31
#3

like

厉害

Reply View the author
PossibleVing
deepin
2022-11-18 18:48
#4
It has been deleted!
PossibleVing
deepin
2022-11-18 18:49
#5

like

可以参考一下这个帖子,看看WSLg可以不?

wsl2安装deepinV23 preview-论坛-深度科技

Reply View the author
诗羔羊
deepin
2022-11-18 19:54
#6
It has been deleted!
诗羔羊
deepin
2022-11-18 19:54
#7
It has been deleted!
诗羔羊
deepin
2022-11-18 19:54
#8
It has been deleted!
诗羔羊
deepin
2022-11-18 19:54
#9
It has been deleted!
诗羔羊
deepin
2022-11-18 21:20
#10
It has been deleted!
诗羔羊
deepin
2022-11-18 21:29
#11
It has been deleted!
berners
deepin
2022-11-18 22:43
#12

体验如何,会不会很卡

Reply View the author
晚秋(lateautumn)
Moderator
2022-11-20 23:49
#13

like

Reply View the author
tr******rt@outlook.com
deepin
2022-11-26 14:05
#14

支持!期待更多分享!

Reply View the author
mmlmonkey
deepin
2022-11-28 23:07
#15

v23 x服务起不来 lightdm服务报错

Reply View the author