No such file or directory when file exists

2

1

I have a file called bitcoind in /usr/bin/bitcoind:

bitcoin@Titan:~$ ll /usr/bin | grep bitcoind
-rwxr-xr-x  1 bitcoin bitcoin 7789600 Nov 25 10:39 bitcoind*

However, I cannot execute it:

bitcoin@Titan:~$ bitcoind
-bash: /usr/bin/bitcoind: No such file or directory

sudo doesn't help:

bitcoin@Titan:~$ sudo bitcoind
sudo: unable to execute /usr/bin/bitcoind: No such file or directory

Found the suggestion that it's because it's missing some required libraries, so tried using 'ldd' to find them:

bitcoin@Titan:~$ ldd /usr/bin/bitcoin
ldd: /usr/bin/bitcoin: No such file or directory

Benedict Lewis

Posted 2014-11-25T15:51:36.900

Reputation: 135

Are you sure the file name doesn't contain any hidden characters? Verify with ls /usr/bin | grep bitcoind | xxd. – choroba – 2014-11-25T16:15:23.833

0000000: 6269 7463 6f69 6e64 0a bitcoind. – Benedict Lewis – 2014-11-25T16:54:45.203

1The ldd call misses a d at the end. – choroba – 2014-11-25T17:00:03.060

1Can you provide the ouput of file /usr/bin/bitcoind and uname -a? – chaos – 2014-11-25T18:20:44.083

@choroba Corrected ldd call returns not a dynamic executable. – Benedict Lewis – 2014-11-25T18:54:09.117

@chaos file returns /usr/bin/bitcoind: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=41aded5bd1f93bef6c7972e3b0aa7f4c38098336, stripped. uname returns Linux Titan 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux. – Benedict Lewis – 2014-11-25T18:54:49.473

Answers

2

You try to run a 32-bit executable in a 64-bit system. That's not a problem, but you need some packages on your system to be able to do that.

Add the 32-bit architecture to the package library:

sudo dpkg --add-architecture i386

Update the package cache:

sudo apt-get update

And install the needed packages:

sudo apt-get install libc6:i386 libstdc++6:i386 libncurses5:i386 

After that you should be able to execute the 32 bit executable.

A bit of background:

ldd returns not a dynamic executable because it is not a 64 bit executable, hence not a 64 bit dynamic executable. To execute a 64 bit shaed object such as your executable, there must be a dynamic linker: the linux loader. Normally it resides in /lib. In 64-bit linux systems with a 32 bit linker there are two linker/loader: The 32-bit loader in /lib32/ld-linux.so and the 64-bit loader in /lib64/ld-linux.so. A 32-bit executable need 32-bit libraries, so your executable may need some more libraries. Install them in debian based systems with apt-get install libxyz:i386.

chaos

Posted 2014-11-25T15:51:36.900

Reputation: 3 704