LoginSignup
35
17

More than 5 years have passed since last update.

bash: コマンドが確かに存在するのに "-bash: COMMAND: No such file or directory" と言われる

Posted at

起きたこと

非常にハマったのでメモ。

バイナリで渡されたあるコマンドを実行しようとして起きた。

bash: ./xxx-command: No such file or directory

だけど、そのファイルは確実に存在する。

$ ls -al xxx-command
-rwxr-xr-x 1 user user  123456 2016-01-07 15:00 xxx-command*

sudo で実行した場合は、

sudo: unable to execute ./xxx-command: No such file or directory

と出る。

原因

64bit Linux 上で、32bit ELF バイナリを実行しようとしていたのが原因だった。

$ file ./xxx-command
./xxx-command: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped.

バイナリをそのまま実行できるようにする方法

Ask Ubuntu にあった方法の

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

で実行できるようになった。

35
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
35
17