In this tutorial, we will learn about how to Fix Error Package rpm has no installation candidate. Ubuntu primarily uses the Debian package management system and the native package manager is “dpkg”. However, if you have a specific need to use “rpm” on Ubuntu to query packages, you can install the “rpm” package manager. This error is mostly seen when you try to query the packages in Ubuntu using rpm . Since rpm is not the default package manager in Ubuntu, we have to exclusively install it in order to use it. We will cover the steps required t install the rpm package which also resolves the error in the upcoming section of this tutorial. So, let us get started.
You can check the currently running Ubuntu version using below command. As you will see in the output, I am using Ubuntu22.04 version.
[email protected]:/home/linux# cat /etc/os-release PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
How to Reproduce the Issue?
We will first try to reproduce the error. This is required to make sure that we are addressing the right issue. Open the terminal in your Ubuntu system and try to install the package “rpm”. You will get the below reported error.
[email protected]:/home/linux# apt install rpm Reading package lists... Done Building dependency tree... Done Reading state information... Done Package rpm is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'rpm' has no installation candidate
[Solved] Package rpm has no installation candidate
Also Read: [Solved] How to Install EPEL Repository in Rocky Linux
Now that we have reproduced the error, we know what we have to fix. We will install the rpm package from the default Ubuntu repository which is “apt”. But before installing the “rpm” package, we will update and upgrade the repository. Let us follow these steps one by one as covered below.
Step-1 : Check “rpm” Package is Installed
In this step, check if the “rpm” package is already installed using below command. If you get the output “unknown ok not-installed” in response, it means the “rpm” package is not installed.
[email protected]/home/linux# dpkg-query -W --showformat '${Status}\n' rpm unknown ok not-installed
Step-2: Update and Upgrade the apt Repository
In this step, update and upgrade the apt repository using below command. This step will pull all the latest packages with their latest version.
[email protected]/home/linux# apt -y update && apt -y upgrade
Step-3: Install the package “rpm”
In this step, after upgrading the apt repository, install the “rpm” package using below command. This time the package installation will take place since the package can be now found in the apt repository.
[email protected]/home/linux# apt -y install rpm
Step-4: Verify the ‘rpm’ Package Installation
In this step, to verify if the rpm package is successfully installed in the system, execute rpm command as shown below. If it returns the output similar to shown below, it means rpm package is installed successfully and ready to use.
[email protected]/home/linux# rpm RPM version 4.17.0 Copyright (C) 1998-2002 - Red Hat, Inc. This program may be freely redistributed under the terms of the GNU GPL Usage: rpm [-afgplsiv?] [-a|--all] [-f|--file] [-g|--group] [-p|--package] [--pkgid] [--hdrid] [--triggeredby] [--whatconflicts] [--whatrequires] [--whatobsoletes] [--whatprovides] [--whatrecommends] [--whatsuggests] [--whatsupplements] [--whatenhances] [--nomanifest] [-c|--configfiles] .............................................................................................................................................................................................. .............................................................................................................................................................................................. [--suggests] [--supplements] [--enhances] [--info] [--changelog] [--changes] [--xml] [--triggers] [--filetriggers] [--last] [--dupes] [--filesbypkg] [--fileclass] [--filecolor] [--fileprovide] [--filerequire] [--filecaps]
Summary
We have successfully installed the rpm package on the Ubuntu operating system. You can learn more about rpm package manager and its usage from their official website rpm.org.