Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copying extra files fails when using IPv6 address #246

Open
ConnorBaker opened this issue Nov 8, 2023 · 1 comment
Open

Copying extra files fails when using IPv6 address #246

ConnorBaker opened this issue Nov 8, 2023 · 1 comment

Comments

@ConnorBaker
Copy link

I'm using the 1.1.0 release.

Here's my invocation:

nix run github:numtide/nixos-anywhere/1.1.0 -- \
  root@2600:4040:2094:c800:ca7f:54ff:fed0:db4 \
  -i ~/.ssh/id_ed25519 \
  --flake .#nixos-build01 \
  --kexec https://gh-v6.com/nix-community/nixos-images/releases/download/nixos-unstable/nixos-kexec-installer-noninteractive-x86_64-linux.tar.gz \
  --print-build-logs \
  --debug \
  --extra-files /Volumes/nixos-build01

My configuration files are here: https://github.com/connorbaker/nixos-configs.

The script appears to work up to the point where it tries to copy the extra files over:

+ step Copying extra files
+ echo '### Copying extra files ###'
### Copying extra files ###
+ rsync -rlpv -FF -e 'ssh -i "/tmp/tmp.1y1HPByasE"/nixos-anywhere -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ' /Volumes/nixos-build01/ root@2600:4040:2094:c800:ca7f:54ff:fed0:db4:/mnt/
ssh: connect to host 0.0.10.40 port 22: Connection timed out
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(231) [sender=3.2.7]
+ rm -rf /tmp/tmp.1y1HPByasE

At that point it errors out. However, I can ssh into the machine and see that it is still running, albeit without the extra files copied over.

Here are the relevant lines in the script:

step Copying extra files
rsync -rlpv -FF \
-e "ssh -i \"$ssh_key_dir\"/nixos-anywhere -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${ssh_args[*]}" \
"$extra_files" \
"${ssh_connection}:/mnt/"
ssh_ "chmod 755 /mnt" # rsync also changes permissions of /mnt

Looking at the logs pertaining to rsync, we see ssh: connect to host 0.0.10.40 port 22: Connection timed out. That's not the IP address that was specified... but if you convert the first hextet of the IPv6 address, 2600, to IPv4 octets you do indeed get 10.40 ($2600 = 10*256^1 + 40*256^0$).

I think that because rsync uses a colon (:) to delimit the remote from the destination path, it's being tripped up by the colons in the IPv6 address.

Here's a similar post which describes a solution: https://serverfault.com/questions/420158/how-do-i-use-rsync-with-an-ipv6-address-via-ssh. In short, use brackets ([]) to enclose the IPv6 address.

@sedlund
Copy link
Contributor

sedlund commented Jun 27, 2024

nixos-anywhere uses tar over the same ssh connection now instead of rsync to facilitate --extra-files

#325

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants