View previous topic :: View next topic |
Author |
Message |
zzzhhh n00b
Joined: 05 Jan 2024 Posts: 1
|
Posted: Fri Jan 05, 2024 10:22 am Post subject: After entering systemd namespace,ssh service can't bind port |
|
|
I installed Ubuntu 22.04.3 LTS in WSL2 according to instructions in https://learn.microsoft.com/en-us/windows/wsl/install-manual.
Then I installed SSH server according to instructions in https://jmmv.dev/2022/02/wsl-ssh-access.html.
Then I installed ubuntu-wsl2-systemd-script (https://github.com/DamionGans/ubuntu-wsl2-systemd-script/tree/master) to enable systemd support in WSL2. During reboot of Ubuntu in WSL2, line 45-47 of enter-systemd-namespace script enters systemd namespace:
Code: | exec /usr/bin/nsenter -t "$SYSTEMD_PID" -a \
/bin/login -p -f "$SUDO_USER" \
$([ -f "$USER_HOME/.systemd-env" ] && /bin/cat "$USER_HOME/.systemd-env" | xargs printf ' %q') |
But this makes the SSH service stop working. If I run `systemctl status ssh.service`, I got the following error messages:
Code: | Jan 04 09:01:48 DESKTOP-J2VCDBO systemd[1]: Starting OpenBSD Secure Shell server...
Jan 04 09:01:48 DESKTOP-J2VCDBO sshd[246]: error: Bind to port 2022 on 0.0.0.0 failed: Address already in use.
Jan 04 09:01:48 DESKTOP-J2VCDBO sshd[246]: error: Bind to port 2022 on :: failed: Address already in use.
Jan 04 09:01:48 DESKTOP-J2VCDBO sshd[246]: fatal: Cannot bind any address.
Jan 04 09:01:48 DESKTOP-J2VCDBO systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
Jan 04 09:01:48 DESKTOP-J2VCDBO systemd[1]: ssh.service: Failed with result 'exit-code'.
Jan 04 09:01:48 DESKTOP-J2VCDBO systemd[1]: Failed to start OpenBSD Secure Shell server. |
I cannot find out what processes are using port 2022 because the results returned from `sudo netstat -tulnp | grep 2022` contain no process information:
Code: | tcp 0 0 0.0.0.0:2022 0.0.0.0:* LISTEN -
tcp6 0 0 :::2022 :::* LISTEN - |
So, how can I keep (most of) ubuntu-wsl2-systemd-script while have SSH service working?
[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu] |
|
Back to top |
|
|
Banana Veteran
Joined: 21 May 2004 Posts: 1392 Location: Germany
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|