[Windows11] wsl2でsystemctlを有効にする。
bash
# which lsb_release
/usr/bin/lsb_release
# 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
bash
# apt-get update
# apt-get install systemd-genie
# genie -s
...
UNIT LOAD ACTIVE SUB DESCRIPTION
● ssh.service loaded failed failed OpenBSD Secure Shell server
● systemd-remount-fs.service loaded failed failed Remount Root and Kernel File Systems
● multipathd.socket loaded failed failed multipathd control socket
...
genie - wiki - Systemd-units-known-to-be-problematic-under-WS
bash
# systemctl status systemd-remount-fs
...
Active: failed (Result: exit-code) since Sat 2022-03-19 15:50:42 JST; 13min ago
...
Mar 19 15:50:42 LAPTOP-CC3T1ADE-wsl systemd-remount-fs[64]: mount: /: can't find LABEL=cloudimg-rootfs.
...
# dF
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdc 263174212 2137880 247598176 1% /
...
# sudo e2label /dev/sdb cloudimg-rootfs
# systemctl start systemd-remount-fs
# systemctl status systemd-remount-fs
...
Active: active (exited) since Sat 2022-03-19 16:06:41 JST; 5s ago
...
# systemctl status mutipathd
# systemctl disable multipathd
# systemctl status multipathd
...
Active: inactive (dead)
...
# systemctl status ssh
...
Active: failed (Result: exit-code) since Sat 2022-03-19 15:50:44 JST; 6min ago
...
# ssh-keygen -A
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
# systemctl status sshd
Active: active (running) since Sat 2022-03-19 16:13:24 JST; 2s ago
# touch /etc/profile.d/start_genie.sh
# chmod +x /etc/profile.d/start_genie.sh
# vim /etc/profile.d/start_genie.sh
/etc/profile.d/start_genie.sh
#!/bin/sh
if [[ ! -v INSIDE_GENIE ]]; then
echo "Starting genie:"
exec /usr/bin/genie -s
fi
参考
WSL 2でCannot connect to the Docker daemonと言われたら、デフォルトを確認する。
Windows 10 or 11 (WSL2)のUbuntuでsystemctlを利用する方法(systemdをPID1で動作させる方法)
Author And Source
この問題について([Windows11] wsl2でsystemctlを有効にする。), 我々は、より多くの情報をここで見つけました https://qiita.com/nthr7286/items/c7c7cac593f4044a8225著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .