NixOS / nixops-hetzner

GNU Lesser General Public License v3.0
47 stars 14 forks source link

Deploy to hetzner: "ImportError: No module named selinux" #34

Open leshy opened 5 years ago

leshy commented 5 years ago

Hi, I'm failing to install on hetzner via nixops,

...
Processing ./nixpart-0.4.0-py2-none-any.whl
Installing collected packages: nixpart
Successfully installed nixpart-0.4.0
/tmp/nix-build-nixpart-0.4.1.drv-0/nixpart-0.4.1
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/qrsn5hrwa4xrq1wynyxblf6bk72mc4fc-nixpart-0.4.1
strip is /nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/qrsn5hrwa4xrq1wynyxblf6bk72mc4fc-nixpart-0.4.1/lib  /nix/store/qrsn5hrwa4xrq1wynyxblf6bk72mc4fc-nixpart-0.4.1/bin                                                                                   
patching script interpreter paths in /nix/store/qrsn5hrwa4xrq1wynyxblf6bk72mc4fc-nixpart-0.4.1
checking for references to /tmp/nix-build-nixpart-0.4.1.drv-0 in /nix/store/qrsn5hrwa4xrq1wynyxblf6bk72mc4fc-nixpart-0.4.1...
wrapping `/nix/store/qrsn5hrwa4xrq1wynyxblf6bk72mc4fc-nixpart-0.4.1/bin/nixpart'...
building '/nix/store/dzbz3yr0fm24q5n1pvvqxa9af2d36mv6-hetzner-nixops-installer.drv'...
done. (/nix/store/k3nva7faxwsy2kwv43h9qwnkjil6ybrb-hetzner-nixops-installer/bin/hetzner-bootstrap)
hyper5> creating nixbld group in rescue system... done.
hyper5> checking if tmpfs in rescue system is large enough... yes: 32178 MB
hyper5> copying bootstrap files to rescue system... done.
hyper5> partitioning disks...
hyper5> Traceback (most recent call last):
hyper5>   File "/nix/store/qrsn5hrwa4xrq1wynyxblf6bk72mc4fc-nixpart-0.4.1/bin/.nixpart-wrapped", line 10, in <module>
hyper5>     from nixkickstart import NixKickstart
hyper5>   File "/nix/store/qrsn5hrwa4xrq1wynyxblf6bk72mc4fc-nixpart-0.4.1/lib/python2.7/site-packages/nixkickstart.py", line 24, in <module>                                                                                                                  
hyper5>     from blivet.deviceaction import *
hyper5>   File "/nix/store/5ryfsi6lpmjpah4q6dvxf4szgbrp82vv-blivet-0.17-1/lib/python2.7/site-packages/blivet/__init__.py", line 68, in <module>                                                                                                               
hyper5>     from devices import *
hyper5>   File "/nix/store/5ryfsi6lpmjpah4q6dvxf4szgbrp82vv-blivet-0.17-1/lib/python2.7/site-packages/blivet/devices.py", line 103, in <module>                                                                                                               
hyper5>     from devicelibs import mdraid
hyper5>   File "/nix/store/5ryfsi6lpmjpah4q6dvxf4szgbrp82vv-blivet-0.17-1/lib/python2.7/site-packages/blivet/devicelibs/mdraid.py", line 25, in <module>                                                                                                      
hyper5>     from .. import util
hyper5>   File "/nix/store/5ryfsi6lpmjpah4q6dvxf4szgbrp82vv-blivet-0.17-1/lib/python2.7/site-packages/blivet/util.py", line 3, in <module>                                                                                                                    
hyper5>     import selinux
hyper5> ImportError: No module named selinux
error: command ‘['ssh', '-oControlPath=/tmp/nixops-ssh-tmp0ZMDoO/master-socket', '-p', '22', '-o', 'LogLevel=quiet', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'GlobalKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-p', '22', '-o', 'LogLevel=quiet', '-o', 'UserKnownHostsFile=/dev/null', '-o', 'GlobalKnownHostsFile=/dev/null', '-o', 'StrictHostKeyChecking=no', '-x', 'root@195.201.160.254', '--', 'export LANG= LC_ALL= LC_TIME=; nixpart -p -']’ failed on machine ‘hyper5’ (exit code 1)        

some info on my machine (it's a fresh nix install on arch)

> nixops --version
NixOps 1.6
> nix-env --version
nix-env (Nix) 2.1.1                                                                                                                                                                                        
> uname -a
Linux 4.18.5-arch1-1-ARCH NixOS/nixops#1 SMP PREEMPT Fri Aug 24 12:48:58 UTC 2018 x86_64 GNU/Linux                                                                                                            

tnx!

ravloony commented 5 years ago

I am getting this too. Is there a workaround? I cannot seem to find one.

I have tried setting nixpkgs to the 18.09 and even 18.03 versions, but there is no change. I will try using the nixops from those versions tonight.

leshy commented 5 years ago

This was an issue only on nixos-unstable for me. I reverted to 18.09 and made sure the deployed servers used 18.09 by adding

nix.nixPath = [ "nixpkgs=https://nixos.org/channels/nixos-18.09/nixexprs.tar.xz"];

to the server definition files.

not sure if one or the other helped :)

ravloony commented 5 years ago

I added that line to the server definition file, but I still get the same error.

ravloony commented 5 years ago

Ok, I still have no idea how to fix this.

I have tried writing a shell.nix that points to the 18.09 channel:

let

fetcher = { owner, repo, rev, sha256 }: builtins.fetchTarball {
  inherit sha256;
  url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
};

nixpkgs = fetcher {
    owner  = "NixOS";
    repo   = "nixpkgs-channels";
    rev    = "d16a7abceb72aac85e0deb8c45fbcb7127baf628";
    sha256 = "0byf6rlwwy70v2sdfmv7mnwd0kvxmlq0pi8ijghg0mcfhcqibgh7";
  };

pkgs = import nixpkgs {};

in pkgs.runCommand "dummy" {
  buildInputs = [ pkgs.nixops pkgs.sqlite pkgs.python27Packages.nixpart0 ];
} ""

But that doesn't work either.

Problem is, I do not understand what is going wrong properly. It appears to have something to do with nixpart.

paluh commented 4 years ago

This seems to be cause on the current nixpkgs/master:

https://github.com/NixOS/nixpkgs/issues/70980#issuecomment-575884859

paluh commented 4 years ago

This should be fixed on the master now thanks to the @jtojnar quick reaction.

I'm not sure if we can close this for now?

jtojnar commented 4 years ago

I would think this was fixed until recently based on https://github.com/NixOS/nixpkgs/commit/c64e17b68dee9e04510ed5ddfdd6ac53664eb845. Then I broke it in https://github.com/NixOS/nixpkgs/commit/56e557257df675bc6b2cbebf3ba5bc6d51b2321c and it should be fixed again on https://github.com/NixOS/nixpkgs/commit/07b8ab4ff791dc8bcfeea643fd9a1fbedc534bbd. Could someone test if this works now?

paluh commented 4 years ago

@jtojnar I think that to test this on master we have to also bump nixops version (which has not been released yet) because of this: https://github.com/NixOS/nixops/commit/61abd34c4a67a230f0823af805a9e7439a9ba3be

mkg20001 commented 4 years ago

Just deployed with NixOps 1.7pre2764_932bf43

Works fine