Maaz Zindani

Loading the index…

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

apt cannot install libasound2 and similar libraries on Ubuntu 24.04 or Debian 13

Your error

E: Package 'libasound2' has no installation candidate1 more line it can show

Fix it fast

Most common cause, 1 of 3

The release renamed the library to libasound2t64

Install the t64 package.

Fix
sudo apt-get update
sudo apt-get install -y libasound2t64
# other common renames on noble: libgtk-3-0t64, libatk1.0-0t64, libcups2t64
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

Ubuntu 24.04 and Debian 13 rebuilt many C libraries for the 64-bit time_t change and renamed the packages with a t64 suffix. On those releases libasound2 is only a virtual name, so apt has nothing to install. Install libasound2t64 instead, and do the same for the other renamed libraries in your list, such as libgtk-3-0t64.

  • Applies to Ubuntu 24.04 LTS (noble), Ubuntu 22.04 LTS (jammy), Debian 13 (trixie)
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Check which release the machine or base image runs, and ask apt for the real package names behind the old one.

Run this first
grep -E '^(ID|VERSION_CODENAME)=' /etc/os-release
apt-cache search --names-only '^libasound2'

Then find the line you see in this list and open its fix:

  1. 1The release renamed the library to libasound2t64VERSION_CODENAME is noble (Ubuntu 24.04) or trixie (Debian 13)
  2. 2One script has to work on old and new releasesThe same Dockerfile, CI job or buildpack runs on 22.04 and 24.04
  3. 3The base image moved to a newer release under youThe Dockerfile did not change, yet the build started failing

What does the error look like?

  • E: Package 'libasound2' has no installation candidate
  • Package libasound2 is a virtual package provided by:

Cause 1 of 3

The release renamed the library to libasound2t64

You seeVERSION_CODENAME is noble (Ubuntu 24.04) or trixie (Debian 13)

Check

packages.ubuntu.com lists libasound2 as a virtual package in noble and a separate libasound2t64 package from the same alsa-lib source. In jammy, libasound2 is still a normal package. The Ubuntu 24.04 release notes describe the time_t change from 32 to 64 bits that caused these renames.

Check
apt-cache policy libasound2t64

Fix

Install the t64 package. Other names from guides written for 22.04 often need the same suffix.

Fix
sudo apt-get update
sudo apt-get install -y libasound2t64
# other common renames on noble: libgtk-3-0t64, libatk1.0-0t64, libcups2t64

Verify

apt reports the package as installed and the program that needed it starts.

Verify
dpkg -l libasound2t64 | tail -1

Confirmed by packages.ubuntu.com

Did this fix it?

Cause 2 of 3

One script has to work on old and new releases

You seeThe same Dockerfile, CI job or buildpack runs on 22.04 and 24.04

Check

A fixed list of names breaks on one release or the other. The package exists under one name per release, so the script has to choose.

Check
grep -rn "libasound2" Dockerfile* .github/workflows ci 2>/dev/null

Fix

Pick the name that apt knows about, then install it.

Fix
if apt-cache show libasound2t64 >/dev/null 2>&1; then
  ALSA=libasound2t64
else
  ALSA=libasound2
fi
apt-get install -y --no-install-recommends "$ALSA"

Verify

The same script succeeds in a jammy and a noble container.

Verify
docker run --rm -v "$PWD/install.sh:/i.sh" ubuntu:22.04 sh -c 'apt-get update -qq && sh /i.sh'
docker run --rm -v "$PWD/install.sh:/i.sh" ubuntu:24.04 sh -c 'apt-get update -qq && sh /i.sh'

Confirmed by packages.ubuntu.com

Did this fix it?

Cause 3 of 3

The base image moved to a newer release under you

You seeThe Dockerfile did not change, yet the build started failing

Check

Docker's build guide warns that image tags are mutable and recommends pinning base image versions. A loose tag can start pointing at a release that uses the new package names.

Check
grep -n '^FROM' Dockerfile

Fix

Pin the base image to an explicit release (or a digest), and move to a newer one deliberately along with the renamed packages.

Fix
# Dockerfile
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends libasound2t64 \
    && rm -rf /var/lib/apt/lists/*

Verify

docker build passes, and rebuilding later with --pull still uses the same release.

Verify
docker build --pull -t app:test .

Confirmed by docs.docker.com

Did this fix it?

How do I stop it coming back?

  • Pin base images to a release, not a floating tag.
  • Install libraries through the program's own dependency list where it has one (for example Playwright's install-deps).
  • Test install scripts on every Ubuntu or Debian release you support.

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?

Next step

Want this handled for good?

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