centos7: pkg install directly from "sources" issue

355 views
Skip to first unread message

T.J. Yang

unread,
Apr 8, 2016, 6:50:46 AM4/8/16
to Salt-users
Hi 

This is my first time trying to install rpm from file/http source installed of default rpm repo.


1. sls file on master.

<snipped>
install rpm pkgs on saltmaster:
  pkg.installed:
    - sources:
       - nss-pam-ldapd-0.8.13-9:  salt://files/nss-pam-ldapd-0.8.13-9.x86_64.rpm
<snipped>

2: error from running "salt-call state.highstate" on minion01 client.

<snipped>
[INFO    ] Running state [install rpm pkgs on saltmaster] at time 05:41:44.555855
[INFO    ] Executing state pkg.installed for install rpm pkgs on saltmaster
[INFO    ] Executing command ['yum', '--quiet', 'clean', 'expire-cache'] in directory '/root'
[INFO    ] Executing command ['yum', '--quiet', 'check-update'] in directory '/root'
[INFO    ] Fetching file from saltenv 'base', ** skipped ** latest already in cache u'salt://files/nss-pam-ldapd-0.8.13-9.x86_64.rpm'
[INFO    ] Executing command "rpm -qp --queryformat '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-none' /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm" in directory '/root'
[INFO    ] Executing command ['yum', '-y', 'install', u'/var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm'] in directory '/root'
[ERROR   ] Command ['yum', '-y', 'install', u'/var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm'] failed with return code: 1
[ERROR   ] stdout: Loaded plugins: changelog, fastestmirror, langpacks
Examining /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm: nss-pam-ldapd-0.8.13-9.x86_64
Error: Nothing to do
[ERROR   ] retcode: 1
[INFO    ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n'] in directory '/root'
[ERROR   ] The following packages failed to install/update: nss-pam-ldapd-0.8.13-9
[INFO    ] Completed state [install rpm pkgs on saltmaster] at time 05:41:52.352444

<snipped>

3. rpm is downloaded in cache dir
[root@minion01 ~]# ls -l /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm
-rw------- 1 root root 161520 Apr  8 05:18 /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm
[root@minion01 ~]#

4. Run the yum command directly has error also.

[root@minion01 ~]#  yum -y install /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm
Loaded plugins: changelog, fastestmirror, langpacks
Examining /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm: nss-pam-ldapd-0.8.13-9.x86_64
Error: Nothing to do

[root@minion01 ~]# rpm -qa |grep nss-pam
[root@minion01 ~]#

5. But if I run rpm on cached rpm then rpm will be installed.

[root@minion01 ~]# rpm -ivh  /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:nss-pam-ldapd-0.8.13-9           ################################# [100%]
[root@minion01 ~]# 

6. client and OS info

[root@minion01 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@minion01 ~]# salt-minion --version
salt-minion 2015.8.8.2 (Beryllium)
[root@minion01 ~]#




Ben Hosmer

unread,
Apr 9, 2016, 8:23:32 AM4/9/16
to Salt-users
You've identified that this ins't a problem with SALT, since the package install fails even with 'yum install'. Can you try with verbose mode? 'yum -v -y install ...'? Maybe a 'yum clean all' prior to install will fix it?

T.J. Yang

unread,
Apr 10, 2016, 7:17:52 AM4/10/16
to Salt-users

Hi Ben

1. Thanks for your pointer on "yum -v -v install". Turns it was my own doing for why nss-pam-ldapd was not installed. 

I prepared nss-pam-ldapd-0.8.13-9.x86_64.rpm to fix a bug in nss-pam-ldapd-0.8.13-8.x86_64.rpm
And I added following line /etc/yum.conf to disable regular yum update to update my version of nss-pam-ldapd.

[root@minion01 ~]# grep exclude /etc/yum.conf
exclude=nss-pam-ldapd
[root@minion01 ~]#

2. Do you think if is reasonable to submit a RFC request to change "pkg.install from source" rpm to use rpm directly, instead of yum ?

tj

On Saturday, April 9, 2016 at 7:23:32 AM UTC-5, Ben Hosmer wrote:
You've identified that this ins't a problem with SALT, since the package install fails even with 'yum install'. Can you try with verbose mode? 'yum -v -y install ...'?

 yum -v -v install  /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm
Loading "changelog" plugin
Loading "fastestmirror" plugin
Loading "langpacks" plugin
Adding en_US.UTF-8 to language list
Config time: 0.013
Yum version: 3.4.3
rpmdb time: 0.000
Examining /var/cache/salt/minion/files/base/files/nss-pam-ldapd-0.8.13-9.x86_64.rpm: nss-pam-ldapd-0.8.13-9.x86_64
Excluding nss-pam-ldapd-0.8.13-9.x86_64
Error: Nothing to do

Ben Hosmer

unread,
Apr 10, 2016, 7:31:44 AM4/10/16
to Salt-users
Awesome, I'm glad it worked. This is one of the reasons I _always_ like to use yum instead of rpm. Yum will tell you if you have dependency issues whereas rpm won't. 

What's your reasoning behind the request for pkg.installed to use rpm directly? This probably would not be an easy feat, since pkg actually abstracts the package manager away depending on the flavor of the operating system. You can write a pkg.installed state that can be used on any of those systems.

Because of that, I can't say I would vote for changing pkg to use rpm directly, but you may offer something that I can't think of.


On Friday, April 8, 2016 at 6:50:46 AM UTC-4, T.J. Yang wrote:

T.J. Yang

unread,
Apr 10, 2016, 7:52:23 AM4/10/16
to Salt-users


On Sunday, April 10, 2016 at 6:31:44 AM UTC-5, Ben Hosmer wrote:
Awesome, I'm glad it worked.

Yes, it worked after I remove the exclude from yum.conf, rpm got installed now but ended in failed state !?

<snipped>
[INFO    ] Running state [install rpm pkgs on saltmaster] at time 07:31:43.960128
[INFO    ] Executing state pkg.installed for install rpm pkgs on saltmaster
[INFO    ] Executing command ['yum', '--quiet', 'clean', 'expire-cache'] in directory '/root'
[INFO    ] Executing command ['yum', '--quiet', 'check-update'] in directory '/root'
[INFO    ] Executing command "rpm -qp --queryformat '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-none' /var/cache/salt/minion/extrn_files/base/motopkg.mot.com/dist/nss-pam-ldapd/nss-pam-ldapd-0.8.13-9.x86_64.rpm" in directory '/root'
[INFO    ] Executing command ['yum', '-y', 'install', '/var/cache/salt/minion/extrn_files/base/motopkg.mot.com/dist/nss-pam-ldapd/nss-pam-ldapd-0.8.13-9.x86_64.rpm'] in directory '/root'
[INFO    ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)\n'] in directory '/root'
[ERROR   ] Made the following changes:
'nss-pam-ldapd' changed from 'absent' to '0.8.13-9'

[INFO    ] Loading fresh modules for state activity


<snipped>
----------
          ID: install rpm pkgs on saltmaster
    Function: pkg.installed
      Result: False
     Comment: The following packages failed to install/update: nss-pam-ldapd-0.8.13-9
     Started: 07:31:43.960128
    Duration: 17906.718 ms
     Changes:
              ----------
              nss-pam-ldapd:
                  ----------
                  new:
                      0.8.13-9
                  old:
<snipped>
Summary for local
-------------
Succeeded: 20 (changed=1)
Failed:     1
-------------
Total states run:     21

 
This is one of the reasons I _always_ like to use yum instead of rpm. Yum will tell you if you have dependency issues whereas rpm won't. 

What's your reasoning behind the request for pkg.installed to use rpm directly?

Why: I need to maintain my own set of rpms, few rpms are fixed rpms before my patch can be accepted by upstreadm and down flow into RHEL and then CentOS.
        most others are individual/standalone rpms from vendor or our org.  all these are rpms need be protected by "exclude=" line in /etc/yum.conf from "yum update"
        if pkg.install use yum  and ignore above case, then one will get into my issue here.
 
I am proposing for pkg.installed on direct file path, use rpm(See below). For other cases still using yum.

<snipped>
install rpm pkgs on saltmaster:
  pkg.installed:
    - sources:
       - hellworld:  salt://files/helloworld.x86_64.rpm
<snipped>

Ben Hosmer

unread,
Apr 11, 2016, 6:37:16 AM4/11/16
to Salt-users
SALT can install from a local source. This is straight from the docs: https://docs.saltstack.com/en/latest/ref/states/all/salt.states.pkg.html#salt.states.pkg.installed

mypkgs:
  pkg.installed:
    - sources:
      - foo: salt://rpms/foo.rpm
      - bar: http://somesite.org/bar.rpm
      - baz: ftp://someothersite.org/baz.rpm
      - qux: /minion/path/to/qux.rpm

On Friday, April 8, 2016 at 6:50:46 AM UTC-4, T.J. Yang wrote:

T.J. Yang

unread,
Apr 11, 2016, 10:22:30 AM4/11/16
to Salt-users


On Monday, April 11, 2016 at 5:37:16 AM UTC-5, Ben Hosmer wrote:
SALT can install from a local source. This is straight from the docs: https://docs.saltstack.com/en/latest/ref/states/all/salt.states.pkg.html#salt.states.pkg.installed

I am proposing for rpm packages from local sources, use rpm to stall them on minion host, not the currently yum.

Ben Hosmer

unread,
Apr 12, 2016, 7:34:36 AM4/12/16
to Salt-users
But, why though? You can use the pkg.installed state to do what you want with RPMs that are on your local file system. What does yum not do that RPM does for you?

T.J. Yang

unread,
Apr 13, 2016, 7:43:06 AM4/13/16
to Salt-users


On Tuesday, April 12, 2016 at 6:34:36 AM UTC-5, Ben Hosmer wrote:
But, why though? You can use the pkg.installed state to do what you want with RPMs that are on your local file system. What does yum not do that RPM does for you?

yum is doing too much actually that it check/honor  "exclude" line in /etc/yum.conf which is I want to avoid.

Ben Hosmer

unread,
Apr 14, 2016, 6:19:33 AM4/14/16
to Salt-users
Have you seen the options available for yumpkg: https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.yumpkg.html

It isn't clear to me still what issue you're having. As a CentOS user, I wouldn't want to use RPM instead of yum because I'd lose the dependency resolution.

T.J. Yang

unread,
Apr 14, 2016, 7:32:53 AM4/14/16
to Salt-users


On Thursday, April 14, 2016 at 5:19:33 AM UTC-5, Ben Hosmer wrote:
Thanks for this url pointer but I can't find possible solution using yumpkg options.
 
It isn't clear to me still what issue you're having.

Using yum for pkg.install is fine with external rpm repositories, or even internal repo some org may set up themselves.
My issue is that I don't want to set up internal rpm epo server and yet I have a list of standalone RPMs from vendor or internal source.
I like to put these standalone RPMs on saltmaster or a web server. So following syntax look good to me except it is using yum.
but /etc/yum.conf had exclude line to exclude these two rpms to avoid yum update conflict.

vendor rpm:  SMCquiesce-1.0.0-002.x86_64.rpm to be  put on VMware VM for symantec netbackup to backup the whole VM.
internal rpm:  nss-pam-ldapd-0.8.13-9.x86_64.rpm to fix a bug nss-pam-ldapd-0.8.13-8.x86_64.rpm in centos 7.

 
pkg.installed:
    - sources:

I think above syntax can be modified to provide extra option to specify rpm over yum  when "sources" is http or saltmaster filer.

Hope I made my case clear this time.

Loren Gordon

unread,
Apr 14, 2016, 7:50:53 AM4/14/16
to Salt-users
You could probably write an "rpmpkg" package provider that used rpm instead of yum...


Then your state would be something like this:

pkg.installed:
    - sources:
    - provider: rpmpkg

As an immediate workaround, you can always use cmd.run to execute rpm, rather than trying to force pkg.installed to do it...

-Loren

T.J. Yang

unread,
Apr 14, 2016, 8:21:58 AM4/14/16
to Salt-users


On Thursday, April 14, 2016 at 6:50:53 AM UTC-5, Loren Gordon wrote:
You could probably write an "rpmpkg" package provider that used rpm instead of yum...


Then your state would be something like this:

pkg.installed:
    - sources:
    - provider: rpmpkg


This will be a good exercise for me know saltstack deeper.
 
As an immediate workaround, you can always use cmd.run to execute rpm, rather than trying to force pkg.installed to do it...

Another good pointer on using cmd.run.

Thanks Loren
Reply all
Reply to author
Forward
0 new messages