RadxaOS-SDK / rsdk

Managed Development Environment for RadxaOS
https://radxaos-sdk.github.io/rsdk/
GNU General Public License v3.0
11 stars 10 forks source link

vscode+devcontainers w/Macos arm64 not working #29

Open orlyprofili opened 1 month ago

orlyprofili commented 1 month ago

Is this actually a rate limiting issue?

I've tried several ways, but it simply won't complete the building of rsdk and breaks with same message, consistently.

Aside (for zsh or other non-bash users, it may be useful to document that they should set: "terminal.integrated.defaultProfile.linux": "bash", In devcontainers.json. The rsdk script uses bash specific commands like shopt)

Using colima instead of docker desktop to run the daemon fairs worse, so I'm continuing with docker desktop.

I've cleaned out all docker builds, caches, etc and started fresh. This consistently happened. Is this a github rate limiting issue or another problem? I tried with a GITHUB PAT and the result is the same.

Here is the error message, and then trying again with a PAT. (all tokens/keys have been redacted):

direnv: loading /workspaces/rsdk/.envrc direnv: loading https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc (sha256-XXXX) direnv: using devenv direnv: .envrc changed, reloading error: … while fetching the input 'git+file:///workspaces/rsdk'

   error:
   error: opening Git repository '"/workspaces/rsdk"': repository path '/workspaces/rsdk/' is not owned by current user

✖ Command produced the following output:

Error: × Command /nix/store/as63rjja0x63d1kw7d8xagb9s7glvwkl-nix-devenv-2.21.0pre20240412_b24a931/bin/nix --show-trace --extra-experimental- │ features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 6 --option eval-cache false │ print-dev-env --profile /workspaces/rsdk/.devenv/gc/shell failed with with exit code 1

direnv: loading the environment failed direnv: error exit status 1 vscode ➜ /workspaces/rsdk $ mkdir -p ~/.config/nix/ && echo 'access-tokens = github.com=XXXXXX' >> ~/.config/ni x/nix.conf && src/bin/rsdk setup deb [arch-=arm64,riscv64] http://archive.ubuntu.com/ubuntu/ jammy main restricted deb [arch-=arm64,riscv64] http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted deb [arch-=arm64,riscv64] http://archive.ubuntu.com/ubuntu/ jammy universe deb [arch-=arm64,riscv64] http://archive.ubuntu.com/ubuntu/ jammy-updates universe deb [arch-=arm64,riscv64] http://archive.ubuntu.com/ubuntu/ jammy multiverse deb [arch-=arm64,riscv64] http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse deb [arch-=arm64,riscv64] http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse deb [arch-=arm64,riscv64] http://security.ubuntu.com/ubuntu/ jammy-security main restricted deb [arch-=arm64,riscv64] http://security.ubuntu.com/ubuntu/ jammy-security universe deb [arch-=arm64,riscv64] http://security.ubuntu.com/ubuntu/ jammy-security multiverse deb [arch=arm64,riscv64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse deb [arch=arm64,riscv64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse deb [arch=arm64,riscv64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse deb [arch=arm64,riscv64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse Hit:1 http://security.ubuntu.com/ubuntu jammy-security InRelease Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy InRelease Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease Hit:5 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease Hit:6 http://archive.ubuntu.com/ubuntu jammy-backports InRelease Hit:7 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease Hit:8 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease Reading package lists... Done Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Reading package lists... Done Building dependency tree... Done Reading state information... Done bash-completion is already the newest version (1:2.11-5ubuntu1). binfmt-support is already the newest version (2.2.1-2). libfakeroot is already the newest version (1.28-1ubuntu1). libfakeroot:riscv64 is already the newest version (1.28-1ubuntu1). bdebstrap is already the newest version (0.4.0-1). debian-archive-keyring is already the newest version (2021.1.1ubuntu2). debian-ports-archive-keyring is already the newest version (2022.02.15). libfakechroot is already the newest version (2.20.1+ds-2). libfakechroot:riscv64 is already the newest version (2.20.1+ds-2). qemu-user-static is already the newest version (1:6.2+dfsg-2ubuntu6.21). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Name: cachix Store paths: /nix/store/l5bymdl1wy7m6ih5p0fziczdrg3jfxvg-cachix-1.7.4-bin Locked flake URL: github:cachix/devenv/6e318854efa95c5e67a1152547f838754e8f0306?narHash=sha256-XXXX Configured https://devenv.cachix.org binary cache in /home/vscode/.config/nix/nix.conf warning: 'flake:devenv#packages.aarch64-linux.default' is already installed • Building shell ... error: … while fetching the input 'git+file:///workspaces/rsdk'

   error:
   error: opening Git repository '"/workspaces/rsdk"': repository path '/workspaces/rsdk/' is not owned by current user

