Ошибка нет такого файла или каталога линукс

I try to use an executable script (wkhtmltopdf) on a Linux shared webserver (Debian, 64bit). I am pretty sure that I compiled everything correct, but whenever I want to execute the file I get as an response :

> ./wkhtmltopdf -H
-bash: ./wkhtmltopdf: No such file or directory

To be sure that the file is there, here the ls output :

> ls
wkhtmltoimage  wkhtmltopdf

Furthermore I tested the file command on it, which outputs the following :

> file wkhtmltopdf
wkhtmltopdf: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

My question is now :

Why does bash tells me that there is no ‘file or directory’, when there obviously is one?

My first guess would be that the shared server does not allow to execute binary files? But shouldn’t it then be a problem of permissions, with a different bash output?

Edit :

> id 
uid=2725674(p8907906) gid=600(ftpusers) groups=600(ftpusers)

> ls -l wkhtmltopdf
-rwxrwxrwx 1 p8907906 ftpusers 39745960 Jan 20 09:33 wkhtmltopdf

> ls -ld
drwx---r-x 2 p8907906 ftpusers 44 Jan 28 21:02 .


0

1

$ /icarix/bin/leafpad
bash: /icarix/bin/leafpad: Нет такого файла или каталога

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/icarix/bin

$ ls /icarix/bin/leafpad
/icarix/bin/leafpad

$ ls -l /icarix/bin/leafpad
-rwxr-xr-x 1 lab lab 110116 дек 10  2015 /icarix/bin/leafpad

$ file /icarix/bin/leafpad
/icarix/bin/leafpad: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=e605e9afe8bced675c6da5ff5eb217007afe9ef9, stripped

Существует, исполняемый, почему его «нет» ?

I’ve downloaded a game (Shank) but the bin file doesn’t run. The error that is shown when I try to launch the executable is:

bash: ./shank-linux-120720110-1-bin: No such file or directory

asked May 7, 2012 at 19:06

Francesco's user avatar

FrancescoFrancesco

2,8812 gold badges14 silver badges12 bronze badges

7

You’re probably trying to run a 32-bit binary on a 64-bit system that doesn’t have 32-bit support installed.

There are three cases where you can get the message “No such file or directory”:

  • The file doesn’t exist. I presume you’ve checked that the file does exist (perhaps because the shell completes it).
  • There is a file by that name, but it’s a dangling symbolic link.
  • The file exists, and you can even read it (for example, the command file shank-linux-120720110-1-bin displays something like “ELF 32-bit LSB executable …”), and yet when you try to execute it you’re told that the file doesn’t exist.

The error message in this last case is admittedly confusing. What it’s telling you is that a key component of the runtime environment necessary to run the program is missing. Unfortunately, the channel through which the error is reported only has room for the error code and not for this extra information that it’s really the runtime environment that’s to blame. If you want the technical version of this explanation, read Getting “Not found” message when running a 32-bit binary on a 64-bit system.

The file command will tell you just what this binary is. With a few exceptions, you can only run a binary for the processor architecture that your release of Ubuntu is for. The main exception is that you can run 32-bit (x86, a.k.a. IA32) binaries on 64-bit (amd64, a.k.a. x86_64) systems.

In Ubuntu up to 11.04, to run a 32-bit binary on a 64-bit installation, you need to install the ia32-libs package Install ia32-libs. You may need to install additional libraries (you’ll get an explicit error message if you do).

Since 11.10 (oneiric) introduced multiarch support, you can still install ia32-libs, but you can choose a finer-grained approach, it’s enough to get libc6-i386 Install libc6-i386 (plus any other necessary library).

Community's user avatar

answered May 7, 2012 at 21:47

Gilles 'SO- stop being evil''s user avatar

9

64 bit Ubuntu Multiarch systems

Follow this answer only if the output of file file-name shows,

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

To run 32bit executable file in a 64 bit multi-arch Ubuntu system, you have to add i386 architecture and also you have to install libc6:i386,libncurses5:i386,libstdc++6:i386 these three library packages.

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

Community's user avatar

answered Apr 24, 2014 at 13:14

Avinash Raj's user avatar

Avinash RajAvinash Raj

76.6k55 gold badges213 silver badges253 bronze badges

4

To expand on @Gilles answer, there are at least three scenarios resulting in this error:

  1. The file doesn’t exist.
  2. The file exists but is a dangling symbolic link.
  3. The file exists (e.g. file command works), making for a puzzling error message. This may mean there’s a problem with the loader.

Categories of loader problems:

  1. An executable’s loader does not exist. You can check this using the file command and see if the loader does exist. E.g.

    file lmgrd
    lmgrd: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-lsb-x86-64.so.3, for GNU/Linux 2.6.18, stripped
    

    Notice interpreter /lib64/ld-lsb-x86-64.so.3; if this file does not exist, you need to install it. For this particular loader on 16.04, the answer turned out to be sudo apt-get install lsb.

  2. Issues with a script’s loader (see this answer).

  3. Missing shared libraries — use ldd <file-name> to check for any «not found» libraries. See this answer for more info.

The loader not existing could be due to a 32/64 bit mismatch or some other reason. There might be other kinds of loader errors I don’t know about.

answered May 11, 2018 at 18:54

jtpereyda's user avatar

jtpereydajtpereyda

2,0353 gold badges20 silver badges21 bronze badges

4

Here’s a transcript showing a bit more about the nature of the problem, and how to fix it as of Ubuntu 16.04. Notice that even though file reports «dynamically linked», ldd reports «not a dynamic executable».

$ ./myprogram
bash: myprogram: No such file or directory

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

$ ldd myprogram
    not a dynamic executable

Once you install libc6:i386, things start improving…

$ sudo apt-get install libc6:i386 # the initial fix
...

$ ldd myprogram
    linux-gate.so.1 =>  (0xf77fd000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7626000)
    /lib/ld-linux.so.2 (0x56578000)

$ ./myprogram
myprogram: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

To complete the job, you may need to identify and install additional libraries one at a time…

$ sudo apt-get install libstdc++6:i386 ## may require various additional libs

$ ./myprogram
... works correctly ...

I don’t know if there is a systematic way of identifying the correct libraries to install. There is a bit of guesswork mapping the error messages to package names (tab completion helps).

answered Jun 8, 2016 at 20:57

Brent Bradburn's user avatar

Brent BradburnBrent Bradburn

2,7362 gold badges29 silver badges35 bronze badges

1

By installing the deb for 32 bit I realized I was missing some libraries (in addition to ia32-libs and libc6). I first solved this problem by giving this command:

sudo apt-get install -f          

Then I got another error:

Message: SDL_GL_LoadLibrary 
Error: Failed loading libGL.so.1

Obviously, these libraries were properly installed. Without going into details I had to link the libraries by hand. I realized then that could also an easier solution through Synaptic install the following packages:

libgl1-mesa-glx:i386
libgl1-mesa-dri: i386.

After that the next problem was the black screen while playing, which I solved by replacing the executable in /Shank/bin with this:
http://treefort.icculus.org/smb/smb-linux-mesa-hotfix-test.tar.bz2.

I hope it will be useful to someone.
If you need more help or more details please feel free to contact me.

kiri's user avatar

kiri

27.4k16 gold badges80 silver badges117 bronze badges

answered May 9, 2012 at 19:12

Francesco's user avatar

FrancescoFrancesco

2,8812 gold badges14 silver badges12 bronze badges

This error happens when working on Windows (which introduces extra characters because of different line separator than Linux system) and trying to run this script (with extra characters inserted) in Linux. The error message is misleading.

In Windows, the line separator is CRLF (rn) whereas in linux it is LF (n). In my case, this happened due to working on Windows and uploading to Unix server for execution.

answered Jan 24, 2020 at 2:55

PALEN's user avatar

PALENPALEN

1,0811 gold badge8 silver badges6 bronze badges

2

Google navigated me to this page. My issue was distantly related to the title of this thread, so I am posting it here for the future visitors like me:

It is one of the weirdest issues:

$ ls -lh
ls: cannot access .~dataprep.ipynb: No such file or directory
-????????? ? ?      ?           ?            ? .~dataprep.ipynb
-rw------- 1 tgowda mygroup 475K Jun 12 15:59 dataprep.ipynb

I see that the file .~dataprep.ipynb is right there with some weird ?? permissions.
I just wanted to get rid of that messed up file.
rm command could not remove it. mv command couldn’t move it.

And then…

$ python
>>> from pathlib import Path
>>> list(Path('.').glob("*.ipynb"))
[PosixPath('.~dataprep.ipynb'), PosixPath('dataprep.ipynb')]
>>> p = list(Path('.').glob("*.ipynb"))[0]
>>> p
PosixPath('.~dataprep.ipynb')
>>> p.unlink()
>>> list(Path('.').glob("*.ipynb"))
[PosixPath('dataprep.ipynb')]

And that’s how I was able to defeat it.

answered Jun 13, 2020 at 3:36

Thamme Gowda's user avatar

None of the above answers worked for me because there was a miss-resolving for the interpreter.

I have written a detailed answer here, explaining how to fix this issue.

Thanks to this man who shared his experience with others solution here.
thanks to him i was able to solve this problem.

To summarize, as @steeldriver though, there was an interpreter problem.
the linker is giving to my program [/lib/ld64.so.1] as ELF interpreter but this path doesnt exist at all and i checked it by:

> ls /lib/ld64.so.1
ls: cannot access '/lib/ld64.so.1': No such file or directory

After that, i checked the interpreters path’s on my ubuntu installation by:

> ls /lib64/ld-*
/lib64/ld-linux-x86-64.so.2  /lib64/ld-lsb-x86-64.so.2  /lib64/ld-lsb-x86-64.so.3

so the solution is to create a link of one of this interpreters to the inexistant interpreter path by:

sudo ln -s /lib64/ld-linux-x86-64.so.2 /lib/ld64.so.1

Now we re-check the inexistent interpreter one more time to see if its still inexisting or not:

> ls /lib/ld64.so.1
/lib/ld64.so.1

Now this command has returned /lib/ld64.so.1 instead of «inexistant file». so the problem was solved and i could run ./main successfully

So, in a summary, you have to create a link of one of this interpreters to the inexistant interpreter path by running the following command in a terminal (Ctrl + Alt + T) :

sudo ln -s /lib64/ld-linux-x86-64.so.2 /lib/ld64.so.1

answered Jan 28, 2022 at 21:06

Mohamed Elleuch's user avatar

3

On Ubuntu, I get a ‘No such file or directory’ error when I try to execute a command.

I have checked with ls -la , the file adb is there and it has ‘x’ flag
So why I am getting a ‘No such file or directory’?

~/Programs/android-sdk-linux_x86/platform-tools$ ./adb
 bash: ./adb: No such file or directory
~/Programs/android-sdk-linux_x86/platform-tools$ ls -la
 total 34120
 drwxrwxr-x 3 silverstri silverstri     4096 2011-10-08 18:50 .
 drwxrwxr-x 8 silverstri silverstri     4096 2011-10-08 18:51 ..
 -rwxrwxr-x 1 silverstri silverstri  3764858 2011-10-08 18:50 aapt
 -rwxrwxr-x 1 silverstri silverstri   366661 2011-10-08 18:50 adb
 -rwxrwxr-x 1 silverstri silverstri   906346 2011-10-08 18:50 aidl
 -rwxrwxr-x 1 silverstri silverstri   328445 2011-10-08 18:50 dexdump
 -rwxrwxr-x 1 silverstri silverstri     2603 2011-10-08 18:50 dx
 drwxrwxr-x 2 silverstri silverstri     4096 2011-10-08 18:50 lib
 -rwxrwxr-x 1 silverstri silverstri 14269620 2011-10-08 18:50 llvm-rs-cc
 -rwxrwxr-x 1 silverstri silverstri 14929076 2011-10-08 18:50 llvm-rs-cc-2
 -rw-rw-r-- 1 silverstri silverstri      241 2011-10-08 18:50 llvm-rs-cc.txt
 -rw-rw-r-- 1 silverstri silverstri   332494 2011-10-08 18:50 NOTICE.txt
 -rw-rw-r-- 1 silverstri silverstri      291 2011-10-08 18:50 source.properties

Timo J.'s user avatar

asked Oct 9, 2011 at 2:52

michael's user avatar

2

It’s an executable file that misses required libraries. Use ldd to see what it needs, then provide these files.

answered Oct 9, 2011 at 9:39

Daniel Beck's user avatar

Daniel BeckDaniel Beck

109k14 gold badges286 silver badges334 bronze badges

1

Android SDK requires 32-bit libraries. You probably are on 64-bit and need the 32-bit libs. Here are the troubleshooting directions from developer.android.com

For Ubuntu 13.10 (Saucy Salamander) and above, install the libncurses5:i386, libstdc++6:i386, and zlib1g:i386 packages using apt-get:

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

For earlier versions of Ubuntu, install the ia32-libs package using apt-get:

apt-get install ia32-libs

Hamy's user avatar

Hamy

2251 silver badge14 bronze badges

answered Nov 22, 2011 at 19:15

hoffmanc's user avatar

hoffmanchoffmanc

6511 gold badge4 silver badges4 bronze badges

4

sudo apt-get install --reinstall libc6-i386

is also need for me.

Tamara Wijsman's user avatar

answered Apr 12, 2012 at 14:55

Shawe's user avatar

ShaweShawe

411 bronze badge

1

I was also seeing the same after switching my machine from 32 bit ubuntu to 64 bit. Bash would report ‘No such file or directory’ of files that clearly existed with the execute attribute.

sudo apt-get install —reinstall libc6-i386

Fixed the problem. These are the «GNU C Library: 32-bit shared libraries for AMD64»

Seems like this is a bug in bash. Note that I also changed the default shell from dash to bash using

sudo dpkg-reconfigure dash

before I tried running the 32 bit executable. So I’m not sure if the problem would have happened with the default dash shell

answered Jul 24, 2013 at 19:01

user240504's user avatar

On a fresh Xubuntu 13.10 x64 install I got adb to run with:

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

And also zlib1g:i386 to make aapt work.

and if you still miss something use:

lld adb

answered Oct 21, 2013 at 1:49

Stéphane's user avatar

StéphaneStéphane

2461 silver badge6 bronze badges

2

For adb make sure you have the SDK unpacked and have run the SDK Manager to fully populate the SDK. Additionally make sure you have the following installed:
A.) JDK 6 or better
B.) lib32stdc++6
C.) lib32ncurses5

hoffmanc was the closest to getting it right, I don’t really understand why the answer from Daniel Beck is marked as correct when it’s not even close and has nothing to do with the problem.

Incidentally, if you try to run a truly non-existant command (i.e.:

# fakecommand

you’ll get: fakecommand: command not found, whereas in your situation the output you are seeing is actually coming from adb even though it’s not very clear that is the case.

answered Apr 14, 2012 at 18:00

Justin Buser's user avatar

Justin BuserJustin Buser

1,23711 silver badges14 bronze badges

Ubunto seems to have some issues with LSB compatibility, so try this if you are on Ubunto

apt-get install lsb

Note that ldd will sort of show that all the libraries are there, but they are not.

usmp-vm-lamp01$ ldd lmgrd
 linux-vdso.so.1 =>  (0x00007fffb33fe000)
 libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f10b0a48000)
 libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f10b074c000)
 libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f10b0535000)
 libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f10b0175000)
 libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f10aff71000)
 /lib64/ld-lsb-x86-64.so.3 => /lib64/ld-linux-x86-64.so.2 (0x00007f10b0c67000)
usmp-vm-lamp01$ locate libpthread.so.0
/lib/x86_64-linux-gnu/libpthread.so.0
usmp-vm-lamp01$ locate libm.so.6
/lib/x86_64-linux-gnu/libm.so.6
usmp-vm-lamp01$ locate /lib64/ld-lsb-x86-64.so.3
usmp-vm-lamp01$

answered Jun 9, 2014 at 21:26

Mark Lakata's user avatar

Mark LakataMark Lakata

8,0902 gold badges18 silver badges16 bronze badges

1

  • Печать

Страницы: [1]   Вниз

Тема: При запуске файла в bash: Нет такого файла или каталога  (Прочитано 1789 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
q12345

После танца с бубном мне удалось запустить файл, в котором код bash:

#!/bin/bash

clear

echo "Доброе утро, мир."

запускаю так:

chmod u+x "/home/user/Рабочий стол/morn.txt"
bash ./morn.txt

но сделав другие файлы с тем же кодом внутри и попробовав их запустить все завершаются:
Нет такого файла или каталога.
Я даже попробовал просто взять скопировать файл, что запускается и переименовать, все равно не работает.
И еще, тот файл, что работает, стал работать, только когда указал расширение txt.
Пробовал проверить так:

ls -l "/home/user/Рабочий стол/morn.txt"
ls -l "/home/user/Рабочий стол/morning.txt"

-rwxrwxr-x 1 user user 58 июн  4 15:03 ‘/home/user/Рабочий стол/morn.txt’ это рабочий файл
-rwxrwxr-x 1 user user 58 июн  4 15:03 ‘/home/user/Рабочий стол/morning.txt’этот не запускается

« Последнее редактирование: 04 Июня 2022, 19:48:03 от q12345 »


Оффлайн
Peter_I

Во-первых, запускать через bash — лишнее, достаточно ввести в каталоге с файлом

./morn.txtВо-вторых, если вам сообщают, что файла нет, значит, либо его имя либо путь к нему указаны неверно,
проверяйте свои команды.


Оффлайн
q12345

Во-первых, запускать через bash — лишнее, достаточно ввести в каталоге с файлом
./morn.txtВо-вторых, если вам сообщают, что файла нет, значит, либо его имя либо путь к нему указаны неверно,
проверяйте свои команды.

пробовал без bash, не запускается, поэтому поставил. Пробую заменить имя на рабочий файл, работает.
Путь копирую из свойств файла. Не рабочий файл точно есть на рабочем столе, я его визуально вижу.


Пользователь добавил сообщение 04 Июня 2022, 23:02:31:


Работает только так:

bash "/home/user/Рабочий стол/morning.txt"кто-чего скажет, наверное дело в правах доступа, знаний мало первый день с этим долбаным Bash работаю.

« Последнее редактирование: 04 Июня 2022, 23:05:01 от q12345 »


Оффлайн
Peter_I

Так я надеялся, что вы назначили скрипту права 755 командой chmod. Тогда запустится без bash.
Я никогда не размещаю файлы на Рабочем столе, а только в каталогах.
Если мало знаний, так их надо приобрести. Посмотреть книгу по администрированю Linux, обращая внимание на основы —
работа с файлами и каталогами, а для bash можно найти полное руководство в переводе на русский.


Оффлайн
ALiEN175

первый день с этим долбаным Bash работаю.

А оно вам нужно? Всё просто: не нравится — не ешьте.

ASUS P5K-C :: Intel Xeon E5450 @ 3.00GHz :: 8 GB DDR2 :: Radeon R7 260X :: XFCE
ACER 5750G :: Intel Core i5-2450M @ 2.50GHz :: 6 GB DDR3 :: GeForce GT 630M :: XFCE


Оффлайн
andytux

знаний мало первый день с этим долбаным Bash работаю.

Ни за неделю, ни за месяц не научишься. А знания…
Я тебе еще в прошлой теме сказал, хоть какую-нибудь азбуку прочитай, например, Advanced Bash-Scripting Guide.


Оффлайн
ALiEN175

ASUS P5K-C :: Intel Xeon E5450 @ 3.00GHz :: 8 GB DDR2 :: Radeon R7 260X :: XFCE
ACER 5750G :: Intel Core i5-2450M @ 2.50GHz :: 6 GB DDR3 :: GeForce GT 630M :: XFCE


  • Печать

Страницы: [1]   Вверх

Понравилась статья? Поделить с друзьями:
  • Ошибка нет стекера
  • Ошибка нет соединения material admin
  • Ошибка нет сигнала статуса вытяжного вентилятора
  • Ошибка нет сигнала на мониторе
  • Ошибка нет сети эвотор