Title: bitcoind: cannot execute binary file: Exec format error Post by: BlackHatCoiner on February 20, 2022, 02:42:36 PM I was trying to upgrade to 22.0, but it can't run the binaries:
Code: admin@raspibolt:/tmp/bitcoin-22.0 $ bitcoind I've downloaded bitcoin-22.0-aarch64-linux-gnu.tar.gz (https://bitcoincore.org/bin/bitcoin-core-22.0/bitcoin-22.0-aarch64-linux-gnu.tar.gz) and according to my RPi 4 (https://bitcointalk.org/index.php?topic=5158920.msg58599892#msg58599892), I need ARMv7 binaries. Raspibolt (https://raspibolt.org/bitcoin-core.html) tells me to download this as well: Quote from: https://raspibolt.org/bitcoin-core.html Code: # download Bitcoin Core binary Any idea what's wrong? No help from Google. Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: n0nce on February 20, 2022, 05:16:21 PM I was trying to upgrade to 22.0, but it can't run the binaries: It is trying to execute the binary at the path /usr/local/bin/bitcoind and not /tmp/bitcoin-22.0/bitcoind. For whatever reason, whatever's at /usr/local/bin/bitcoind is somehow faulty.Code: admin@raspibolt:/tmp/bitcoin-22.0 $ bitcoind I've downloaded bitcoin-22.0-aarch64-linux-gnu.tar.gz (https://bitcoincore.org/bin/bitcoin-core-22.0/bitcoin-22.0-aarch64-linux-gnu.tar.gz) and according to my RPi 4 (https://bitcointalk.org/index.php?topic=5158920.msg58599892#msg58599892), I need ARMv7 binaries. Raspibolt (https://raspibolt.org/bitcoin-core.html) tells me to download this as well: Quote from: https://raspibolt.org/bitcoin-core.html Code: # download Bitcoin Core binary Any idea what's wrong? No help from Google. You're missing a mere 2 characters... ;D It should be: admin@raspibolt:/tmp/bitcoind-22.0 $ ./bitcoind Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: BlackHatCoiner on February 20, 2022, 05:23:46 PM It is trying to execute the binary at the path /usr/local/bin/bitcoind and not /tmp/bitcoin-22.0/bitcoind. Same thing happens when I execute it with ./ in /tmp/bitcoin-22.0/bin.Code: admin@raspibolt:/tmp/bitcoin-22.0/bin $ ./bitcoind According to others who had the same issue, it's just something wrong with the architecture. The problem is that I've looked it up and I'm using the correct architecture: Arch 64-bit. For whatever reason, whatever's at /usr/local/bin/bitcoind is somehow faulty. Well... It's probably the binaries of 0.21.1. I didn't uninstall it. I just stopped it and redid the installation, but with 22.0 this time.Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: n0nce on February 20, 2022, 05:46:36 PM It is trying to execute the binary at the path /usr/local/bin/bitcoind and not /tmp/bitcoin-22.0/bitcoind. Same thing happens when I execute it with “./” in /tmp/bitcoin-22.0/bin.Code: admin@raspibolt:/tmp/bitcoin-22.0/bin $ ./bitcoind According to others who had the same issue, it's just something wrong with the architecture. The problem is that I've looked it up and I'm using the correct architecture: Arch 64-bit. It is possible that you're running 32-bit Linux on a 64-bit CPU. Then, 64-bit binaries won't run on it even if you have the required hardware. While it's not possible running x86 OS on ARM CPU, it's possible you simply got x86 binaries instead of ARM, but it doesn't seem the case. Worth verifying though. Simplest thing in my opinion, is avoiding binaries and compiling yourself; takes a bit more time and a few more steps, but gives better security (less trust) & it will run. ;D For whatever reason, whatever's at /usr/local/bin/bitcoind is somehow faulty. Well... It's probably the binaries of 0.21.1. I didn't uninstall it. I just stopped it and redid the installation, but with 22.0 this time.Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: PawGo on February 20, 2022, 05:53:24 PM What is your kernel?
What is the output of Code: uname -a As they said: (https://ispltd.org/desktops:arch_on_raspberry_pi4) Raspberry Pi 4 uses an ARMv7 processor according to its /proc/cpuinfo file, although Wikipedia says that it is an ARM Cortex A72, which is an ARMv8 model. The v7 architecture is 32-bit architecture while the v8 is 64-bit. I don't know why they mix these two architectures, but presume that the 32-bit code can run on a 64-bit chip and point out my observations here for your awareness. If you have indeed 32bit OS, would it be possible to change it? https://downloads.raspberrypi.org/raspios_arm64/images/ Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: BlackHatCoiner on February 20, 2022, 06:00:11 PM Worth verifying though. How? The Bitcoin Core download page shows both 64 and 32 bit binaries and I'm sure I choose the former. (I also tried with the latter, but same error)Simplest thing in my opinion, is avoiding binaries and compiling yourself; takes a bit more time and a few more steps, but gives better security (less trust) & it will run. How does it give better security and less trust if I'm verifying the signature of the installer? Also, why will it then run? Is it going to build it according to my OS, architecture etc.?What is your kernel? What is the output of Code: uname -a Code: admin@raspibolt:/usr/local/bin $ uname -a If you have indeed 32bit OS, would it be possible to change it? This sounds like a big trouble.https://downloads.raspberrypi.org/raspios_arm64/images/ Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: n0nce on February 20, 2022, 06:06:06 PM Worth verifying though. How? The Bitcoin Core download page shows both 64 and 32 bit binaries and I'm sure I choose the former. (I also tried with the latter, but same error)Simplest thing in my opinion, is avoiding binaries and compiling yourself; takes a bit more time and a few more steps, but gives better security (less trust) & it will run. How does it give better security and less trust if I'm verifying the signature of the installer? Also, why will it then run? Is it going to build it according to my OS, architecture etc.?It will also indeed detect the right OS and architecture & build a binary that runs on it. What is your kernel? What is the output of Code: uname -a Code: admin@raspibolt:/usr/local/bin $ uname -a Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: PawGo on February 20, 2022, 06:07:52 PM Exactly. But what happens when you try to launch a precompiled arm version from bitcoin download site?
Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: vv181 on February 20, 2022, 06:11:15 PM What is your kernel? What is the output of Code: uname -a Code: admin@raspibolt:/usr/local/bin $ uname -a Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: BlackHatCoiner on February 20, 2022, 07:27:33 PM Well, the signature proves nobody messed with the download in transit, but someone could have uploaded a malicious binary to the official download page itself. That's why I'm verifying the signatures. Because, the developers' public keys are outside the download page. An attacker needs to compromise both keys.ubuntu.com and bitcoincore.org. If you also verify PGP, you can know that a trusted developer built and uploaded the binary, but a developer can also become malicious. But, there's this trust whether I build the source code myself or not, unless I check every single line. Even if I do, I have to trust my coding skills. If we reach to the point where we don't trust the developers, then it's a dead end. Seems like this is 32-bit Linux. Is it the ArmV7 that made you conclude so? Damn, I haven't used to use Linux yet. So maybe just try installing the 32-bit version of the software. As I said, I did. I downloaded bitcoin-22.0-arm-linux-gnueabihf.tar.gz (which is 32-bit) and it prompt the same error.The earlier version of Raspibolt was indeed using 32bit OS. How early? I set it up in August. Exactly. But what happens when you try to launch a precompiled ‘arm’ version from bitcoin download site? Isn't bitcoin-22.0-aarch64-linux-gnu.tar.gz considered pre-compiled? Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: vv181 on February 20, 2022, 08:25:42 PM The earlier version of Raspibolt was indeed using 32bit OS. How early? I set it up in August. [1] https://github.com/raspibolt/raspibolt/releases The V2 tutorial of Bitcoin installation was placed on "/usr/local/bin". If the downloaded 32bit file isn't executable, I would suggest comparing both of the binary using "file ./bitcoind" command to make sure the file is in the correct architecture. Code: file /usr/local/bin/bitcoind Or maybe you can try the V2 upgrade guide: https://v2.raspibolt.org/raspibolt_30_bitcoin.html#installation Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: BlackHatCoiner on February 20, 2022, 09:13:48 PM As on their Github page[1], they migrated to Raspibolt V3 on 8 December 2021. The former of that date is using Raspibolt V2, which was using 32bit. Yep, that's what I had. I reinstalled it and the problem was magically resolved. But, I now have another one:Code: bitcoin@raspibolt:~ $ bitcoind It seems like it fails binding to RPC. I tried to restart Tor, nothing, I rebooted RPi, nothing, I killed Tor & Bitcoin processes and restarted, nope. That's my configuration file: Code: # RaspiBolt: bitcoind configuration Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: vv181 on February 21, 2022, 12:18:45 AM Code: 2022-02-20T21:06:09Z Binding RPC on address 127.0.0.1 port 8332 failed. Code: sudo netstat -lp | grep 8332 If the output shows the port, I think the bitcoin daemon is already running because of the default Raspibolt service configuration. Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: n0nce on February 21, 2022, 10:30:43 AM Well, the signature proves nobody messed with the download in transit, but someone could have uploaded a malicious binary to the official download page itself. That's why I'm verifying the signatures. Because, the developers' public keys are outside the download page. An attacker needs to compromise both keys.ubuntu.com and bitcoincore.org. If you also verify PGP, you can know that a trusted developer built and uploaded the binary, but a developer can also become malicious. But, there's this trust whether I build the source code myself or not, unless I check every single line. Even if I do, I have to trust my coding skills. If we reach to the point where we don't trust the developers, then it's a dead end. Building: Trust the source code is fine. Downloading: Trust the source code is fine + Trust the person who built & uploaded it didn't mess with the code before building. That's where the concept of verifiable / reproducible builds come in. It allows to prove a certain binary was built from a certain codebase (without modifications to the codebase); I don't think that verifying Core builds is commonly done (or possible?) though. Seems like this is 32-bit Linux. Is it the ArmV7 that made you conclude so? Damn, I haven't used to use Linux yet. https://en.wikipedia.org/wiki/ARM_architecture#32-bit_architecture So maybe just try installing the 32-bit version of the software. As I said, I did. I downloaded bitcoin-22.0-arm-linux-gnueabihf.tar.gz (which is 32-bit) and it prompt the same error.Did you follow the normal Bitcoin Core guide? https://bitcoin.org/en/full-node#linux-instructions Code: tar xzf bitcoin-22.0-arm-linux-gnueabihf.tar.gz I'm also not 100% sure if it runs directly out of the download directory or for whatever reason needs to be installed with the sudo install... (don't think that's the issue based on that error message though). Regarding port bindings, probably your existing Bitcoin Core is still running. Even if you shut it down using bitcoin-cli stop, it will come back up. You will need to locate the service name (e.g. bitcoin-service, then stop it with sudo service bitcoin-service stop). After stopping the service, install the new version. Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: BlackHatCoiner on February 21, 2022, 03:01:47 PM I don't know for sure but maybe the port is already being used. Try to verify and see which application is using it with the below command: It's used:Code: bitcoin@raspibolt:~ $ sudo netstat -lp | grep 8332 I, then, kill those processes: Code: bitcoin@raspibolt:~ $ kill -9 27931 Re-called bitcoind, same error. And few minutes afterwards, it's working. I don't know if it's a miracle, but it's syncing right now. I just redid the exact thing above. I honestly can't understand Linux often. Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: n0nce on February 21, 2022, 04:10:50 PM I'm also not 100% sure if it runs directly out of the download directory or for whatever reason needs to be installed with the sudo install... (don't think that's the issue based on that error message though). You can run Bitcoin Core direlty after you extract the archive. Usually i do that since i don't want to bother with update or uninstall. Using sudo install is only needed if you want Bitcoin Core integrated on your system. Regarding port bindings, probably your existing Bitcoin Core is still running. Even if you shut it down using bitcoin-cli stop, it will come back up. You will need to locate the service name (e.g. bitcoin-service, then stop it with sudo service bitcoin-service stop). After stopping the service, install the new version. Unless OP use different directory between old and new version, Bitcoin Core should quit earlier due with error message "Cannot obtain a lock on data directory".And few minutes afterwards, it's working. I don't know if it's a miracle, but it's syncing right now. I just redid the exact thing above. I honestly can't understand Linux often. It was probably still exiting. -9 gives the normal shutdown signal (no 'hard kill'); I believe bitcoind captures it and exits cleanly (but it does take a bit to flush everything to disk).Happy to hear you got it running! Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: NotATether on February 23, 2022, 11:05:19 AM As others have already mentioned, you tried to run ARM64 binaries on an ARM32 OS (aarch64 software is for ARM64 hardware :))
It was probably still exiting. -9 gives the normal shutdown signal (no 'hard kill'); I believe bitcoind captures it and exits cleanly (but it does take a bit to flush everything to disk). -9 actually sends SIGKILL which terminates the process immediately. Perhaps the OS was still cleaning up the port resources and he restarted Core too quickly. Happens to me sometimes with other software. Title: Re: bitcoind: cannot execute binary file: Exec format error Post by: n0nce on February 23, 2022, 11:09:32 AM -9 actually sends SIGKILL which terminates the process immediately. Perhaps the OS was still cleaning up the port resources and he restarted Core too quickly. Happens to me sometimes with other software. Oh wow, that's good to know, I totally misremembered, thanks! Always been using -9 under the impression it's basically CTRL+C if running something directly on cli (not as daemon)..CTRL+C indeed corresponds to SIGINT (-2) instead. |