✖ Command produced the following output:

✔ Building shell in 0.1s. Error: × Command /nix/store/as63rjja0x63d1kw7d8xagb9s7glvwkl-nix-devenv-2.21.0pre20240412_b24a931/bin/nix --show-trace --extra-experimental- │ features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 6 --option eval-cache false │ print-dev-env --profile /workspaces/rsdk/.devenv/gc/shell failed with with exit code 1

You might be rate limited by GitHub. Please request a PAT from GitHub website, and add it to your Dev Container: mkdir -p ~/.config/nix/ && echo 'access-tokens = github.com=YOUR_GITHUB_PAT' >> ~/.config/nix/nix.conf && src/bin/rsdk setup You can run above command in a new terminal once you complete this one. Press Enter to continue... direnv: loading /workspaces/rsdk/.envrc direnv: loading https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6dee421cfd0f51481d17f77586997/direnvrc (sha256-XXXX) direnv: using devenv direnv: .envrc changed, reloading error: … while fetching the input 'git+file:///workspaces/rsdk'

   error:
   error: opening Git repository '"/workspaces/rsdk"': repository path '/workspaces/rsdk/' is not owned by current user

✖ Command produced the following output:

Error: × Command /nix/store/as63rjja0x63d1kw7d8xagb9s7glvwkl-nix-devenv-2.21.0pre20240412_b24a931/bin/nix --show-trace --extra-experimental- │ features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 6 --option eval-cache false │ print-dev-env --profile /workspaces/rsdk/.devenv/gc/shell failed with with exit code 1

direnv: loading the environment failed direnv: error exit status 1 vscode ➜ /workspaces/rsdk $

RadxaYuntian commented 1 month ago

error: opening Git repository '"/workspaces/rsdk"': repository path '/workspaces/rsdk/' is not owned by current user

This should be your real cause. Might want to check your file permissions and UID stuff.

orlyprofili commented 1 month ago

@RadxaYuntian yes, that's indeed it.

I added "remoteUser": "root" to devcontainer.json and that got me further, but not all the way, see below. Looks like nix package libguestfs-appliance-1.46.0 isn't available aarch64.

I'm currently looking into workarounds, not successful yet.

• Trusting devenv.cachix.org on first use with the public key devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw= error: … while calling the 'derivationStrict' builtin at <nix/derivation-internal.nix>:9:12: 8| 9| strict = derivationStrict drvAttrs; | ^ 10|

   … while evaluating derivation 'devenv-shell'
     whose name attribute is located at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/stdenv/generic/make-derivation.nix:331:7

   … while evaluating attribute 'DEVENV_PROFILE' of derivation 'devenv-shell'

   … while evaluating derivation 'devenv-profile'
     whose name attribute is located at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/stdenv/generic/make-derivation.nix:331:7

   … while evaluating attribute 'passAsFile' of derivation 'devenv-profile'
     at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/build-support/trivial-builders/default.nix:69:9:
       68|         inherit buildCommand name;
       69|         passAsFile = [ "buildCommand" ]
         |         ^
       70|           ++ (derivationArgs.passAsFile or [ ]);

   … while evaluating derivation 'guestfs-tools-1.52.0'
     whose name attribute is located at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/stdenv/generic/make-derivation.nix:331:7

   … while evaluating attribute 'buildInputs' of derivation 'guestfs-tools-1.52.0'
     at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/stdenv/generic/make-derivation.nix:378:7:
      377|       depsHostHost                = elemAt (elemAt dependencies 1) 0;
      378|       buildInputs                 = elemAt (elemAt dependencies 1) 1;
         |       ^
      379|       depsTargetTarget            = elemAt (elemAt dependencies 2) 0;

   … while evaluating derivation 'libguestfs-1.50.1'
     whose name attribute is located at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/stdenv/generic/make-derivation.nix:331:7

   … while evaluating attribute 'postFixup' of derivation 'libguestfs-1.50.1'
     at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/development/libraries/libguestfs/default.nix:133:3:
      132|
      133|   postFixup = lib.optionalString (appliance != null) ''
         |   ^
      134|     mkdir -p $out/{lib,lib64}

   … from call site
     at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/development/libraries/libguestfs/default.nix:133:15:
      132|
      133|   postFixup = lib.optionalString (appliance != null) ''
         |               ^
      134|     mkdir -p $out/{lib,lib64}

   … while calling 'optionalString'
     at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/lib/strings.nix:268:5:
      267|     # String to return if condition is true
      268|     string: if cond then string else "";
         |     ^
      269|

   … from call site
     at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/stdenv/generic/check-meta.nix:511:13:
      510|           else if valid == "no" then (
      511|             handleEvalIssue { inherit meta attrs; } { inherit (validity) reason errormsg; }
         |             ^
      512|           )

   … while calling 'handleEvalIssue'
     at «github:NixOS/nixpkgs/1e3deb3d8a86a870d925760db1a5adecc64d329d»/pkgs/stdenv/generic/check-meta.nix:269:38:
      268|
      269|   handleEvalIssue = { meta, attrs }: { reason , errormsg ? "" }:
         |                                      ^
      270|     let

   error:
   error: Package ‘libguestfs-appliance-1.46.0’ in /nix/store/virtual0000000000000000000000007-source/pkgs/development/libraries/libguestfs/appliance.nix:25 is not available on the requested hostPlatform:
     hostPlatform.config = "aarch64-unknown-linux-gnu"
     package.meta.platforms = [
       "i686-linux"
       "x86_64-linux"
     ]
     package.meta.badPlatforms = [ ]
   , refusing to evaluate.

   a) To temporarily allow packages that are unsupported for this system, you can use an environment variable
      for a single invocation of the nix tools.

        $ export NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1

      Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
            then pass `--impure` in order to allow use of environment variables.

   b) For `nixos-rebuild` you can set
     { nixpkgs.config.allowUnsupportedSystem = true; }
   in configuration.nix to override this.

   c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
     { allowUnsupportedSystem = true; }
   to ~/.config/nixpkgs/config.nix.

✖ Command produced the following output:

✔ Building shell in 9.1s. Error: x Command /nix/store/as63rjja0x63d1kw7d8xagb9s7glvwkl-nix-devenv-2.21.0pre20240412_b24a931/bin/nix --show-trace --extra- | experimental-features nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max- | jobs 6 --option eval-cache false print-dev-env --profile /workspaces/rsdk/.devenv/gc/shell --option extra-substituters | https://devenv.cachix.org --option extra-trusted-public-keys devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/ | Hm9XgU50cw= failed with with exit code 1

You might be rate limited by GitHub. Please request a PAT from GitHub website, and add it to your Dev Container: mkdir -p ~/.config/nix/ && echo 'access-tokens = github.com=YOUR_GITHUB_PAT' >> ~/.config/nix/nix.conf && src/bin/rsdk setup You can run above command in a new terminal once you complete this one. Press Enter to continue...

RadxaYuntian commented 1 month ago

Can you run devenv update and try again. This package is now available in aarch64, but the lock file was pinned to previous release.

orlyprofili commented 1 month ago

root ➜ /workspaces/rsdk (main) $ devenv update • Updating devenv.lock ... ✔ Updating devenv.lock in 7.5s. root ➜ /workspaces/rsdk (main) $ devenv build • Using Cachix: devenv error: error: flake 'git+file:///workspaces/rsdk' does not provide attribute 'packages.aarch64-linux.default' or 'defaultPackage.aarch64-linux'

✖ Command produced the following output:

Error: × Command /nix/store/as63rjja0x63d1kw7d8xagb9s7glvwkl-nix-devenv-2.21.0pre20240412_b24a931/bin/nix --show-trace --extra-experimental-features │ nix-command --extra-experimental-features flakes --option warn-dirty false --keep-going --max-jobs 6 --option eval-cache false build --option │ extra-substituters https://devenv.cachix.org --option extra-trusted-public-keys devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/ │ Hm9XgU50cw= failed with with exit code 1

RadxaYuntian commented 1 month ago

We don't use devenv build as we do not define any package. You can run devenv shell or rsdk shell.

orlyprofili commented 1 month ago

I tried this as well, the result was same for devenv shell. At this point in the build, rsdk is not found, as the paths didn't get set. If I apply the path export from devenv.nix such that rsdk is found, the result is same as above. After running devenv update, it's still pointing to libguestfs-appliance-1.46.0, and I believe we're looking for >1.50 for aarch64 support.

RadxaYuntian commented 1 month ago

After running devenv update, it's still pointing to libguestfs-appliance-1.46.0, and I believe we're looking for >1.50 for aarch64 support.

I have updated the lock file and I now have 1.50 for libguestfs:

vscode ➜ /workspaces/rsdk (main) $ which guestfish 
/nix/store/f24d8qbffr3j86w820hlvz5q3zci4rij-libguestfs-1.50.1/bin/guestfish

At this point in the build, rsdk is not found, as the paths didn't get set.

TBH I don't know how you can install binfmt support on MacOS with devcontainer. I know docker runs in VM on MacOS but I'm not sure how you are going to modify the base Linux system there. You might want to create a VM explicitly and follow this guide.