Agent Diagnostic
Can't use an agent if I can't setup a gateway. :-D (I had GitHub copilot start drafting this issue, after working out why the cross device failure was happening)
When generating cert files, crates/openshell-server/src/certgen.rs uses std::fs::rename(...) to move the newly generated certificates to the specified output directory. In some cases, the source and destination can land on different mounts/devices. In that case, rename(2) returns EXDEV (Rust: std::io::ErrorKind::CrossesDevices), which causes cert generation to fail.
Due to the location the temporary files are created, ${output_dir}.certgen.tmp, they are actually being created on the container's tempfs, not the attached volume. This can lead to the cross devices error.
Workaround (set --output-dir to a new folder within the mounted volume)
PS C:\> container run --rm -it -u 0:0 -v ogc:/extvol ghcr.io/nvidia/openshell/gateway:latest generate-certs --output-dir "/extvol/z"
2026-07-08T03:31:06.530744Z INFO openshell_server::certgen: PKI files created. dir=/extvol/z
Expected
Cert generation should succeed regardless of whether source/destination are on the same device.
The temp certs probably should get created IN the --output-dir, not next to it.
Actual
Move step fails with cross-device rename error (EXDEV / CrossesDevices).
Proposed fix
Use a cross-device-safe move:
- Attempt
std::fs::rename(src, dst) first.
- On
ErrorKind::CrossesDevices, fallback to:
std::fs::copy(src, dst)
- preserve permissions if needed
std::fs::remove_file(src)
- Propagate all other errors unchanged.
OR
Generate the temporary certificates within a folder of the output dir (/extvol/certgen.tmp/ca.crt), not in it.
Why this change
This preserves same-device fast path/behavior while handling common WSL/container mount layouts where cross-device moves are expected.
Description
generate-certs fails with --output-dir args.
generate-certs to be successful.
Reproduction Steps
Environment
PS C:\> container run --rm -it -u 0:0 -v ogc:/extvol ghcr.io/nvidia/openshell/gateway:latest generate-certs --output-dir "/extvol"
Error: x failed to move /extvol.certgen.tmp/ca.crt -> /extvol/ca.crt
`-> Invalid cross-device link (os error 18)
Environment
Windows 11 25H2
wslc 2.9.3.0
Logs
Error: x failed to move /extvol.certgen.tmp/ca.crt -> /extvol/ca.crt
`-> Invalid cross-device link (os error 18)
Agent-First Checklist
Agent Diagnostic
Can't use an agent if I can't setup a gateway. :-D (I had GitHub copilot start drafting this issue, after working out why the cross device failure was happening)
When generating cert files,
crates/openshell-server/src/certgen.rsuses std::fs::rename(...) to move the newly generated certificates to the specified output directory. In some cases, the source and destination can land on different mounts/devices. In that case,rename(2)returnsEXDEV(Rust: std::io::ErrorKind::CrossesDevices), which causes cert generation to fail.Due to the location the temporary files are created,
${output_dir}.certgen.tmp, they are actually being created on the container's tempfs, not the attached volume. This can lead to the cross devices error.Workaround (set
--output-dirto a new folder within the mounted volume)Expected
Cert generation should succeed regardless of whether source/destination are on the same device.
The temp certs probably should get created IN the
--output-dir, not next to it.Actual
Move step fails with cross-device rename error (
EXDEV/CrossesDevices).Proposed fix
Use a cross-device-safe move:
std::fs::rename(src, dst)first.ErrorKind::CrossesDevices, fallback to:std::fs::copy(src, dst)std::fs::remove_file(src)OR
Generate the temporary certificates within a folder of the output dir (
/extvol/certgen.tmp/ca.crt), not in it.Why this change
This preserves same-device fast path/behavior while handling common WSL/container mount layouts where cross-device moves are expected.
Description
generate-certs fails with --output-dir args.
generate-certs to be successful.
Reproduction Steps
Environment
Environment
Windows 11 25H2
wslc 2.9.3.0
Logs
Agent-First Checklist
debug-openshell-cluster,debug-inference,openshell-cli)