NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.77k stars 13.18k forks source link

`switch-to-configuration` failing because Perl built incorrectly #160427

Open ethnt opened 2 years ago

ethnt commented 2 years ago

Describe the bug

As far as I can tell, the switch-to-configuration script is not being run with Perl because the correct version of Perl was not installed.

If I run the switch-to-configuration script:

$ /nix/store/07cgxyc0wgd5qwwkk3afs8d9pwmxws4y-nixos-system-htpc-21.11.20220216.2128d0a/bin/switch-to-configuration
/nix/store/07cgxyc0wgd5qwwkk3afs8d9pwmxws4y-nixos-system-htpc-21.11.20220216.2128d0a/bin/switch-to-configuration: line 3: use: command not found
/nix/store/07cgxyc0wgd5qwwkk3afs8d9pwmxws4y-nixos-system-htpc-21.11.20220216.2128d0a/bin/switch-to-configuration: line 4: use: command not found
/nix/store/07cgxyc0wgd5qwwkk3afs8d9pwmxws4y-nixos-system-htpc-21.11.20220216.2128d0a/bin/switch-to-configuration: line 5: syntax error near unexpected token `('
/nix/store/07cgxyc0wgd5qwwkk3afs8d9pwmxws4y-nixos-system-htpc-21.11.20220216.2128d0a/bin/switch-to-configuration: line 5: `use File::Path qw(make_path);'

The first line of that script is:

#! /nix/store/cwix2dqwbw4naaf8pzlgb7c9mgaxgzlv-perl-5.34.0-env/bin/perl

But if I try to run that Perl executable, I get:

$ /nix/store/cwix2dqwbw4naaf8pzlgb7c9mgaxgzlv-perl-5.34.0-env/bin/perl --version
Failed to execute process '/nix/store/cwix2dqwbw4naaf8pzlgb7c9mgaxgzlv-perl-5.34.0-env/bin/perl'. Reason:
exec: unknown error (errno was 8)
The file '/nix/store/cwix2dqwbw4naaf8pzlgb7c9mgaxgzlv-perl-5.34.0-env/bin/perl' is marked as an executable but could not be run by the operating system.

If I look and see what that executable looks like, it seems to be empty?

$ cat /nix/store/cwix2dqwbw4naaf8pzlgb7c9mgaxgzlv-perl-5.34.0-env/bin/perl
$ 

I'm not quite sure what's going on here.

Steps To Reproduce

This only is happening for one of my NixOS machines, not for any of the others with nearly identical configurations. They are built off of the same NixOps deployment, using the same version of nixpkgs.

Expected behavior

The switch-to-configuration command runs successfully.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.98, NixOS, 21.11 (Porcupine)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.16`
 - nixpkgs: `/nix/store/f5hg16l66fhp7qpszkn82fazh2x4pnin-source`
Artturin commented 2 years ago

I fetched that path and the executable works Check and repair the store nix-store --verify --check-contents --repair