nixos-anywhere icon indicating copy to clipboard operation
nixos-anywhere copied to clipboard

rsync command not found with 23.11 nixos image

Open Tommixe opened this issue 1 year ago • 9 comments

nixos-anywhere fails at copy extra file step using as installation target a machine booted with nixos 23.11 minimal iso image: https://channels.nixos.org/nixos-23.11/latest-nixos-minimal-x86_64-linux.iso

nixos-anywhere command: nix run github:numtide/nixos-anywhere -- --extra-files "$temp" --flake .#server02 root@$192.168.178.191

This is the error:

+ echo '### Copying extra files ###'
### Copying extra files ###
+ rsync -rlpv -FF -e 'ssh -i "/tmp/tmp.eYUCcg96wX"/nixos-anywhere -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ' /tmp/tmp.Ol4VOcuUb6/ [email protected]:/mnt/
Warning: Permanently added '192.168.178.191' (ED25519) to the list of known hosts.
bash: line 1: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7]
+ rm -rf /tmp/tmp.eYUCcg96wX

Using the 23.05 image installation works without any issue.

Tommixe avatar Dec 02 '23 19:12 Tommixe

We should probably start making our own ISOs that have all needed tools.

Mic92 avatar Dec 24 '23 09:12 Mic92

Is there a workaround, besides using the 23.05 image?

Something like this before the nixos-everywhere call works:

ssh root@hostname "nix-env -iA nixos.rsync"

Ramblurr avatar Feb 08 '24 13:02 Ramblurr

Another work around is building your own installer. nixos-generators works well for that.

Mic92 avatar Feb 09 '24 08:02 Mic92

maybe we can do a fallback with nix-shell? or even nix-env?

Lassulus avatar Mar 26 '24 21:03 Lassulus

Editing /etc/nixos/configuration.nix and adding rsync to systemPackages with a nixos-rebuild test also works on current minimal iso.

  environment.systemPackages = with pkgs; [
    rsync
  ];

0x4A6F avatar Mar 26 '24 21:03 0x4A6F

hmm, but thats a lot of hassle. Maybe we should just port the rsync code to scp?

Lassulus avatar Mar 26 '24 21:03 Lassulus

https://github.com/nix-community/nixos-anywhere/pull/295 is the PR for that, not tested yet

Lassulus avatar Mar 26 '24 21:03 Lassulus

We also create a new nixos-anywhere optimized installer image that has rsync installed and enables sshd by default: https://github.com/nix-community/nixos-images?tab=readme-ov-file#iso-installer-images

Mic92 avatar Apr 30 '24 08:04 Mic92

We also create a new nixos-anywhere optimized installer image that has rsync installed and enables sshd by default: nix-community/nixos-images#iso-installer-images

I saw this a few days ago and could not for the life of me figure out where the ISOs are actually hosted. I'm new to nix and figure I must misunderstand how it works.

EDIT: Found it. I mistook the assets for releases.

uPaymeiFixit avatar May 01 '24 02:05 uPaymeiFixit

To anyone who is looking at this, #316 (or #325) has been merged and it solves the problem.

Prince213 avatar May 26 '24 17:05 Prince213