error while loading shared libraries: libncurses.so.5 on Ubuntu (ARM64 or x86)
libncurses.so.5 is missing when the program startsShort answer
The program was built against ncurses 5, and newer systems ship ncurses 6. On Ubuntu 22.04 the libncurses5 and libtinfo5 packages still exist in universe, for arm64 too. Install both. Ubuntu 24.04 does not carry them, so use a 22.04 base or a build made for ncurses 6.
Fix it fast
1Find out which cause you have
Print the Ubuntu release and the libraries the binary asks for. objdump reads the file without running it, which is safer than ldd for a binary you do not fully trust.
lsb_release -ds objdump -p ./your-binary | grep NEEDED2Match what you see, then jump to its fix
What does the error look like?
libncurses.so.5 is missing when the program startslibtinfo.so.5 is missing when the program starts
Cause 1 of 2
libncurses5 and libtinfo5 are not installed (Ubuntu 22.04)
1Check
Ubuntu 22.04 (jammy) still has both packages in the universe section, built for arm64 as well as amd64.
apt-cache policy libncurses5 libtinfo52Fix
Install both packages.
sudo apt update && sudo apt install libncurses5 libtinfo53Verify
Start the program again.
./your-binary --versionConfirmed by packages.ubuntu.com
Cause 2 of 2
The release is Ubuntu 24.04, which has no libncurses5
1Check
The Ubuntu package search lists libncurses5 only for jammy and jammy-updates, not for noble.
apt-cache policy libncurses52Fix
Run the program on a 22.04 base (a container or an older host), or get a build of the program that links against ncurses 6.
# example: run it inside an Ubuntu 22.04 container
docker run --rm -it -v "$PWD":/work -w /work ubuntu:22.04 bash3Verify
Inside the 22.04 environment, install the packages and run the binary.
apt update && apt install -y libncurses5 libtinfo5
./your-binaryConfirmed by packages.ubuntu.com
How do I stop it coming back?
- Pick vendor toolchains that publish a build for ncurses 6 and for your CPU architecture.
- Record the base Ubuntu release for tools that need legacy libraries.
- Read the NEEDED libraries of a downloaded binary with objdump -p before you run it; the ldd manual warns never to use ldd on an untrusted executable.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Servers
dnf cannot install MySQL on Amazon Linux 2023
dnf cannot find a mysql-server package on Amazon Linux 2023
Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.
3 causes, each with a fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
Apache warns that a ${VAR} config variable is not defined
${VAR} left unchanged in the configuration, with a warning in the error log
Apache expands ${VAR} from Define or from the shell environment that exists when the server starts.
3 causes, each with a fix