Recover from a yum error


#1

We have an error that crops up from time to time (often enough to be really
annoying) with yum in which something get’s corrupted with a metadata.xml
file. Error looks like this:

[Tue, 18 Oct 2011 21:59:44 +0000] ERROR: package[libxslt-devel]
(cloudwatch_monitoring::default line 27) has had an error
[Tue, 18 Oct 2011 21:59:44 +0000] ERROR: package[libxslt-devel]
(/var/chef/cache/cookbooks/cloudwatch_monitoring/recipes/default.rb:27:in
`block in from_file’) had an error:
package[libxslt-devel] (cloudwatch_monitoring::default line 27) had an
error: yum -d0 -e0 -y install libxslt-devel-1.1.26-2.6.amzn1 returned 1,
expected 0

Several yum packages installed before this one so the corruption is
happening in flight. Not blaming chef because I’m sure it’s not a chef
problem, just want to know if I can handle it in-flight instead of scraping
the entire deploy.

If I try to run the command on the command line of the host I get:

Error: File /var/cache/yum/x86_64/latest/epel/metalink.xml is not XML

If I run a ‘yum clean all’ it fixes the issue and I back up and running.
Except this is after the chef run has failed. What I’m looking for is some
fancy way to catch the exception, have it run ‘yum clean all’, and then
retry the yum. Anyone have any cool ideas?

MG


#2

On Tue, Oct 18, 2011 at 3:39 PM, Michael Glenney mike.glenney@gmail.com wrote:

We have an error that crops up from time to time (often enough to be really
annoying) with yum in which something get’s corrupted with a metadata.xml
file. Error looks like this:

[Tue, 18 Oct 2011 21:59:44 +0000] ERROR: package[libxslt-devel]
(cloudwatch_monitoring::default line 27) has had an error
[Tue, 18 Oct 2011 21:59:44 +0000] ERROR: package[libxslt-devel]
(/var/chef/cache/cookbooks/cloudwatch_monitoring/recipes/default.rb:27:in
`block in from_file’) had an error:
package[libxslt-devel] (cloudwatch_monitoring::default line 27) had an
error: yum -d0 -e0 -y install libxslt-devel-1.1.26-2.6.amzn1 returned 1,
expected 0
Several yum packages installed before this one so the corruption is
happening in flight. Not blaming chef because I’m sure it’s not a chef
problem, just want to know if I can handle it in-flight instead of scraping
the entire deploy.

If I try to run the command on the command line of the host I get:

Error: File /var/cache/yum/x86_64/latest/epel/metalink.xml is not XML

Haven’t seen this error myself but judging from a discussion in

http://comments.gmane.org/gmane.linux.redhat.fedora.general/366552

I’d wager the culprit is an out of date/broken epel mirror. Seen this
before and it can cause some silly issues.

Possible to to run your own? We rsync epel/x86_64 for centos 5 nightly
here, it clocks in at 8GB right now.

Matthew Kent | http://magoazul.com