apt cannot install qt5-default on Ubuntu 22.04 and later
E: Package 'qt5-default' has no installation candidateShort answer
qt5-default no longer exists in Ubuntu 22.04 or later, so apt cannot install it. Install the development package for the Qt version you need instead: qtbase5-dev for Qt 5 or qt6-base-dev for Qt 6. Both live in the universe repository, so universe must be enabled.
Fix it fast
1Find out which cause you have
Ask apt whether it knows the Qt 5 base development package. If it does, the old package name was the whole problem.
apt-cache policy qtbase5-dev qt6-base-dev2Match what you see, then jump to its fix
What does the error look like?
E: Package 'qt5-default' has no installation candidateProblem installing qt5-default on Ubuntu 22.04
Cause 1 of 2
qt5-default was removed from Ubuntu
1Check
Search the Ubuntu package archive for the name. For every Ubuntu release it returns no result, including 22.04 (jammy). The Qt 5 development files are in qtbase5-dev, version 5.15.3 on 22.04.
apt-cache search qtbase5-dev2Fix
Install the package that matches the tool you build with. qtbase5-dev gives the Qt 5 base development files, and qtbase5-dev-tools the Qt 5 base development programs.
sudo apt install qtbase5-dev qtbase5-dev-tools3Verify
apt reports both packages as installed.
dpkg -s qtbase5-dev | head -n 3Confirmed by packages.ubuntu.com
Cause 2 of 2
The project is meant for Qt 6, not Qt 5
1Check
Installing Qt 5 for a Qt 6 project only moves the error. Ubuntu 22.04 provides Qt 6 development files in qt6-base-dev, version 6.2.4.
grep -ri 'qt6\|Qt5' CMakeLists.txt *.pro 2>/dev/null | head2Fix
Install the Qt 6 base development package for a Qt 6 project.
sudo apt install qt6-base-dev3Verify
apt reports the package as installed.
dpkg -s qt6-base-dev | head -n 3Confirmed by packages.ubuntu.com
How do I stop it coming back?
- Read the Qt major version a project targets before choosing packages.
- Treat install lines in older tutorials as hints and check each name with apt-cache policy.
- Both Qt development packages are in the universe component, so keep universe enabled on Ubuntu.
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