SSH ForceCommand directive breaks ssh store #830
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#830
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
When using an SSH store, if the user you're connecting as has
ForceCommand /.../nix-store
, Lix will fail with a cryptic error.Encountered when using
nix.sshServe
on the remote builder.Steps To Reproduce
nix store ping --store ssh://nix-ssh@<ip of first machine>
Expected behavior
Successful store ping.
nix --version
outputOn both machines,
nix (Lix, like Nix) 2.94.0-dev-pre20250511-e4b48ca
Additional context
The integer it returns corresponds to the bytes
echo sta
, which probably comes from the remote daemon trying to deserialise these bytes. Possibly f92235e1 is related, and using-oPermitLocalCommand=yes -oLocalCommand=echo started
as before is needed.You can work around this by not using the
nix.sshServe
module, and dropping theForceCommand
, but it would be preferable to not need this.yes, that's an unfortunate consequence of the connection sharing fixes: previously ssh connections would not work at all in some cases if the ssh config configured multiplexing, either crashing during connection setup or not opening a connection at all. we now require the remote to be able to run something that looks enough like a posix shell to first run an
echo started
, and then the command that does the actual remote processing.sadly this is not a lix bug and cannot be fixed without reintroducing old bugs (like #644) :(
this nixos discourse thread has a description of how to do this properly with the old (buggy) ssh behavior, for the new one the script must read lines from stdin instead of parsing the original command and needs to also allow an
echo started
command to run successfully. the nixos module must use this script instead of executing lix binaries directly to function.in that thread @winter mentioned wanting to write an updated version, that version should be used for the nixos module as well.
At least for NixOS users there is a nixpkgs patch in the (above) linked thread now (everyone else can still take the generated script as a template though, I guess).
Most people won't really be able to do much with that patch I guess (I'm probably the odd one here using IFD to patch nixpkgs before evaluation), but it exists and could be upstreamed.
@tcmal if that patch solves the issue for you too (if you have a way of easily testing that, I don't fault you if it's too much work), feel free to comment in the Discourse, if I get some positive feedback I'll put upstreaming that thing on my todolist (instead of keeping it around out-of-tree).