0

I have Windows 10 Home w/o Hyper-V and Ubuntu running on WSL. In Ubuntu, I had was able to run SSH server with sudo service ssh start.

After that I decided to install k9s from the Snap Store, but Ubuntu on WSL doesn't have Snap Store. To resolve this tried this steps here:

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

... but this was unsuccessful. I received some error about hypervisor.

The main problem is that now, when I try to run SSH server with the same command as above, I get the error:

Failed to start ssh.service: transport endpoint is not connected

Please help me recover Ubuntu to a state where I can run SSH again.

NotTheDr01ds
  • 17,888

1 Answers1

0

Failed to start ssh.service: transport endpoint is not connected.

You've probably already solved this part, at least, by now. This message is because, once you start Systemd in its own namespace, it's running, whether you are in the namespace or not. This means that the service command is now mapped to systemctl, even though systemctl isn't accessible.

As I mention in this answer:

  • I don't recommend running Systemd this way unless you really know what it is doing behind the scenes, or can figure it out.
  • And after proving to yourself that it's possible, I recommend exiting all WSL instances completely, then doing wsl --shutdown. Otherwise, you will have some things be "broken" until you do.

Once restarting after a wsl --shutdown, Systemd should no longer be running in a separate namespace, and the service command should be back to "normal" (as far as WSL2 is concerned).

After that I decided to install k9s from snap store. but ubuntu doesnt have snap store to resolve this I have used this steps

If your system is able to be upgraded to Windows 11, official support for Systemd is now in beta. See this answer for details on how to enable. The Snap store can be used with this method.

NotTheDr01ds
  • 17,888