bash: ./binary: No such file or directory

Problem

The binary file exists in the directory, it has exec permission, but it doesn’t run and throws error given in the title

Solution

check the file by

file binary

it returns

binary: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.0.30, not stripped

So the problem is that my Ubuntu is a 64-bit system, but the file is 32-bit

To solve this, I need to add the i386 architecture and install the three library packages libc6:i386libncurses5:i386, and libstdc++6:i386

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386

Then the file can run properly

Reference

https://stackoverflow.com/questions/37767448/trouble-with-running-binary-file-on-ubuntu

https://askubuntu.com/questions/454253/how-to-run-32-bit-app-in-ubuntu-64-bit

发表评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据