ELIBEXEC
Linux / POSIXERRORCommonProcessHIGH confidence

Cannot Exec a Shared Library Directly

Production Risk

Programming or deployment error; cannot run .so files directly as executables.

What this means

ELIBEXEC (errno 83) is returned when an attempt is made to directly execute a shared library (.so) as if it were a program.

Why it happens
  1. 1execve() called directly on a .so file
  2. 2Running a library as ./libfoo.so without a proper entry point
How to reproduce

Trying to execute a .so file directly.

trigger — this will error
trigger — this will error
execve("/usr/lib/libfoo.so.1", argv, envp);
// Returns -1, errno = ELIBEXEC

expected output

execve: Cannot exec a shared library directly (ELIBEXEC)

Fix

Execute the program that uses the library

WHEN When mistakenly running a .so as an executable

Execute the program that uses the library
# Run the program that links to the library, not the .so itself
/usr/bin/myprogram arg1 arg2

# Some libraries (like glibc) can be run directly for version info:
/lib/x86_64-linux-gnu/libc.so.6  # prints glibc version

Why this works

Shared libraries are not standalone programs; execute the binary that links to them.

Sources
Official documentation ↗

Linux Programmer Manual execve(2)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors