Puppet/yum fails to install old packages

378 views
Skip to first unread message

Mark Rosedale

unread,
Aug 7, 2014, 10:31:19 AM8/7/14
to puppet...@googlegroups.com
Hello,

So I'm specifying specific packages to install for some of my critical software. This is specifically related to centos/yum. When new packages are released I get errors when running puppet saying that yum has failed to install the specified package because a newer version is available, but the package does in fact install. Upon the second run it sees the correct version and the catalog runs cleanly. 

Example code. 

$postgresqlVersion = $::lsbdistrelease ? {
      '5.10'            => "9.2.8-1PGDG.rhel5",
      '6.5'     => "9.2.8-1PGDG.rhel6",
      default           => "9.2.8-1PGDG.rhel6",
    }

package { $packageList:
    ensure      => $postgresqlVersion,
  }

The conflicting package is on centos5 The new version available is 9.2.9-1PGDG.rhel5. First run we get errors like the following

Notice: /Stage[main]/Postgresql::Install/Package[postgresql-server-8.1.23-10.el5_10]/ensure: created
Error: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-server-9.2.8-1PGDG.rhel5' returned 1: postgres
ql92-9.2.8-1PGDG.rhel5.x86_64 from vivox-postgresql has depsolving problems
  --> Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-po
stgresql)
Error: Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-p
ostgresql)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
Wrapped exception:
Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-server-9.2.8-1PGDG.rhel5' returned 1: postgresql92-9.2.8-1PGDG.rhel5.x8
6_64 from vivox-postgresql has depsolving problems

I get this for all the postgres packages I'm trying to install, however, even with these errors if I check all of the packages have been installed. 
rpm -qa | grep postgres
postgresql-libs-8.1.23-10.el5_10
postgresql92-libs-9.2.8-1PGDG.rhel5
postgresql-libs-8.1.23-10.el5_10
postgresql92-9.2.8-1PGDG.rhel5

So on the second run everything that was missed, due to the errors, gets completed and I now have a clean run. 

My question is, is there a way to work around this so that puppet doesn't error out on the first run? 

Thanks,
mjr

Matthias Saou

unread,
Aug 8, 2014, 6:22:31 AM8/8/14
to puppet...@googlegroups.com
Hi,

This seems like a problem in your yum repositories, or the rpm
packages they contain. On a clean system, without running any of this,
what does the following do? Does it work?

yum install postgresql92-9.2.8-1PGDG.rhel5

Because according to the output you've sent, yum doesn't find the
matching 'libs' package, yet it ends up on the system somehow in the
end...

Also, in that output, puppet says that the server 8.1.23-10.el5_10
package got installed, but it's not in your final "rpm -qa | grep
postgres" output, so I'm guessing you're not being completely honest
with us here :-)

Since many details are missing, it could be that you're enabling
multiple repositories with a wrong ordering, resulting in puppet not
finding all of the packages on the first run. If that's the case, have
a look at stages and make sure you manage your yum repo configuration
in once which is before 'main'.

Matthias
--
Matthias Saou ██ ██
██ ██
Web: http://matthias.saou.eu/ ██████████████
Mail/XMPP: matt...@saou.eu ████ ██████ ████
██████████████████████
GPG: 4096R/E755CC63 ██ ██████████████ ██
8D91 7E2E F048 9C9C 46AF ██ ██ ██ ██
21A9 7A51 7B82 E755 CC63 ████ ████

Mark Rosedale

unread,
Aug 8, 2014, 11:33:48 AM8/8/14
to puppet...@googlegroups.com
Hey Matthias, 

Thanks for the response. So I do see some additional information that may help. 

So it appears that puppet does successfully install postgresql and postgresql-server and postgres92, and that explains what did get installed.

