Updated: 16 November 2026 · Applies to: CloudLinux OS, AlmaLinux, Rocky Linux and RHEL 8 to 10 (library checks tested on AlmaLinux 9.8 with zlib 1.2.11 and libxml2 2.9.13)
When yum, dnf, clnreg_ks (CloudLinux registration) or cldeploy (the CloudLinux conversion script) all fail with Segmentation fault, the usual cause is a hand-compiled copy of a system library, most often libz or libxml2, in /usr/local/lib. The tools load that copy instead of the one from the OS packages and crash. Find the copy, move it out of the way, run ldconfig, and the tools work again.
If only yum crashes, the shorter steps in yum does not work, returns Segmentation fault are enough. This article shows how to prove which library is loaded, which matters when several tools fail at once.
Why a library in /usr/local/lib gets picked up
On AlmaLinux 9, /usr/local/lib is not searched by default: /etc/ld.so.conf only includes /etc/ld.so.conf.d/*.conf, and that folder was empty in our test. A copy there is only used when something adds the folder, usually:
- a file in
/etc/ld.so.conf.d/that lists/usr/local/lib, added by a source install, or - the
LD_LIBRARY_PATHenvironment variable, set in a shell profile or a script.
1. See which copy is loaded
Ask the dynamic linker which libz the system library libxml2 uses:
ldd /usr/lib64/libxml2.so.2 | grep libz
A healthy system shows the OS copy in /lib64:
libz.so.1 => /lib64/libz.so.1 (0x00007f6394474000)
In our test, after a copy was placed in /usr/local/lib and that folder was added to the linker path, the same command showed:
libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f40746d1000)
List every copy the linker knows about, in the order it prefers them:
ldconfig -p | grep 'libz\.so'
Output in the test, with the local copy listed first:
libz.so.1 (libc6,x86-64) => /usr/local/lib/libz.so.1 libz.so.1 (libc6,x86-64) => /lib64/libz.so.1
2. Find what adds /usr/local/lib
grep -rl /usr/local/lib /etc/ld.so.conf /etc/ld.so.conf.d/
echo "$LD_LIBRARY_PATH"
The first command names the config file that adds the folder (in the test, /etc/ld.so.conf.d/local.conf). The second should print an empty line; if it shows /usr/local/lib, find where it is set in /root/.bashrc, /root/.bash_profile or /etc/profile.d/.
3. Move the copies out of the way
See what is there:
ls -l /usr/local/lib/ | grep -E 'libz|libxml2'
Move them to a backup folder rather than deleting them, in case software you compiled still needs them:
mkdir -p /root/usr-local-lib-backup mv /usr/local/lib/libz* /usr/local/lib/libxml2* /root/usr-local-lib-backup/
Rebuild the linker cache:
ldconfig
Run the ldd check from step 1 again. It should point to /lib64 once more. Then retry the tool that crashed.
4. Make sure the OS copies are intact
Check that the packaged libraries have not been overwritten:
rpm -V zlib libxml2
No output means the files match the packages. If it lists changed files, reinstall the packages with dnf reinstall zlib libxml2 (on CloudLinux 7, yum reinstall).
If the crash continues
- Check the kernel log for the crashing program and library:
dmesg | grep -i segfault. The library name in that line tells you which file to look at next. - Look for other hand-built copies of common libraries (OpenSSL, libcurl, PCRE) in
/usr/local/liband/usr/local/lib64, and check them the same way withldd. - If
cldeployfails for another reason during a conversion, see CloudLinux Conversion: the retry_no_cache yum Error and Converting With cldeploy. For licence registration withclnreg_ks, see How to Check and Update a CloudLinux License Key.
Software that you compiled yourself and that needs its own library versions is better built with its own install prefix, so it does not change what the system tools load. If you would like our engineers to clean this up on your server, see server management.