I am using a set of local yum repositories and trying to install a set of packages from those repos. I noticed that when one of the packages on the command line does not exist, Yum just prints out that it was not found and goes along its merry way.

Can I make Yum quit when this happens? Is there some other Yum utility that I can use to give it my repos and my packages and tell me if there is a problem?

yum --disablerepo=* --enablerepo=myrepo --nogpgcheck \
   --installroot=/var/some/place/test install \
   abasdfasfeafseasfeasef bash coreutils utils-linux

Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
No package **abasdfasfeafseasfeasef** available.
No package **utils-linux** available.



I am calling Yum from another script and don't appear to have a way to tell if the packages that I installed are really installed.

3 Answers 3


Modern versions of yum (yum-3.4.3-133.el7+, ticket) provide two options that should help with this use-case:

skip_missing_names_on_install If set to False, 'yum install' will fail if it can't find any of the provided names (package, group, rpm file). Boolean (1, 0, True, False, yes, no). Defaults to True.

skip_missing_names_on_update If set to False, 'yum update' will fail if it can't find any of the provided names (package, group, rpm file). It will also fail if the provided name is a package which is available, but not installed. Boolean (1, 0, True, False, yes, no). Defaults to True.

Source: man-pages


yum --setopt=skip_missing_names_on_install=False <commands-here>

  • 1
    This could do with some extra explanation around it and perhaps a pointer to the Yum manuals as housed at man7.org/linux/man-pages/man5/yum.conf.5.html but it does seem to solve the problem perfectly.
    – TafT
    Nov 16, 2018 at 15:20
  • If you want this yum option to always be set for all user on the entire system you can modify your system level yum.conf see man yum.conf. For a system that is used 100% for building containers this option should be the default IMO to ensure your containers have all the listed items in your yum install commands. Jan 8, 2021 at 14:38

Try using dnf instead of yum, it will fail if a package isn't available the way yum used to. On CentOS you can install it via:

yum -y install epel-release && \
yum -y install dnf

Then on a missing package you'll get an error:

dnf -y install foobar
Error: no package matched: foobar
  • 2
    Your first snippet gives another answer on its own: just use yum -y install foo && yum -y install bar && ... -- yum install will fail if it it's given just 1 package and it can't install that package
    – kbolino
    May 10, 2018 at 0:08

I don't know about yum, but you can ask whether a package is installed using rpm -q my_package .... It will exit with failure status if any of the packages are missing.

$ rpm -q abasdfasfeafseasfeasef bash coreutils utils-linux
package abasdfasfeafseasfeasef is not installed
package utils-linux is not installed
$ echo $?
$ rpm -q bash
$ echo $?
  • In my situation, I know that the package is not installed because I am installing into a local directory (--installroot option). The problem is that the package doesn't exist in the repository and yum doesn't care :(
    – Randy
    Oct 31, 2014 at 21:43
  • How about rpm --root=/var/some/place/test -q ...?
    – Jander
    Oct 31, 2014 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.