Skip to content

Instantly share code, notes, and snippets.

@yuessir
Last active June 16, 2022 04:55
Show Gist options
  • Save yuessir/6612c713cde20950888f9eb10b164bf8 to your computer and use it in GitHub Desktop.
Save yuessir/6612c713cde20950888f9eb10b164bf8 to your computer and use it in GitHub Desktop.
WSL2 更換systemd 使用arkane-systems/genie
# update software repositories
$sudo apt update
# install available software updates
$sudo apt upgrade
# install prerequisites
$sudo apt install lsb-release wget openssl apt-transport-https -y
# switch to root role
$sudo -s
$wget -O /etc/apt/trusted.gpg.d/wsl-transdebian.gpg https://arkane-systems.github.io/wsl-transdebian/apt/wsl-transdebian.gpg
$chmod a+r /etc/apt/trusted.gpg.d/wsl-transdebian.gpg
$cat << EOF > /etc/apt/sources.list.d/wsl-transdebian.list
deb https://arkane-systems.github.io/wsl-transdebian/apt/ $(lsb_release -cs) main
deb-src https://arkane-systems.github.io/wsl-transdebian/apt/ $(lsb_release -cs) main
EOF
$apt update
$sudo apt install -y systemd-genie
root@DESKTOP-O1U24RQ:/home/kevin# genie -i
genie: WARNING: systemd default target is default.target; targets other than multi-user.target may not work
genie: WARNING: if you wish to use a different target, this warning can be disabled in the config file
genie: WARNING: if you experience problems, please change the target to multi-user.target
Waiting for systemd....!
kevin@DESKTOP-O1U24RQ-wsl:~$ genie -i
genie: bottle is already established (systemd running)
/* command desc
# 启动 systemd 环境
genie -i
# 启动 systemd 环境,并在环境中打开 shell
genie -s
# 启动 systemd 环境,并在环境中运行命令
genie -c command
https://github.com/arkane-systems/genie
https://blog.lautumn.cn/wsl/2021/09/09/wsl-systemd.html
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment