How to fix “Error: xz compression not available” in CentOS and cPanel & WHM upgrade
Bobcares.com provides outsourced hosting support to web hosting companies. As part of our work, we help web hosting companies keep their servers upgraded and patched to the latest version.
In some cPanel/WHM and CentOS servers, we’ve faced the error Error: xz compression not available when performing a distribution upgrade.
What causes Error: xz compression not available?
All RedHat compatible servers such as CentOS, RHEL and Fedora use a compression algorithm called LZMA/LZMA2 to build their RPM packages. So, the package manager YUM uses a compression utility called xz to unpack the files.
XZ compression utility is provided by Extra Packages for Enterprise Linux (EPEL) repository of CentOS.
In some servers, we’ve seen the wrong version of EPEL is configured in YUM config files. This causes an incompatible version of xz utility to be used, and it results in this error.
[ You don’t have to lose your sleep to keep your customers happy. Our friendly Hosting Support Specialists are online 24/7/365 to help your customers. ]
How to fix the broken upgrade process
When faced with this issue, we generally follow this process. However, it could be different from one server to another.
1. Remove EPEL packages
First the incompatible package needs to be removed by:
# yum remove epel-release
2. Clear the Yum cache
Remove all cached epel files from Yum
# rm -rf /var/cache/yum/XXX/XXX/epel
Replace the XXX with your architecture and CentOS version.
3. Re-install EPEL package
Then enable CentOS Extras (in case it’s disabled), and freshly install EPEL repo.
# yum --enablerepo=extras install epel-release
You can check if it worked by listing the repositories using:
# yum repolist
4. Re-run the server upgrade or upcp (in cPanel)
Then re-start the upgrade process, and all should go well.
In case something is still going wrong, we’ll be happy to sort it out for you. Click here to talk to our server experts.