Coder Social home page Coder Social logo

Comments (14)

leotaku avatar leotaku commented on August 21, 2024 1

@kalbasit If you want a temporary fix before #34 goes away, this is (a simplified version of) what I use in my personal RPI deployment:

{
  network = {
    description = "RPI3 Server";
    pkgs = (import <nixpkgs> {
      system = "aarch64-linux";
    });
  };

  "nixos-rpi.local" = { config, pkgs, ... }: {
     # stuff...
  };
}

from morph.

johanot avatar johanot commented on August 21, 2024 1

Sure. I'll give it a shot sometime in the next couple of days and get back to you.

Perfect. We've merged #67 to master now, since all our tests had good results. We're cutting a release momentarily and PR'ing that against nixpkgs. However; very interested in the result of your test still. If we still see issues, we'll do a bugfix release.

from morph.

kalbasit avatar kalbasit commented on August 21, 2024

I also tried with the nixpkgs given in the example and I got the same issue.

  # Pin the deployment package-set to a specific version of nixpkgs
  pkgs = import (builtins.fetchTarball {
    url = "https://github.com/NixOS/nixpkgs-channels/archive/98c1150f2cc62b94b693dce63adc1fbcbfe616f1.tar.gz";
    sha256 = "1mdwn0qrjc8jli8cbi4cfkar6xq15l232r371p4b48v2d4bah3wp";
  }) {};

from morph.

johanot avatar johanot commented on August 21, 2024

@kalbasit Thanks for reporting. Strange... Sounds like the wrong interpreter is being used. Bash? That would explain command not found, when the shell tries to exec use .... This could happen of course, if the shebang is not being read/interpreted correctly.

I just found a random switch-to-configuration script from one of my x86_64 systems. The shebang is: #! /nix/store/c8sbqdfvykyp3lgd2fcphr9rzr3l92vw-perl-5.28.1/bin/perl -I/nix/store/njlwlvhjj5v41wkly5m5fqhl7gm8ipla-perl5.28.1-File-Slurp-9999.26/lib/perl5/site_perl -I/nix/store/3400256pm5dmbnhr1mykvppkgp5mk1c4-perl5.28.1-Net-DBus-1.1.0/lib/perl5/site_perl -I/nix/store/azrfqx8wjmjh5niyghf39nymcz05g077-perl5.28.1-XML-Parser-2.44/lib/perl5/site_perl -I/nix/store/mw5ggn3cqkz7fz18p3n3vbhycgd5id5g-perl5.28.1-XML-Twig-3.52/lib/perl5/site_perl

Could it be an aarch-variant of: https://lwn.net/Articles/779997/ ?

Can you paste the shebang of your switch-to-configuration-script, and perhaps the kernel version here?

from morph.

kalbasit avatar kalbasit commented on August 21, 2024

Yea I see the shebang is perl.

#! /nix/store/4h33limcvfdr6ivyjqfbzr6k62y8ipjg-perl-5.28.2/bin/perl -I/nix/store/qb80pgq401g9pc5mjxlmd6ynd76c47xx-perl5.28.2-File-Slurp-9999.27/lib/perl5/site_perl -I/nix/store/xbv2g30ik34g9kixgqylgwjbkn93xkvv-perl5.28.2-Net-DBus-1.1.0/lib/perl5/site_perl -I/nix/store/cwx0j181avl4x8p2cbba3s438a8cxa31-perl5.28.2-XML-Parser-2.44/lib/perl5/site_perl -I/nix/store/r8cqgfn69fz1ckg6ir63d9avc5mgqhpb-perl5.28.2-XML-Twig-3.52/lib/perl5/site_perl

Does morph execute bash switch-to-configuration? I think it should just execute the switch-to-configuration directly given that it's executable with a shebang.

cc @grahamc

from morph.

johanot avatar johanot commented on August 21, 2024

It looks like the famous kernel bug to be honest :) what is your target kernel version?

No, morph doesn't enforce Bash or any other interpreter.

from morph.

kalbasit avatar kalbasit commented on August 21, 2024

@johanot whatever kernel is currently shipped by nixpkgs-stable as well as the version used by simple.nix

  # Pin the deployment package-set to a specific version of nixpkgs
  pkgs = import (builtins.fetchTarball {
    url = "https://github.com/NixOS/nixpkgs-channels/archive/98c1150f2cc62b94b693dce63adc1fbcbfe616f1.tar.gz";
    sha256 = "1mdwn0qrjc8jli8cbi4cfkar6xq15l232r371p4b48v2d4bah3wp";
  }) {};```

from morph.

ivan avatar ivan commented on August 21, 2024

Try uname -a on the target machine. If it's 4.19.21 or 4.14.99, you can rollback, or run perl /nix/store/wckw45dkz19ncfi5nzfb736qnhzv77zg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration to finish the switch-to-configuration step, then reboot into a working kernel.

from morph.

kalbasit avatar kalbasit commented on August 21, 2024
[root@kore:~]# uname -a
Linux kore 4.19.61 #1-NixOS SMP Fri Jul 26 07:14:31 UTC 2019 aarch64 GNU/Linux
[root@kore:~]# /nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration
/nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration: line 3: use: command not found
/nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration: line 4: use: command not found
/nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration: line 5: use: command not found
/nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration: line 6: use: command not found
/nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration: line 7: use: command not found
/nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration: line 8: syntax error near unexpected token `('
/nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration: line 8: `use Sys::Syslog qw(:standard :macros);'

[root@kore:~]# head /nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration
#! /nix/store/4h33limcvfdr6ivyjqfbzr6k62y8ipjg-perl-5.28.2/bin/perl -I/nix/store/qb80pgq401g9pc5mjxlmd6ynd76c47xx-perl5.28.2-File-Slurp-9999.27/lib/perl5/site_perl -I/nix/store/xbv2g30ik34g9kixgqylgwjbkn93xkvv-perl5.28.2-Net-DBus-1.1.0/lib/perl5/site_perl -I/nix/store/cwx0j181avl4x8p2cbba3s438a8cxa31-perl5.28.2-XML-Parser-2.44/lib/perl5/site_perl -I/nix/store/r8cqgfn69fz1ckg6ir63d9avc5mgqhpb-perl5.28.2-XML-Twig-3.52/lib/perl5/site_perl

use strict;
use warnings;
use File::Basename;
use File::Slurp;
use Net::DBus;
use Sys::Syslog qw(:standard :macros);
use Cwd 'abs_path';


[root@kore:~]# /nix/store/4h33limcvfdr6ivyjqfbzr6k62y8ipjg-perl-5.28.2/bin/perl -I/nix/store/qb80pgq401g9pc5mjxlmd6ynd76c47xx-perl5.28.2-File-Slurp-9999.27/lib/perl5/site_perl -I/nix/store/xbv2g30ik34g9kixgqylgwjbkn93xkvv-perl5.28.2-Net-DBus-1.1.0/lib/perl5/site_perl -I/nix/store/cwx0j181avl4x8p2cbba3s438a8cxa31-perl5.28.2-XML-Parser-2.44/lib/perl5/site_perl -I/nix/store/r8cqgfn69fz1ckg6ir63d9avc5mgqhpb-perl5.28.2-XML-Twig-3.52/lib/perl5/site_perl /nix/store/80xxmcq4l6ayjb14z3j6mkgdxn6r8kgg-nixos-system-kore-19.09pre-git/bin/switch-to-configuration
-bash: /nix/store/4h33limcvfdr6ivyjqfbzr6k62y8ipjg-perl-5.28.2/bin/perl: cannot execute binary file: Exec format error
[root@kore:~]# nix run nixpkgs.binutils -c readelf -h /nix/store/4h33limcvfdr6ivyjqfbzr6k62y8ipjg-perl-5.28.2/bin/perl
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x401270
  Start of program headers:          64 (bytes into file)
  Start of section headers:          15256 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         11
  Size of section headers:           64 (bytes)
  Number of section headers:         28
  Section header string table index: 27

I don't think I understand building systems cross-platform.

I thought adding nixpkgs.system = "aarch64-linux"; to the host configuration is enough to build an aarch64 system from an x86_64 system.

I'm going to try out @cleverca22 's module: https://nixos.wiki/wiki/NixOS_on_ARM#Crosscompiling

from morph.

johanot avatar johanot commented on August 21, 2024

@kalbasit Thanks for the extra info. Your kernel is not affected, but the wrong ELF-arch of Perl definitely explains the issue.

Based on your question about nixpkgs.system, I now suspect that what you are seeing is another face of #34. Unfortunately most of the nixpkgs.-options are not honored by morph, due to the way morph evals machine configs. We are aware of this, and it is clearly a priority to fix it. We just need to decide on the right fix.

from morph.

kalbasit avatar kalbasit commented on August 21, 2024

@leotaku thank you, I'll give it a shot then.

from morph.

johanot avatar johanot commented on August 21, 2024

@kalbasit Is it possible for you to test with: #67 ?

from morph.

kalbasit avatar kalbasit commented on August 21, 2024

@kalbasit Is it possible for you to test with: #67 ?

Sure. I'll give it a shot sometime in the next couple of days and get back to you.

from morph.

adamtulinius avatar adamtulinius commented on August 21, 2024

Please open a new issue if #67 didn't fix this.

from morph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.