The same issue happened to me on Focal, a pretty bare install from the default:

# apt install zlib1g-dev                                                                    
Reading package lists... Done                                                                                                          
Building dependency tree                                                                                                               
Reading state information... Done                                                                                                      
Some packages could not be installed. This may mean that you have                                                                      
requested an impossible situation or if you are using the unstable                                                                     
distribution that some required packages have not yet been created                                                                     
or been moved out of Incoming.                                                                                                         
The following information may help to resolve the situation:                                                                           
                                                                                                                                       
The following packages have unmet dependencies.                                                                                        
 zlib1g-dev : Depends: zlib1g (= 1:1.2.11.dfsg-2ubuntu1) but 1:1.2.11.dfsg-2ubuntu1.2 is to be installed

To get zlib1g-dev to install it was necessary to downgrade zlib1g, which tbh is ridiculous for something in the main repo:

# apt install zlib1g=1:1.2.11.dfsg-2ubuntu1

A similar issue happened when trying to install openssh-server after first post-install boot.

Answer from cEz on askubuntu.com
🌐
Pkgs.org
pkgs.org › download › zlib1g-dev
Zlib1g-dev Download for Linux (deb)
Download zlib1g-dev linux packages for Debian, Ubuntu
🌐
LinuxCapable
linuxcapable.com › home › ubuntu › how to install zlib on ubuntu 26.04, 24.04 and 22.04
How to Install zlib on Ubuntu 26.04, 24.04 and 22.04 - LinuxCapable
May 5, 2026 - Build failures that mention zlib.h, -lz, or a missing zlib library usually mean Ubuntu has the runtime library but not the development headers. To install zlib on Ubuntu for compiling software, use the zlib1g-dev package from Ubuntu’s main repository; it provides the headers, static library, ...
🌐
Ubuntu Packages
ubuntu.pkgs.org › 20.04 › ubuntu-main-amd64 › zlib1g-dev_1.2.11.dfsg-2ubuntu1_amd64.deb.html
zlib1g-dev_1.2.11.dfsg-2ubuntu1_amd64.deb Ubuntu 20.04 LTS Download
# sudo apt-get install zlib1g-dev · 2020-02-25 - Matthias Klose <doko@ubuntu.com> zlib (1:1.2.11.dfsg-2ubuntu1) focal; urgency=medium * Merge with Debian; remaining changes: - Build x32 packages - debian/zlib-core.symbols: Drop dfsg suffix from version - Add watch file, with GPG tarball checking, ...
🌐
Ubuntu
launchpad.net › ubuntu › bionic › +package › zlib1g-dev
zlib1g-dev : Bionic (18.04) : Ubuntu
zlib is a library implementing the deflate compression method found in gzip and PKZIP. This package includes the development support files. zlib 1:1.2.11.dfsg-0ubuntu2.2 source package in Ubuntu · zlib1g-dev 1:1.2.11.dfsg-0ubuntu2 in amd64 (Release)
🌐
Ubuntu
packages.ubuntu.com › bionic › zlib1g-dev
Ubuntu – Error
two or more packages specified (zlib1g-dev bionic) Content Copyright © 2026 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
UbuntuUpdates
ubuntuupdates.org › zlib1g-dev
UbuntuUpdates - Package "zlib1g-dev" (resolute 26.04)
UbuntuUpdates.org · Raw Package Information · All versions of this package · Bug fixes · List of files in package · Repository home page · 32-bit deb package · 64-bit deb package · APT INSTALL · No other version of this package is available in the Resolute release.
Find elsewhere
🌐
SysTutorials
systutorials.com › installing-zlib-in-ubuntu-22-04
Installing Zlib On Ubuntu 24.04 And 22.04 LTS - SysTutorials
April 12, 2026 - sudo apt install libssl-dev libcurl4-openssl-dev libreadline-dev libbz2-dev · These cover OpenSSL, curl, readline, and bzip2—all commonly needed alongside zlib when compiling from source. For Installing Zlib on Ubuntu 24.04 and 22.04 LTS, understanding both the fundamentals and modern practices ensures you can work efficiently and avoid common pitfalls.
🌐
Ubuntu
packages.ubuntu.com › jammy › zlib1g-dev
Ubuntu – Details of package zlib1g-dev in jammy
Download Source Package zlib: [zlib_1.2.11.dfsg-2ubuntu9.2.dsc] [zlib_1.2.11.dfsg.orig.tar.gz] [zlib_1.2.11.dfsg-2ubuntu9.2.debian.tar.xz] Maintainer: Ubuntu Developers (Mail Archive) · Please consider filing a bug or asking a question via Launchpad before contacting the maintainer directly
🌐
Installati.one
installati.one › home › how to install zlib1g-dev on ubuntu 20.04
How To Install zlib1g-dev on Ubuntu 20.04 | Installati.one
June 13, 2023 - In this tutorial we learn how to install zlib1g-dev package on Ubuntu 20.04 using different package management tools: apt, apt-get and aptitude.
Top answer
1 of 3
1

I was able to do the installation with:

sudo apt-get update && sudo sudo apt-get install zlib1g-dev

After updating /etc/apt/sources.list with the following:

Copy#------------------------------------------------------------------------------#
#                            OFFICIAL UBUNTU REPOS                             #
#------------------------------------------------------------------------------#


###### Ubuntu Main Repos
deb http:// us.archive .ubuntu. com/ubuntu/ xenial main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial main restricted universe multiverse 

###### Ubuntu Update Repos
deb http:// us.archive .ubuntu. com/ubuntu/ xenial-security main restricted universe multiverse 
deb http://us.archive .ubuntu. com/ubuntu/ xenial-updates main restricted universe multiverse 
deb http:// us.archive .ubuntu. com/ubuntu/ xenial-proposed main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-security main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-updates main restricted universe multiverse 
deb-src http:// us.archive .ubuntu. com/ubuntu/ xenial-proposed main restricted universe multiverse 

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu xenial partner
deb-src http://archive.canonical.com/ubuntu xenial partner
2 of 3
0

I would try a sudo apt-get update to start (sometimes the problem is trivial!). Consider including the results of dpkg --get-selections | grep hold in the comments.

Autoremove might help, too!

Finally, trying again with aptitude (https://unix.stackexchange.com/questions/767/what-is-the-real-difference-between-apt-get-and-aptitude-how-about-wajig) might highlight the issue.

Tough to diagnose without more information.

🌐
Ubuntu
packages.ubuntu.com › focal › zlib1g-dev
Details of package zlib1g-dev in focal
two or more packages specified (zlib1g-dev focal) Content Copyright © 2026 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
idroot
idroot.us › home › how to install zlib on ubuntu 22.04 lts
How To Install Zlib on Ubuntu 22.04 LTS - idroot
May 8, 2024 - Now run the following command below to install the latest version of Zlib to your Ubuntu system: ... This command instructs APT to install the zlib1g-dev package, which contains the Zlib library.
🌐
Ubuntu
packages.ubuntu.com › zlib1g-dev
Ubuntu – Package Search Results -- zlib1g-dev
You have searched for packages that names contain zlib1g-dev in all suites, all sections, and all architectures.
🌐
Ubuntu
launchpad.net › ubuntu › xenial › +package › zlib1g-dev
zlib1g-dev : Xenial (16.04) : Ubuntu - Launchpad
zlib is a library implementing the deflate compression method found in gzip and PKZIP. This package includes the development support files. zlib 1:1.2.8.dfsg-2ubuntu4.3 source package in Ubuntu · zlib1g-dev 1:1.2.8.dfsg-2ubuntu4 in amd64 (Release)
🌐
Ask Ubuntu
askubuntu.com › questions › 1156570 › how-to-install-zlib1g-devarmhf
apt - How to install zlib1g-dev:armhf - Ask Ubuntu
July 7, 2019 - I need to install e.g. zlib1g-dev for cross-development. $ sudo apt install zlib1g-dev:armhf Reading package lists... Done Building dependency tree Reading state information... Done Some pa...