pkgxdev / pkgx

the last thing you’ll install
https://pkgx.sh
Apache License 2.0
8.81k stars 1.36k forks source link

cannot execute: required file not found #987

Closed technodrome closed 3 months ago

technodrome commented 3 months ago

Le problem

A Poirotian mystery. Ran a simple one-off, but some file is missing. Is it a murder? Kidnapping? Or not enough coffee on my part? Would be nice to have some output on what file it is pkgx is so violently looking for, so that it takes its own life in the end.

pi@k3s-master:~ $ wget https://github.com/pkgxdev/pkgx/releases/download/v1.1.6/pkgx-1.1.6+linux+aarch64.tar.xz
pi@k3s-master:~ $ tar -xv -f pkgx-1.1.6+linux+aarch64.tar.xz && chmod +x pkgx
pi@k3s-master:~ $ ./pkgx
-bash: ./pkgx: cannot execute: required file not found

The same happens when running via install script, copy succeeds.

curl -fsS https://pkgx.sh | sh
installing: /usr/local/bin/pkgx
######################################################################## 100.0%
sh: 87: pkgx: not found

i.e. this line: https://github.com/pkgxdev/setup/blob/main/installer.sh#L86C5-L87C19

Le environment

pi@k3s-master:~ $ ldd --version
ldd (Debian GLIBC 2.36-9+rpi1+deb12u4) 2.36
Copyright (C) 2022 Free Software Foundation, Inc.
pi@k3s-master:~ $ lsb_release -a
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 12 (bookworm)
Release:    12
Codename:   bookworm
pi@k3s-master:~ $ uname -a
Linux k3s-master 5.10.103-v8+ #1529 SMP PREEMPT Tue Mar 8 12:26:46 GMT 2022 aarch64 GNU/Linux
pi@k3s-master:~ $ cat /proc/cpuinfo
...shortened...

Hardware    : BCM2835
Revision    : c03111
Model       : Raspberry Pi 4 Model B Rev 1.1
dosubot[bot] commented 3 months ago

Ah, @technodrome, back again with another enigmatic puzzle for our collective brains to solve! The game is afoot! 🕵️‍♂️✨

Based on the information you've provided and the context from the pkgx repository, it seems like the "required file not found" error could be related to a missing file or library that pkgx is trying to access when it's executed.

In the test case labeled "file path but doesn’t exist" in the src/modes/x.test.ts file, pkgx is executed with a file path that does not exist on the filesystem, leading to a failure captured by asserting a rejection with PkgxError. This could potentially manifest as a "required file not found" error to the user.

As for the specific files or libraries required for the pkgx executable to run successfully on a Raspberry Pi 4 Model B Rev 1.1 running Raspbian GNU/Linux 12 (bookworm), the Dockerfile in the repository indicates that the following dependencies are needed:

These dependencies are installed with the command apt-get update && apt --yes install libc-dev libstdc++-8-dev libgcc-8-dev netbase libudev-dev during the build process of the stage1 image. You can find this in the .github/Dockerfile file.

Unfortunately, I couldn't find any specific information on the exact file or dependency that pkgx is trying to access when it throws the "required file not found" error, nor any known issues with pkgx running on Raspbian GNU/Linux 12 (bookworm).

To help narrow down the issue, could you provide more details about the error? For example, are there any error messages in the system logs or any additional output when the error occurs? Also, could you confirm whether all the required dependencies are installed and up-to-date on your system?

Sources

#### About Dosu This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot.
jhheider commented 3 months ago

hm, your steps work on my rpi4, but it already has pkgx installed. if you run strace ./pkgx 2>&1 | grep open hopefully it'll tell us what it's failing on.

technodrome commented 3 months ago

Now I'm really confused:

pi@k3s-master:~/pkgx $ l
total 161M
drwxr-xr-x  2 pi pi 4.0K Mar 13 20:32 .
drwxr-xr-x 13 pi pi 4.0K Mar 13 20:28 ..
-rwxr-xr-x  1 pi pi 129M Jan 28 15:54 pkgx
-rw-r--r--  1 pi pi  32M Jan 28 15:55 pkgx-1.1.6+linux+aarch64.tar.xz
pi@k3s-master:~/pkgx $ strace ./pkgx 2>&1
execve("./pkgx", ["./pkgx"], 0xffdd7180 /* 27 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++

The file is right there.

pi@k3s-master:~/pkgx-test $ file pkgx
pkgx: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, with debug_info, not stripped
pi@k3s-master:~/pkgx-test $ readelf -d pkgx

Dynamic section at offset 0x4f9bf08 contains 32 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-aarch64.so.1]
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW PIE
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000007 (RELA)               0x10860
 0x0000000000000008 (RELASZ)             3050472 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          127061
 0x0000000000000017 (JMPREL)             0x2f9448
 0x0000000000000002 (PLTRELSZ)           8688 (bytes)
 0x0000000000000003 (PLTGOT)             0x4fbd9a0
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000006 (SYMTAB)             0x320
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0xa104
 0x000000000000000a (STRSZ)              26459 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x8720
 0x0000000000000019 (INIT_ARRAY)         0x4dfef90
 0x000000000000001b (INIT_ARRAYSZ)       48 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x4dfef88
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000000000000c (INIT)               0x4ded7c4
 0x000000000000000d (FINI)               0x4ded7d8
 0x000000006ffffff0 (VERSYM)             0x7be0
 0x000000006ffffffe (VERNEED)            0x85f0
 0x000000006fffffff (VERNEEDNUM)         6
 0x0000000000000000 (NULL)               0x0
jhheider commented 3 months ago

you must have /lib/ld-linux-aarch64.so.1 right? that is a very odd error.

technodrome commented 3 months ago

All right, so to make things not confusing at all, Raspbian used 64bit kernel & 32bit userland. I really did not expect that. Hence the error. We can close this, clearly that is the reason. Thanks for the assistance, @jhheider, much appreciated.

jhheider commented 3 months ago

Ha, no worries. I recall raspbian being non-standard in a bunch of ways. I think, for that reason, I'm running Ubuntu 22.04-LTS on mine.

technodrome commented 3 months ago

You've sure as hell saved yourself a few grey hairs. I'll avoid all mirrors (pun not intended) in the near future.