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_PATH environment 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

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.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket