yum update fail

I ran into a problem yesterday in updating my Fedora 19 installation: a yum transaction died in the middle of upgrading ~150 packages, and left as many duplicates in its wake. Here’s how to go about fixing such failures.

Image

Every few days, I manually run a `yum update` to bring my system up to date. But I’ve found `yum update` alone to be inadequate or problematic, so I run instead:

sudo yum clean all && sudo yum clean metadata && sudo yum -y update yum \
  && sudo yum update --skip-broken

This command first cleans out existing yum data and metadata, which takes a bit of extra time but is worth doing to ensure repo information is current. It then checks for updates to the yum package itself, updates it automatically if necessary, then updates (after your manual confirmation) any remaining, outdated packages, skipping over any package updates that appear to be problematic.

This method works 99.9% of the time, but yesterday’s update stopped right in the middle of the transaction and never recovered. Subsequent update runs reported an aborted transaction, along with 148 duplicate packages — apparently, the update had stopped somewhere between the processes of installing the new package versions and cleaning out the old ones — and failed to complete. Error messages gave recommended methods for resolving the problem — including the commands:

  • `yum-complete-transaction`
  • `yum history redo last`
  • `package-cleanup –problems`
  • `package-cleanup –dupes`
  • `rpm -Va –nofiles –nodigest`

While some of these commands provided clues, none actually fixed the issue.

Here’s the series of commands that helped me get back up and running:

sudo yum check all                # tells you of any problems
sudo package-cleanup --problems   # lists all known package problems
sudo package-cleanup --dupes      # lists duplicate packages
sudo package-cleanup --cleandupes # actually cleans up duplicates
sudo yum check all                # run again to check for remaining problems
sudo yum-complete-transaction --cleanup-only

The final `yum-complete-transaction` command should be run only after `yum check all` returns completely clean and with no errors, as it removes orphaned yum transaction entries that were abandoned after `yum update` crashed.

In my case, even the above wasn’t enough: the final `yum check all` reported a remaining issue with a duplicate package (audit-libs), which had to be removed manually via `rpm`, including a flag to skip and problematic pre- or post-install scripts:

sudo rpm -e --noscripts audit-libs-2.3.1-2.fc19.i686

After that, one more `yum check all` came back clean, and I could resume pulling down system updates.

5 thoughts on “yum update fail

  1. Thanks, after seeing this problem on a crashed FC20 yum update (battery died on laptop), this was the only clean method to recover. Its interesting that most folks know of yum, yum-complete-transaction but few, fortunately you, know when to use package-cleanup

  2. II appreciate this post! Just installed Fedora this morning and was trying to give someone a status update on the updates I was doing, was going to copy the 400/1500 counter for them, hit Ctrl+C instead of Ctrl+Shift+C. Was a silly mistake. But I needed this! Thanks!

  3. Pingback: Server fails to boot with lvm error : “Invalid argument for –available: ay Error during parsing of command line.” – SvennD

Leave a comment