Notice: /Stage[pre]/Yum::Repo/Exec[refresh-yum-cache]: Triggered 'refresh' from 1 events
Notice: /Stage[main]/Postgresql::Install/Package[postgresql-8.1.23-10.el5_10]/ensure: created
Notice: /Stage[main]/Postgresql::Install/Package[postgresql-server-8.1.23-10.el5_10]/ensure: created
Error: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-server-9.2.8-1PGDG.rhel5' returned 1: postgres
ql92-9.2.8-1PGDG.rhel5.x86_64 from vivox-postgresql has depsolving problems
  --> Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-po
stgresql)
Error: Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-p
ostgresql)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
Wrapped exception:
Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-server-9.2.8-1PGDG.rhel5' returned 1: postgresql92-9.2.8-1PGDG.rhel5.x8
6_64 from vivox-postgresql has depsolving problems
  --> Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-po
stgresql)
Error: Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-p
ostgresql)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
Error: /Stage[main]/Postgresql::Install/Package[postgresql92-server]/ensure: change from absent to 9.2.8-1PGDG.rhel5 failed: Could n
ot update: Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-server-9.2.8-1PGDG.rhel5' returned 1: postgresql92-9.2.8-1PG
DG.rhel5.x86_64 from vivox-postgresql has depsolving problems
  --> Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-po
stgresql)
Error: Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-p
ostgresql)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
Error: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-contrib-9.2.8-1PGDG.rhel5' returned 1: postgre
sql92-9.2.8-1PGDG.rhel5.x86_64 from vivox-postgresql has depsolving problems
  --> Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-po
stgresql)
Error: Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-p
ostgresql)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
Wrapped exception:
Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-contrib-9.2.8-1PGDG.rhel5' returned 1: postgresql92-9.2.8-1PGDG.rhel5.x
86_64 from vivox-postgresql has depsolving problems
  --> Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-po
stgresql)
Error: Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-p
ostgresql)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
Wrapped exception:
Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-devel-9.2.8-1PGDG.rhel5' returned 1: postgresql92-9.2.8-1PGDG.rhel5.x86_64 from vivox-postgresql has depsolving problems
  --> Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-postgresql)
Error: Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-postgresql)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
Error: /Stage[main]/Postgresql::Install/Package[postgresql92-devel]/ensure: change from absent to 9.2.8-1PGDG.rhel5 failed: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install postgresql92-devel-9.2.8-1PGDG.rhel5' returned 1: postgresql92-9.2.8-1PGDG.rhel5.x86_64 from vivox-postgresql has depsolving problems
  --> Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-postgresql)
Error: Missing Dependency: postgresql92-libs = 9.2.8-1PGDG.rhel5 is needed by package postgresql92-9.2.8-1PGDG.rhel5.x86_64 (vivox-postgresql)
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest
Notice: /Stage[main]/Postgresql::Install/Package[postgresql92]/ensure: created


So here is my install manifest
class postgresql::install($version) {
  $postgresBase = $version ? {
    '8'                 => "postgresql",
    default             => "postgresql92",
  }

  if ( $postgresBase == '8' ) {
    $postgresqlVersion = $::lsbdistrelease ? {
      '5.10'    => "8.1.23-10.el5_10",
      '6.5'     => "8.4.18-1.el6_4",
      default   => "8.1.23-10.el5_10",
    }
  }
  else {
    $postgresqlVersion = $::lsbdistrelease ? {
      '5.10'            => "9.2.8-1PGDG.rhel5",
      '6.5'     => "9.2.8-1PGDG.rhel6",
      default           => "9.2.8-1PGDG.rhel6",
    }
  }

  if ( $postgresBase != '8' ) {
    $removePackageList = [ "postgresql-8.1.23-10.el5_10",
                           "postgresql-server-8.1.23-10.el5_10", ]
    package { $removePackageList:
      ensure    => "purged",
    }
  }

  $packageList = [ "${postgresBase}",
                   "${postgresBase}-server",
                   "${postgresBase}-contrib",
                   "${postgresBase}-devel", ]

