Линукс no such file or directory

No such file or directory? But the file exists!

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 

Thank you for your reply. I’ve done the command you said Agent86 but I have the same result. I’ve downloaded also the .deb file but there is a problem too. I don’t know what problem has this game.

Please confirm whether you’re running a 64-bit installation (that’s the most common case for this problem).

9 Answers 9

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.

Читайте также:  Создать файл html linux

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 . 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 (plus any other necessary library).

Источник

Solve No Such File or Directory Error in Linux Bash

Solve No Such File or Directory Error in Linux Bash

  1. Check Path and Interpreter to Solve the bash: No such file or directory Error in Linux Bash
  2. Install Library Packages to Solve the bash: No such file or directory Error in Linux Bash
  3. Use the dos2unix Command to Solve the bash: No such file or directory Error in Linux Bash

Linux terminal allows you to execute programs. This article will explain how to execute files properly and solve the bash: No such file or directory error in Linux Bash.

There are many code-related reasons why you get a bash: No such file or directory error in Bash. We will explain the most common mistakes and ways to fix them.

Check Path and Interpreter to Solve the bash: No such file or directory Error in Linux Bash

First, make sure you execute the program with the correct path. If you make a typo on the directory or file name, you will get this error or give the wrong path.

If you are executing the file with a relative path ( ../../file ), try executing with the absolute path ( /path/to/file ) instead.

Another reason you might get this error could be that you are using the wrong interpreter. The first line in the code is called shebang ( #!/bin/bash ).

Читайте также:  Права суперпользователя linux debian

It tells the operating system which shell to use to parse the file. If the shebang is not specified correctly, your program will not run.

Make sure the program uses the proper interpreter.

Install Library Packages to Solve the bash: No such file or directory Error in Linux Bash

Missing libraries on your system can cause you to get the bash: No such file or directory error. Examine the file with the file command.

If the file is a 32-bit executable, you need some libraries to execute it on a 64-bit architecture OS. To solve this error in Ubuntu, add the i386 architecture with the dpkg command, then install the necessary libraries.

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

Источник

How to Fix “bash: no such file or directory”

Unlike other operating systems such as Windows, Linux is an OS in which the majority of its tasks are performed using the Terminal. One of the major tasks that the Linux terminal performs is the execution of programs using commands. While attempting to execute any program through this method, the user may come across this very common error statement which is the “no such file or directory” issue.

This article will elaborate on the reasons that prompt the error “no such file or directory” and also provide possible solutions to fix it

How to Resolve the “no such file or directory”?

Since this is a very general error, there are a few different reasons that can invoke this issue on the system. All these reasons are discussed below in great detail.

Reason 1: Wrong File Name

The first and the most commonly occurring reason is caused by using incorrect spellings of the file name. For example, the mistake can be the incorrect spelling of a file. Below is an example of such a mistake:

Solution: Check the File name and Path

In the example shown above, the bash file “sample.sh” is saved on the desktop. So, make sure that the error is not invoked by using the correct spellings and the correct path. Look at the following image where the name and path of the file are correct, and thus, the output is displayed:

Читайте также:  Linux работа с crontab

Reason 2: Wrong File Format

The other most common cause behind this issue is that the file that is attempted to execute is in a different format than the operating system. Let’s take an example of this situation. The file that is executed using the command is a DOS file which is a script written for Windows. If this DOS file is executed in an Ubuntu system, the “no such file or directory” issue will be invoked.

Solution: Use the dos2unix Tool

There exists a very useful tool for exactly these types of scenarios. The dos2unix tool helps to convert a dos file to a script that can be read by the Ubuntu OS. The first step is to install the dos2unix tool using this command:

$ sudo apt install dos2unix

Once the tool is installed, convert the DOS file into an Ubuntu-compatible file using the following command:

The system should be able to run the script file without the error being prompted after the conversion is complete.

Conclusion

The “no such file or directory” issue occurs when the name or the path of the executable file is entered incorrectly into the terminal. Another reason is that Ubuntu is not able to read the DOS script and if it is executed on the Ubuntu terminal, then the error is prompted. To fix these issues it needs to be made sure that the file path and file name are entered correctly into the terminal. The other fix is to install the dos2unix tool and convert the dos files format to run on Ubuntu. This article has demonstrated the reasons and the solutions to fix the error “no such file or directory”.

TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY

Источник

Оцените статью
Adblock
detector