"There is no such file or directory", but it exists

I just want to run the executable from the command line, ./arm-mingw32ce-g++ , but then I get an error,

 bash: ./arm-mingw32ce-g++: No such file or directory 

I am running Ubuntu Linux 10.10. ls -l lists

 -rwxr-xr-x 1 root root 433308 2010-10-16 21:32 arm-mingw32ce-g++ 

Using sudo ( sudo ./arm-mingw32ce-g++ ) gives

 sudo: unable to execute ./arm-mingw32ce-g++: No such file or directory 

I have no idea why the OS cannot even see the file when it is. Any thoughts?

+76
command-line shell executable
Oct. 16 '10 at 14:00
source share
11 answers

This error may mean that ./arm-mingw32ce-g++ does not exist (but it is) or exists and is a dynamically linked executable file recognized by the kernel, but whose dynamic bootloader is not available. You can see which dynamic bootloader is required by running ldd /arm-mingw32ce-g++ ; all that is marked not found is a dynamic bootloader or library that you must install.

If you are trying to run a 32-bit binary on an amd64 installation:

+68
Oct. 16 '10 at 14:25
source share

I came across this error when trying to create a Selenium source on Ubuntu. A simple script shell with the correct shebang could not work even after I had all the prerequisites.

 file file-name # helped me in understanding that CRLF ending were present in the file. 

I opened the file in Vim, and I could only see it because I once edited this file on a Windows machine, it was in DOS format. I converted the file to Unix format using the command:

 dos2unix filename # actually helped me and things were fine. 

I hope that we should take care when we edit files on different platforms, we also need to take care of file formats.

+22
Sep 23 '15 at 9:29
source share

This error may occur when trying to run script and shebang with an error. Make sure it reads #!/bin/sh , #!/bin/bash or whatever interpreter you are using.

+15
Jan 27 '14 at 20:24
source share

I had the same error message when trying to run a Python script - it was an unused use case of @Warpspace (see other comments), but it was one of the best hits for my search, so maybe someone will find this useful.

In my case, ending the DOS lines ( \r\n instead of \n ) meant that the shebang line ( #!/usr/bin/env python ) would shut off. A simple dos2unix myfile.py fixed it.

+7
Feb 23 '15 at 15:50
source share

I got the same error for a simple bash script that would not have 32/64-bit issues. Perhaps this is due to the fact that there is an error in the script program you are trying to run. This ubuntu message indicates that with regular script files you can add 'sh' in front and you can get debug output from it. eg.

 $ sudo sh arm-mingw32ce-g++ 

and see if you get any result.

In my case, the actual problem was that the file I was trying to execute was in Windows format, not linux.

+4
Nov 27 '13 at 14:58
source share

The below team worked on 16.4 Ubuntu

This problem occurs when your .sh file is damaged or not formatted according to Unix protocols.

dos2unix converts the .sh file to Unix format!

 sudo apt-get install dos2unix -y dos2unix test.sh sudo chmod u+x test.sh sudo ./test.sh 
+3
Apr 20 '18 at 9:27
source share

I got this "No such file or directory" error, but it exists because my file was created on Windows, and I tried to run it on Ubuntu, and the file contained an invalid 15 \ r, wherever there was a new line. I just created a new file trimming unnecessary things.

 sleep: invalid time interval '15\r' Try 'sleep --help' for more information. script.sh: 5: script.sh: /opt/ag/cont: not found script.sh: 6: script.sh: /opt/ag/cont: not found root@Ubuntu14:/home/abc12/Desktop# vi script.sh root@Ubuntu14:/home/abc12/Desktop# od -c script.sh 0000000 # ! / usr / bin / envb 0000020 ash \r \nwgethttp : / 0000400 : 4 1 2 0 / \r \n 0000410 root@Ubuntu14:/home/abc12/Desktop# tr -d \\015 < script.sh > script.sh.fixed root@Ubuntu14:/home/abc12/Desktop# od -c script.sh.fixed 0000000 # ! / usr / bin / envb 0000020 ash \nwgethttp : / / 0000400 / \n 0000402 root@Ubuntu14:/home/abc12/Desktop# sh -x script.sh.fixed 
+2
Jan 14 '16 at 15:09
source share

I had the same problem with the file that I created on my mac. If I try to run it in a shell with. / filename, I received an error message not found in the file. I think something is wrong with the file.

What I've done:

open ssh session on server
cat filename
copy output to clipboard
rm file name
tap file name
vi file name
i for insert mode
paste content from clipboard
ESC to end insert mode
: WQ

It worked for me.

+1
12 Oct '14 at 21:44
source share

I just had this problem in mingw32 bash . I executed node / npm from Program Files (x86)\nodejs and then moved them to the disabled directory (essentially removing them from the path). I also had Program Files\nodejs (i.e. the 64 bit version) in the path, but only after the x86 version. After restarting the bash shell, you can find the 64-bit version of npm. node worked correctly all the time (verified with node -v which changed when moving the x86 version).

I think bash -r would work instead of restarting bash: https://unix.stackexchange.com/a/5610

+1
Jul 15 '16 at 8:31
source share

As already mentioned, this is because a bootloader cannot be found, not your executable. Unfortunately, the message is not clear enough.

You can fix this by changing the bootloader used by your executable, see my full answer to this other question: multiple glibc libraries on the same host

Basically you should find which bootloader it is trying to use:

 $ readelf -l arm-mingw32ce-g++ | grep interpreter [Requesting program interpreter: /lib/ld-linux.so.2] 

Then find the correct path for the equivalent bootloader and modify your executable to use the bootloader from the path that it really is:

 $ ./patchelf --set-interpreter /path/to/newglibc/ld-linux.so.2 arm-mingw32ce-g++ 

You probably will also need to specify the path of the inclusions, you will find out whether you want it or not, after you try to start it. See all the details in this other topic.

+1
Jul 11 '19 at 21:52
source share

I had this problem and the reason was EOL in some editors like Notepad ++. You can check this in the Edit / EOL menu. Unix (LF) must be selected. Hope this will be helpful.

0
Sep 22 '19 at 12:04 on
source share



All Articles