我想在 Windows 11 上的 Ubuntu WSL 上安装 k9s。
当我尝试安装它时,出现错误 snapd 已关闭:
➜ ~ sudo snap install k9s
error: cannot communicate with server: Post http://localhost/v2/snaps/k9s: dial unix /run/snapd.socket: connect: no such file or directory
当我启动 snapd 时出现一个新错误:
➜ ~ systemctl start snapd.service
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
有人知道我该怎么做吗?
答案1
这是 WSL2 的一个问题,你可以通过运行以下命令来修复它:
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
snap version
来源 :https://github.com/microsoft/WSL/issues/5126#issuecomment-653715201