There are some errors when using systemctl
in WSL2.
The following errors are:
$ sudo systemctl status mysql
# OUTPUT
Failed to get properties: Connection reset by peer
$ sudo systemctl start mysql
# OUTPUT
Warning! D-Bus connection terminated.
Failed to start mysql.service: Connection reset by peer
See system logs and 'systemctl status mysql.service' for details.
Run the following command to see if snapd
is unavailable, if so, then run the second set of commands below:
$ snap version
# OUTPUT
snap 2.55.5+20.04
snapd unavailable
series -
$ 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
# OUTPUT
snap 2.56.2
snapd 2.56.2
series 16
ubuntu 20.04
kernel 5.10.102.1-microsoft-standard-WSL2
For more information see the following pages with work arounds: