Siduction Forum

Siduction Forum => Software - Support => Topic started by: raduc on 2023/09/20, 18:52:13

Title: Mosh does not work on a freshly installed Siduction
Post by: raduc on 2023/09/20, 18:52:13
Hi all,

I installed Siduction 2023.1.1 and enabled SSH using sshactivate, but mosh fails to connect, even locally:


$ mosh localhost


Results in:
Nothing received from server on UDP port 60001

I tried installing both Siduction and Debian Sid on Virtualbox and on Debian Sid mosh works right after installation, while on Siduction it does not.

From what I can tell there is no firewall installed by default on Siduction, why would mosh not work otherise?

Thanks for any help,

Radu
Title: Re: Mosh does not work on a freshly installed Siduction
Post by: edlin on 2023/09/20, 19:03:39
War vorschnell ... kann weg.
Title: Re: Mosh does not work on a freshly installed Siduction
Post by: raduc on 2023/09/21, 02:45:43
It turns out the system is misconfigured to kill all user processes on exit, which is incompatible with mosh, see:
https://github.com/mobile-shell/mosh/issues/1294
https://github.com/mobile-shell/mosh/issues/1171

If I comment out this line:

KillUserProcesses=yes


in /etc/systemd/logind.conf then mosh works fine.

So, I think Siduction should either remove mosh from it or comment out that line so it works. Or maybe mention in the manual that it will not work in the default installation.

Thanks.
Title: Re: Mosh does not work on a freshly installed Siduction
Post by: hendrikL on 2023/09/21, 07:31:45
If I read and understand the GitHub issues correctly, it is a bug of mosh and not our fault.

We can't remove mosh, it is in debian.

What we can do, is to mention it in our manual or somewhere else, it is a little caveat, sorry.

https://github.com/siduction/pyfll/commit/0615d072d7435d6a5633a7ea50ae538bc939de6a <- we introduced this in 2016
Title: Re: Mosh does not work on a freshly installed Siduction
Post by: raduc on 2023/09/21, 15:12:49
The way mosh works is:
- it connects using ssh and leaves a program running as detached: mosh-server
- mosh-server prints out a UDP port number
- mosh reads the port number and closes the ssh connection, leaving mosh-server running on the host machine as a detached process (this is what breaks in Siduction).
- most starts mosh-client using the port read above

The part that breaks is leaving mosh-server running after the initial ssh session closes.
However, I suspect KillUserProcesses  breaks other things using detached processes, like tmux or screen: https://unix.stackexchange.com/questions/490267/prevent-logoff-from-killing-tmux-session

Not a big deal because KillUserProcesses can be disabled manually, but maybe it should be mentioned in the manual.
Leaving it here as a reference if others encounter a similar issue.

Thanks.
Title: Re: Mosh does not work on a freshly installed Siduction
Post by: hendrikL on 2023/09/21, 22:04:35
Well, we are talking about it and test what's happening when we comment it, like debian.

For shure, we will mention it in our manual till we comment it or leave as it is.
Title: Re: Mosh does not work on a freshly installed Siduction
Post by: der_bud on 2023/09/22, 13:24:35
Some time ago there have been reasons why 'KillUserProcesses=yes' got activated in siduction, first of all to circumvent some buggy behavior in systemd and some DM's shutdown/logout/etc. Perhaps it's time to look if these still occur nowadays...

https://siduction.org/2016/05/debian-fell-over/ 
https://forum.siduction.org/index.php?topic=7219.0
https://forum.siduction.org/index.php?topic=6078.0

Of course you are right that with KillUserProcesses=yes some things like mosh, screen, tmux get killed on user logout, at the time that was changed it was like 'you can have one or the other, not both' decision. More complaints in this forum got solved with that change than introduced for tmux-users ;). Perhaps the possible solutions given in the first link above are still valid, though. (<-- systemd-run --scope --user mosh ?)