Mosh
Appearance
☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.
Troubleshooting
Missing /run/user/1000
Using a mosh session, $XDG_RUNTIME_DIR (/run/user/1000) doesn't exist and causes issues such as:
- nix-shell failing with
Error in tempdir() using /run/user/1000/nix-shell.XXXXX
This is caused by the way mosh handles logging-in to the system, the login is actually handled by a short ssh session, which ends immediately. logind, as it is used, closes the user's session and cleans up behind, since there is no lingering configured by default.
To enable lingering use:
$ loginctl enable-linger $USER
Then reconnect with mosh.
As a workaround, it is also possible to set an alias in the user's shell on the server wrapping mosh-server to keep the session around.
[1]
alias mosh-server = "systemd-run --user --scope mosh-server"
See also https://github.com/NixOS/nixpkgs/issues/3702#issue-40762878