Why does a Linux executable fail to start?
The deployment package is already on the dedicated server, and the executable has permission to run, yet starting it returns “No such file or directory.” Another package finds its shared libraries but reports a missing symbol version. At this point, do not rush to reinstall dependencies—and certainly do not overwrite system libraries. Break the startup chain into four layers: file format, dynamic loader, dependency resolution, and service environment. Preserve evidence at each layer.
This article uses Debian 12 and the example application path /opt/orders/bin/ordersd. Replace it with the absolute path to the program you are investigating. After paying for a Tbps dedicated server, you can find the credentials in the console and connect to Linux over SSH. For a server with multiple addresses, connect using the first address. None of the checks below changes the network configuration.
1. Capture the failure and identify the affected layer
First, save the deployment package checksum, the complete error message, the command used to run the program, and the current directory. Do not record only “failed to start”: a kernel refusing to execute a file, a loader failing to resolve dependencies, and an application exiting after startup require different responses.
Install the inspection tools in a terminal with administrative privileges, then return to a regular account for static analysis:
sudo apt-get update
sudo apt-get install --no-install-recommends file binutils
app=/opt/orders/bin/ordersd
sha256sum "$app"
stat "$app"
file "$app"
uname -m
Use file to identify whether the file is an ELF executable, a script, or another format. uname -m shows the architecture of the running kernel. Statically linked programs generally do not depend on a dynamic loader, so not all the checks that follow apply to them. If the file is actually a script, first check that the interpreter named on its first line exists, and look for stray carriage-return characters.
Start with static inspection for binaries of unknown origin. Do not execute them directly or use
lddas the first step. Dependency checks do not replace verification of a file’s provenance; keep the static analysis tools themselves up to date as well.
If the error is Permission denied, also check the file’s execute bits, search permissions on parent directories, and the mount point’s noexec flag. These are not missing-library problems, and repeatedly installing libraries will not fix them.
2. Check the ELF architecture and interpreter path
Inspect the headers
readelf -hW "$app"
readelf -lW "$app"
Focus on Class, Data, and Machine in the ELF header. Confirm that the bitness, byte order, and target architecture match the runtime environment. Investigate Exec format error at this layer first; adding execute permissions is not the solution.
The program headers of a dynamically linked ELF file usually include Requesting program interpreter. This specifies the loader path, not an application configuration file. Even when the program itself exists, a missing interpreter can still cause execution to return No such file or directory.
After extracting the path, review the output manually before checking the path and its symbolic links:
interp=$(LC_ALL=C readelf -lW "$app" |
sed -n 's/.*Requesting program interpreter: \(.*\)]/\1/p')
printf '%s\n' "$interp"
if [ -n "$interp" ]; then
ls -l "$interp"
readlink -e "$interp"
fi
Failure to extract an interpreter does not mean the file is corrupt. Use the file output and program headers together to determine whether it is statically linked. Nor should you patch a missing path by creating an arbitrary symbolic link: loaders from different runtime library implementations are not interchangeable merely because their names look similar.
3. Distinguish missing libraries from incompatible symbol versions
First, inspect what the binary declares without running the application:
readelf -dW "$app"
readelf --version-info "$app"
NEEDED lists the names of directly required libraries, but those libraries may have dependencies of their own. RPATH and RUNPATH control part of the search behavior, while the version information shows which versioned symbols the application requires.
cannot open shared object file usually indicates a lookup failure, but it can also result from path permissions or a missing dependency further down the chain. By contrast, version ... not found means a library was found but cannot meet the requirements. These two cases cannot be fixed with the same “add the missing file” approach.
Use the target system’s loader to resolve dependencies only for programs from a trusted source whose interpreter has already been verified. The following command applies to dynamically linked programs confirmed to use the glibc loader:
env -u LD_LIBRARY_PATH -u LD_PRELOAD \
"$interp" --list "$app"
This removes two common sources of environmental interference to establish a baseline. It does not mean the production service must use the same environment. Record the resolved absolute paths and check for unintended matches in old deployment directories or personal workspaces.
If the target system’s runtime libraries are too old, use packages intended for that system or rebuild the application in a matching build environment. Do not copy identically named libraries from other machines into system directories, and do not treat successful path resolution as proof of ABI compatibility.
4. Give application-private dependencies clear boundaries
If the application genuinely needs to bundle shared libraries, you can place bin and lib directories alongside each other. Set a relative runtime search path for the executable during the build, for example with this linker option:
-Wl,-rpath,'$ORIGIN/../lib'
The loader interprets $ORIGIN as the directory containing the corresponding ELF file. Make sure the build script does not expand it prematurely. Single quotes are simply a common shell quoting convention here; you still need to inspect the final build artifact to confirm whether it contains RUNPATH or RPATH.
RUNPATH generally applies only to an object’s direct dependencies. It does not automatically supply search paths for all indirect dependencies. When private libraries depend on one another, each object also needs an explicit, verifiable dependency-resolution strategy.
Unrelated accounts must not be able to write to the deployment directory or its parent directories; otherwise, the library search path can become an entry point for code injection. Do not add the current directory to the search path, and do not add broadly scoped directories to the global configuration for the sake of a single application.
After changing the package layout, recalculate the checksums and recheck every ELF file’s dependencies. Keep the previous complete deployment package and restore it as a whole when rolling back, avoiding a mixture of an old program and new libraries.
5. Validate in the actual service environment
A successful start in an interactive terminal does not prove that the service account can start the application. First, inspect the service definition and its key properties. The following example uses the application’s actual service unit, orders.service:
systemctl cat orders.service
systemctl show orders.service \
-p User -p Group -p WorkingDirectory \
-p Environment -p RootDirectory -p RootImage
journalctl -u orders.service -b -n 100 --no-pager
When reviewing the output, avoid copying sensitive environment values into support tickets or public records. Focus on the service account, working directory, environment variables, and whether root directory isolation makes the interpreter or dependency paths invisible.
Running the loader as the service account verifies only the account-permissions aspect. It does not fully reproduce the service’s mount namespace, sandbox, or environment. Final validation still requires starting the original service unit during a controlled change window and checking the application’s functional results.
Retain at least four pieces of evidence for acceptance: the target file’s checksum matches the expected value; the interpreter and all dependencies resolve to the expected paths; loading errors no longer appear in the logs; and the application completes one real functional self-check. A running process or a normal exit code alone is not enough to prove that the application works.
Once troubleshooting is complete, clear any temporary diagnostic environment settings, remove configuration overrides added for testing, and recheck the original startup method. Keep the error text, dependency paths, corrective actions, and rollback package together as a linked record. The next time you migrate the system or update the deployment package, you can repeat the checks instead of starting over with guesswork.
Frequently asked questions
Why does an existing executable report No such file or directory?
A dynamically linked ELF file can produce this error when its requested interpreter is missing. Inspect it with readelf -lW and verify that path. For scripts, check the shebang and line endings.
Can a missing library be copied from another server?
A matching filename does not establish compatibility. Verify architecture, SONAME, symbol versions and provenance. Prefer target-system packages or rebuild the application with explicit private dependencies rather than replacing system libraries.
AMD EPYC 7543P Dedicated Server
From $463/mo