  package { $packageList:
    ensure      => $postgresqlVersion,
  }
}


So we have cloned all of the yum repos we need locally. I'm setting up all of those repos in stage => 'pre' which is set up to run before any of the other modules, including postgres. So yum is running and fully set up before postgres tries to install those packages. 

So what is failing is, but completes on the second run is 
Notice: /Stage[main]/Postgresql::Install/Package[postgresql92-server]/ensure: created
Notice: /Stage[main]/Postgresql::Install/Package[postgresql92-contrib]/ensure: created
Notice: /Stage[main]/Postgresql::Install/Package[postgresql92-devel]/ensure: created

So after 2 runs I finally get all the packages that I needed

rpm -qa | grep postgres
postgresql92-9.2.8-1PGDG.rhel5
postgresql92-devel-9.2.8-1PGDG.rhel5
postgresql-libs-8.1.23-10.el5_10
postgresql92-libs-9.2.8-1PGDG.rhel5
postgresql92-server-9.2.8-1PGDG.rhel5
postgresql92-contrib-9.2.8-1PGDG.rhel5
postgresql-libs-8.1.23-10.el5_10

Thoughts? 

jcbollinger

unread,
Aug 13, 2014, 1:20:43 PM8/13/14
to puppet...@googlegroups.com


Puppet has a limitation with respect to installing packages that it manages each package separately.  At times that can be a performance issue.  It may be that under certain circumstances it also presents a dependency issue.  Very likely if you try to perform package updates from the command line in the same order that you observe Puppet trying to use, then you will see the same depsolving problems.  That might provide additional insight into the nature of the problem.

Supposing that you cannot / will not repackage postgreSQL, though, the nature of the problem doesn't matter much.  Since evidently there are update orders that work, you can just instruct Puppet that it must manage those package in such an order.  For example:

  $packageList = [
                   "${postgresBase}-server",
                   "${postgresBase}-contrib",
                   "${postgresBase}-devel", ]

  package { ${postgresBase}:
    ensure      => $postgresqlVersion,
  }

  ->

  package { $packageList:
    ensure      => $postgresqlVersion,
  }


The order of the declarations in the file doesn't necessarily matter, but the chaining operator (->) between the delcarations does.  You can also use one of the relational metaparameters ('require' would probably be best) instead of a chain.


John

Mark Rosedale

unread,
Sep 3, 2014, 12:43:17 PM9/3/14
to puppet...@googlegroups.com
Yes, I finally sat down and really dug into this problem and it was an ordering thing...but it wasn't just ordering. It turned out that the dependency issue was with postgresql92-libs. If I installed that by hand first then I would get a clean run in puppet with all the other packages and the version I wanted installed. The code I used to order was the following (though I like your solution a bit better).

Package['postgresql92-libs']->Package['postgresql92-server']->Package['postgresql92-contrib']->Package['postgresql92-devel']
 

$packageList = [ "${postgresBase}",
                   "${postgresBase}-libs",
                   "${postgresBase}-server",
                   "${postgresBase}-contrib",
                   "${postgresBase}-devel", ]

  package { $packageList:
    ensure      => $postgresqlVersion,
  }

So the short of the story was that it was both ordering *and* a missing package that was creating my problem. 

Mark Rosedale

unread,
Sep 3, 2014, 12:49:49 PM9/3/14
to puppet...@googlegroups.com
Yes so this is now my code, thank you John. 

$packageList = [ "${postgresBase}",
                   "${postgresBase}-server",
                   "${postgresBase}-contrib",
                   "${postgresBase}-devel", ]

  package { "${postgresBase}-libs":
    ensure => $postgresqlVersion,
  }

  ->

  package { $packageList:
    ensure      => $postgresqlVersion,
  }

And that works, it installs the one dependency I need ahead of time and does the rest in whatever order. 

Thank you,
mjr
Reply all
Reply to author
Forward
0 new messages