CentOS 6 -> 7 In-Place Upgrade

IN-PLACE UPGRADE FOR CENTOS 6 -> 7

Create a Repo file in /etc/yum.repos.d/, named something like upgradetool.repo

Add the following lines to the repo file:


name=CentOS-$releasever - Upgrade Tool
baseurl=http://dev.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

This command will then get the RPMs installed to run an upgrade:

yum install centos-upgrade-tool preupgrade-assistant-contents

At the moment, only a CLI interface and limited functionality is available. Usage is simple. Just follow these steps:

  • Run "preupg -l" command - it lists all available contents for preupgrade-assistant (as the system is based on a plugin, there may be modules from different sources in the future). If nothing is shown, install the preupgrade-assistant-contents package.
  • If you have CentOS6_7 content available, run the command preupg -s CentOS6_7
  • Wait until the analysis finishes (it can take several minutes)
  • Review the report stored as /root/preupgrade/result.html (and possibly files stored at /root/preupgrade). Especially check for inplace upgrade risks (described further in this document)

Every single plugin has its own exit code. Administrators need to check at least those with FAIL results before doing the inplace upgrade. Results marked FIXED should be checked after the inplace upgrade - to finish the CentOS-7 migration properly.

The possible exit codes are:

  • PASS = everything is fine, no incompatibility/issue detected by this checker
  • FAIL = some incompatibility/issue that needs to be reviewed by the admin was detected. FAIL doesn't necessarily mean that the inplace upgrade will fail, but may result in a not 100% functional system
  • FIXED = some incompatibility was detected, but the preupgrade-assistant was able to find an automated solution. Some of the fixes may require running postupgrade.d scripts after the upgrade. Fixed configs are available in /root/preupgrade/cleanconf directory. preupgrade-assistant doesn't handle the fixes automatically at the moment!
  • INFORMATIONAL = nice to have information for admins (e.g. removed options in some common tools which may cause malfunctions of their scripts)
  • NOT_APPLICABLE = package which should be tested but the check is not installed on the system (test therefore doesn't make sense)
  • ERROR = shouldn't occur, does usually mean error in the preupgrade-assistant framework. All such errors should be reported to the Red Hat preupgrade-assistant team.

WHAT DID WE DO TO RESOLVE UPGRADE?

First, we failed to hold back grep, resulting in the following:

[root@daedalus iworx_support_user]# rpm -V grep
Unsatisfied dependencies for grep-2.20-3.el6_7.1.x86_64:
libpcre.so.0()(64bit) is needed by (installed) grep-2.20-3.el6_7.1.x86_64
[root@daedalus iworx_support_user]# yum provides grep
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

Dependencies Resolved

=====================================================================================================================================================================================================================================
Package Arch Version Repository Size

Downgrading:
grep x86_64 2.20-2.el7 base 344 k

Transaction Summary

Downgrade 1 Package

Total download size: 344 k
Is this ok [y/d/N]: y
Downloading packages:
grep-2.20-2.el7.x86_64.rpm | 344 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : grep-2.20-2.el7.x86_64 1/2
Cleanup : grep-2.20-3.el6_7.1.x86_64 2/2
Verifying : grep-2.20-2.el7.x86_64 1/2
Verifying : grep-2.20-3.el6_7.1.x86_64 2/2

Removed:
grep.x86_64 0:2.20-3.el6_7.1

Installed:
grep.x86_64 0:2.20-2.el7

Complete!
[root@daedalus iworx_support_user]# rpm -V grep
[root@daedalus iworx_support_user]# grep
Usage: grep [OPTION]… PATTERN [FILE]…
Try ‘grep --help’ for more information.

HOLDING BACK GREP TO PREVENT OS BREAKAGE

How do I exclude grep “yum update”? (or in this case, centos-upgrade-tool-cli --network 7 --instrepo=CentOS Mirror ? )

Open /etc/yum.conf file, enter:

# nano /etc/yum.conf

Append the following line under [main] section, enter:

exclude=grep*

At the end, it should look like as follows:

[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
exclude=grep*

Note: yum-RHN-plugin doesn’t honor this.

metadata_expire=1h

Default.

installonly_limit = 3

PUT YOUR REPOS HERE OR IN separate files named file.repo

in /etc/yum.repos.d

Save and close the file. You can now use the yum command as usual but certain package will not install.

How Do I Disable Excludes?

You can use the following syntax:


yum --disableexcludes=all update
yum --disableexcludes=main install grep
yum --disableexcludes=repoid install grep

Where,

all : Disable all excludes
main : Disable excludes defined in [main] in yum.conf
repoid : Disable excludes defined for given repo id
yum --exclude Command Line Option

Finally, you can skip yum command updates on command line itself using following syntax:


# yum --exclude=package\* update
# yum --exclude=grep\* update
# yum --exclude=kernel\* update
# yum -x 'kernel*' -x 'php*' update

Note: The above syntax will exclude a specific package by name or glob from updates on all repositories.

FINALLY, LET’S UPGRADE, CAP’N!

Once you are ready to upgrade (you have mitigated all issues you care to mitigate, etc.), you first need to import the CentOS-7 RPM key with this command:

rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

Then run the following command to upgrade:

centos-upgrade-tool-cli --network 7 --instrepo=http://mirror.centos.org/centos/7/os/x86_64/

Then reboot after it’s done.

See man centos-upgrade-tool for more information on all options available for the tool.

NOTE: Use of this tool is at your own risk and is not the best method for upgrades. Make sure you have backups before you actually perform an upgrade. If it breaks, you get to keep both halves!

WHAT HAPPENED AFTER THE UPGRADE, CAPTAIN?!

I installed InterWorx-CP just fine on a brand-new install of CentOS 7. However, the InterWorx-CP did not start successfully for both the upgraded CentOS 6->7 boxen and the brand new install of CentOS 7. I had to run

./iworx-restart.pex

in /home/interworx in order to get InterWorx CP up and running again.

Turns out it’s because of this:

So if the iworx-db database for InterWorx-CP fails, this is most likely the fix that will help resolve your issue, as well. By this point, the box that InterWorx is installed to should start operating normally. We have rebooted the box in question quite a few times since this issue occurred and each time, InterWorx’s came back up nicely for us.