Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

error while loading shared libraries: libncurses.so.5 on Ubuntu (ARM64 or x86)

Errorlibncurses.so.5 is missing when the program starts

Short 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.

  • Applies to Ubuntu 22.04 arm64, Ubuntu 24.04
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 NEEDED
  2. 2Match what you see, then jump to its fix

    1. 1lsb_release shows 22.04 and objdump lists libncurses.so.5 or libtinfo.so.5 as NEEDEDlibncurses5 and libtinfo5 are not installed (Ubuntu 22.04)Fix
    2. 2apt-cache policy shows no candidate version for libncurses5The release is Ubuntu 24.04, which has no libncurses5Fix

What does the error look like?

  • libncurses.so.5 is missing when the program starts
  • libtinfo.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 libtinfo5

2Fix

Install both packages.

sudo apt update && sudo apt install libncurses5 libtinfo5

3Verify

Start the program again.

./your-binary --version

Confirmed by packages.ubuntu.com

Did this fix it?

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 libncurses5

2Fix

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 bash

3Verify

Inside the 22.04 environment, install the packages and run the binary.

apt update && apt install -y libncurses5 libtinfo5
./your-binary

Confirmed by packages.ubuntu.com

Did this fix it?

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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.