Ubuntuでスナップを使用して何もインストールできない

Ubuntuでスナップを使用して何もインストールできない

だからVS Codeをインストールしようとしています。

sudo snap install code --classic

ただし、次のエラーが発生します。

error: cannot communicate with server: Post
http://localhost/v2/snaps/code: dial unix /run/snapd.socket: connect:
no such file or directory

どうすればいいのかわかりませんが、スナップを外して再インストールしてもエラーが発生します。

私はそうしました:

sudo apt autoremove --purge snapd

それから:

sudo apt update && sudo apt upgrade
sudo apt install snapd

これは動作しません!

次に、次のことを試してください。

sudo service snapd start

出力:

snapd: unrecognized service

私がするなら:

snapd services

出力:

snap    2.54.3+20.04.1ubuntu0.2                                                                                         
snapd   unavailable                                                                                                     
series  -

使用コマンド:

systemctl status snapd.service

次のメッセージが表示されます。私のシステムはsysvinitを使用しています。

System has not been booted with systemd as init system (PID 1). 
Can't operate.                                          
Failed to connect to bus: Host is down    

なぜこれが起こるのですか?私はwsl2を使用しています

ベストアンサー1

Windows WSLを使用している場合は、次のコマンドを実行します。

git clone https://github.com/DamionGans/ubuntu-wsl2-systemd-script.git
cd ubuntu-wsl2-systemd-script/
sudo bash ubuntu-wsl2-systemd-script.sh
# Enter your password and wait until the script has finished
cmd.exe /C setx WSLENV BASH_ENV/u
cmd.exe /C setx BASH_ENV /etc/bash.bashrc

ここでWSLのsystemdとsnapの問題を確認してください。

https://github.com/microsoft/WSL/issues/2374

https://github.com/damionGans/ubuntu-wsl2-systemd-script

おすすめ記事