Live yum upgrading from Fedora 15 to Fedora 16

Posted: November 11th, 2011 | Filed under: Fedora | Tags: , , , , , | 5 Comments »

With Fedora 16 out, I have to perform upgrades on my Fedora machines, two laptops, one mac mini and five servers. Officially the only supported way to upgrade Fedora is to use the regular Anaconda installer, or use pre-upgrade. In the years I’ve been using Fedora (since Fedora Core 5), I have never used Anaconda for upgrades because I rarely have direct access to the machine to boot CDs/DVDs, and whenever I have tried pre-upgrade it always fails. This time it failed on one server because /boot was on software-RAID, and failed on the other two servers because /boot was too small. So instead I’ve always ended up doing live upgrades using yum directly. The first few times I did this, there were some surprises, but in the end I’ve settled into a recipe that has a high success rate.

I’m NOT encouraging people follow my approach, but if you have ended up in a situation where a live yum upgrade is your only option, these notes might help you avoid some pitfalls.

  • Tip 1: Only attempt to upgrade 1 release at a time, don’t try to skip over releases. This reduces the chances of problems with yum calculating a suitable upgrade path
  • Tip 2: Avoid having any 3rd party repositories configured with yum, unless you know they already support both the current and target distro release. In practice this means you want to avoid anything except official Fedora, RPM Fusion and Livna repositories.

The actual upgrade process I follow is this:

  • Step 1: Ensure the current install is fully updated.
    # yum -y update
  • Step 2: Remove any orphaned packages, ie locally installed packages which are not present in any of your active YUM repositories. Orphaned packages are the most common cause for unresolvable RPM dependencies during upgrade. If you choose to skip this step be aware that you will almost certainly need to revisit it, if yum fails to resolve an upgrade path.
    # package-cleanup --orphans
    # rpm -e ...for each orphan you want to remove...
  • Step 3: Purge all YUM cached data about current repos. This just frees up space by removing cached data files that won’t be needed anymore
    # yum clean all
  • Step 4: Install the fedora-release, fedora-release-rawhide and fedora-release-notes RPMs for the new release.
    # wget
    # wget
    # wget
    # rpm -Uvh fedora-release*16*.rpm
  • Step 5: Perform the actual upgrade.
     # yum update

Sometimes even after removing all orphan packages and 3rd party packages, the last step will still fail with unresolvable dependencies. This might be the case if an RPM was purged from latest Fedora and thus not having an upgrade path. When this happens, it is usually sufficient to just remove the obsolete package and retry the upgrade.

One significant change between Fedora 15 and 16 that is important for the upgrade process, is the switch from Grub1 to Grub2. While the live YUM upgrade will result in grub2 getting installed, it does not update your bootsector. So there are two post-upgrade tasks that must be done before reboot.

  • Generate the master grub2 config file
    # grub2-mkconfig > /etc/grub2.cfg
  • Install grub2 into the boot sector
    # grub2-install /dev/sda

    As mentioned earlier, on one of the machines I had software RAID configured, so I wanted grub2 installed on both disks

    # grub2-install /dev/sda
    # grub2-install /dev/sdb

After rebooting into the new kernel, I once again run ‘package-cleanup –orphans’ to ensure find any obsolete packages which can be killed off.

That’s all there was to it. Where I have followed these instructions I have a 100% success rate in live yum upgrades. The only upgrade which failed was the one where I forgot to generate the grub2 config file before rebooting :-)

5 Responses to “Live yum upgrading from Fedora 15 to Fedora 16”

  1. Tom Hughes says:

    I also do this all the time, having found that preupgrade rarely works and even when it does takes the machine down for just as long as using the DVD to upgrade. I have a few improvements though.

    Firstly you can use “yum –releasever=16” now instead of having to manually update fedora-release etc.

    Secondly, using “yum distro-sync” is better than “yum update” as it avoids problems where you have a package installed that is newer than the one in the new releaset, something that can happen if an update has been pushed recently and hasn’t made it to the new release yet.

  2. For me it almost worked, missing things that didn’t detected:

    systemctl enable sshd.service
    systemctl enable nfs-server.service
    systemctl enable httpd.service

    (I think I forgot someone here).

    Added to the grub2-install: I used to have grub on my boot partition, not on the root disk (several installations on same machine). Installing grub2 on a partition gives you really scary errors.

    And some fun with iptables that I am trying to fix yet.

    For the rest, it looks like it is working (TM).

    Later, Juan.

  3. Mat says:

    # grub2-mkconfig > /etc/grub/grub2.cfg

    Shouldn’t it be

    # grub2-mkconfig > /etc/grub2.cfg

  4. Dan: I update all my *headless* Fedora machines and virtualization hosts using pre-upgrade, and it worked pretty well.

    Though from the comments, in all cases it’s not so smooth to preupgrade *Full-X* installs.
    (The above post is mostly a trimmed version of what worked for me from Fedora yum url Mathieu pointed above)

Leave a Reply

Spam protection: Sum of s1x plus t3n ?: