'rpm: /lib64/liblzma.so.5: version `XZ_5.1.2alpha' not found (required by /lib/librpmio.so.3)

I am stuck with this error. Not able to install any RPMs. Please help

OS is RHEL6.9 64 bit

Thanks in advance.



Solution 1:[1]

This happens when you download and install xz from sources on a RHEL (or CentOS) 7 system. The problem is that the XZ_5.1.2alpha label is not present in the released versions of xz, but it is present in the version RedHat ships and compiles against.

A small patch to the xz sources will fix the problem:

https://github.com/easybuilders/easybuild-easyconfigs/issues/4036

The patch is small enough to copy&paste here. I have used it on xz-5.2.4 successfully.

--- src/liblzma/liblzma.map.orig    2015-09-29 12:57:36.000000000 +0200
+++ src/liblzma/liblzma.map 2017-02-22 11:10:33.432868185 +0100
@@ -95,7 +95,13 @@
    lzma_vli_size;
 };
 
-XZ_5.2 {
+XZ_5.1.2alpha {
+global:
+   lzma_stream_encoder_mt;
+   lzma_stream_encoder_mt_memusage;
+} XZ_5.0;
+
+XZ_5.2.2 {
 global:
    lzma_block_uncomp_encode;
    lzma_cputhreads;
@@ -105,4 +111,4 @@
 
 local:
    *;
-} XZ_5.0;
+} XZ_5.1.2alpha;

(update)

If you try to use this .so on CentOS 8, you will get unresolved symbols for XZ_5.2 (e.g. librpmio.so.8 wants lzma_stream_encoder_mt@XZ_5.2).

Here is a revised patch to create an liblzma.so.5 library that will work on both CentOS 7 and 8:

diff -u -r xz-5.2.5/src/liblzma/common/stream_encoder_mt.c xz-5.2.5-rhel7/src/liblzma/common/stream_encoder_mt.c
--- xz-5.2.5/src/liblzma/common/stream_encoder_mt.c 2020-03-17 07:28:50.000000000 -0700
+++ xz-5.2.5-rhel7/src/liblzma/common/stream_encoder_mt.c   2021-12-06 16:18:14.976457229 -0800
@@ -1141,3 +1141,9 @@
 
    return total_memusage + outq_memusage;
 }
+
+/* http://peeterjoot.com/2019/09/20/an-example-of-linux-glibc-symbol-versioning/ */
+__asm__(".symver lzma_stream_encoder_mt,lzma_stream_encoder_mt@XZ_5.1.2alpha");
+__asm__(".symver lzma_stream_encoder_mt,lzma_stream_encoder_mt@@XZ_5.2");
+__asm__(".symver lzma_stream_encoder_mt_memusage,lzma_stream_encoder_mt_memusage@XZ_5.1.2alpha");
+__asm__(".symver lzma_stream_encoder_mt_memusage,lzma_stream_encoder_mt_memusage@@XZ_5.2");
diff -u -r xz-5.2.5/src/liblzma/liblzma.map xz-5.2.5-rhel7/src/liblzma/liblzma.map
--- xz-5.2.5/src/liblzma/liblzma.map    2020-03-17 07:28:54.000000000 -0700
+++ xz-5.2.5-rhel7/src/liblzma/liblzma.map  2021-12-06 15:48:05.650672828 -0800
@@ -95,6 +95,12 @@
    lzma_vli_size;
 };
 
+XZ_5.1.2alpha {
+global:
+   lzma_stream_encoder_mt;
+   lzma_stream_encoder_mt_memusage;
+} XZ_5.0;
+
 XZ_5.2 {
 global:
    lzma_block_uncomp_encode;
@@ -105,4 +111,4 @@
 
 local:
    *;
-} XZ_5.0;
+} XZ_5.1.2alpha;

Solution 2:[2]

I was stuck with similar problem since Nov 27, 2017 when I installed XZ Utils 5.2.3 from sources on CentOS 7.4 and copied liblzma.so.5.2.3 from /usr/local/lib/ to /lib64/.

Cause of this problem is library librpmio.so.3 which requires symbol XZ_5.1.2alpha to be defined in lzma shared library. liblzma.so.5.2.2 defines this symbol but liblzma.so.5.2.3 doesn't.

Without XZ update the most recent version of lzma library was 5.2.2 and I had symbolic link /lib64/liblzma.so.5 -> /lib64/liblzma.so.5.2.2. After copying liblzma.so.5.2.3 and some further updates the link was changed to the most recent file i.e. /lib64/liblzma.so.5 -> /lib64/liblzma.so.5.2.3. And that broke rpm and yum commands. So, solution is:

  1. Link /lib64/liblzma.so.5 back to /lib64/liblzma.so.5.2.2:

    cd /lib64
    sudo ln -s -f liblzma.so.5.2.2 liblzma.so.5
    
  2. Delete file /lib64/liblzma.so.5.2.3

Second possible cause might be environment variable LD_LIBRARY_PATH. Check if it contains unwanted paths and clear it.

Solution 3:[3]

In my case: mark as comments the lines that contain an export to the variable "LD_LIBRARY_PATH", in /etc/bashr and ~/.bashrc

Solution 4:[4]

Just remove liblzma.so.5.2.3 and yum will work again. It broke because of source psxevars.sh in https://software.intel.com/en-us/cluster-checker-user-guide-getting-started.

Solution 5:[5]

Halo team.

Am also experiencing the same problem when launching nautilus. Am in centos 8 that comes with xz 5.2.4

nautilus: /lib64/liblzma.so.5: version `XZ_5.2.2' not found (required by /lib/libarchive.so.13)

nautilus: /lib64/liblzma.so.5: version `XZ_5.1.2alpha' not found (required by /lib/libarchive.so.13)

Downloaded xz-5.2.5.tar.gz and applied patch by Nemo. I compiled it into /usr/local/lib and did a sim link. ln -s /usr/local/lib/liblzma.so.5.2.5 /usr/lib64/liblzma.so.5 That sorts out nautilus but breaks the system. dnf and almost every thing else breaks.

# dnf list installed kernel
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 571, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: /lib64/liblzma.so.5: version `XZ_5.2' not found (required by /lib64/librpmio.so.8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/dnf", line 57, in <module>
    from dnf.cli import main
  File "/usr/lib/python3.6/site-packages/dnf/__init__.py", line 30, in <module>
    import dnf.base
  File "/usr/lib/python3.6/site-packages/dnf/base.py", line 29, in <module>
    import libdnf.transaction
  File "/usr/lib64/python3.6/site-packages/libdnf/__init__.py", line 8, in <module>
    from . import error
  File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 17, in <module>
    _error = swig_import_helper()
  File "/usr/lib64/python3.6/site-packages/libdnf/error.py", line 16, in swig_import_helper
    return importlib.import_module('_error')
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_error'

When i do ldconfig it returns the sim link to point back to 5.2.4.

To survive i have to loop that procedure for the time being on every log on. That is create a sim link launch nautilus then do ldconfig. But if ther be a permanent solution kindly share. centos8 needs that XZ_5.2 not XZ_5.2.2

Here is my patched xz-5.2.5/src/libzma.map


XZ_5.0 {
global:
    lzma_alone_decoder;
    lzma_alone_encoder;
    lzma_auto_decoder;
    lzma_block_buffer_bound;
    lzma_block_buffer_decode;
    lzma_block_buffer_encode;
    lzma_block_compressed_size;
    lzma_block_decoder;
    lzma_block_encoder;
    lzma_block_header_decode;
    lzma_block_header_encode;
    lzma_block_header_size;
    lzma_block_total_size;
    lzma_block_unpadded_size;
    lzma_check_is_supported;
    lzma_check_size;
    lzma_code;
    lzma_crc32;
    lzma_crc64;
    lzma_easy_buffer_encode;
    lzma_easy_decoder_memusage;
    lzma_easy_encoder;
    lzma_easy_encoder_memusage;
    lzma_end;
    lzma_filter_decoder_is_supported;
    lzma_filter_encoder_is_supported;
    lzma_filter_flags_decode;
    lzma_filter_flags_encode;
    lzma_filter_flags_size;
    lzma_filters_copy;
    lzma_filters_update;
    lzma_get_check;
    lzma_index_append;
    lzma_index_block_count;
    lzma_index_buffer_decode;
    lzma_index_buffer_encode;
    lzma_index_cat;
    lzma_index_checks;
    lzma_index_decoder;
    lzma_index_dup;
    lzma_index_encoder;
    lzma_index_end;
    lzma_index_file_size;
    lzma_index_hash_append;
    lzma_index_hash_decode;
    lzma_index_hash_end;
    lzma_index_hash_init;
    lzma_index_hash_size;
    lzma_index_init;
    lzma_index_iter_init;
    lzma_index_iter_locate;
    lzma_index_iter_next;
    lzma_index_iter_rewind;
    lzma_index_memusage;
    lzma_index_memused;
    lzma_index_size;
    lzma_index_stream_count;
    lzma_index_stream_flags;
    lzma_index_stream_padding;
    lzma_index_stream_size;
    lzma_index_total_size;
    lzma_index_uncompressed_size;
    lzma_lzma_preset;
    lzma_memlimit_get;
    lzma_memlimit_set;
    lzma_memusage;
    lzma_mf_is_supported;
    lzma_mode_is_supported;
    lzma_physmem;
    lzma_properties_decode;
    lzma_properties_encode;
    lzma_properties_size;
    lzma_raw_buffer_decode;
    lzma_raw_buffer_encode;
    lzma_raw_decoder;
    lzma_raw_decoder_memusage;
    lzma_raw_encoder;
    lzma_raw_encoder_memusage;
    lzma_stream_buffer_bound;
    lzma_stream_buffer_decode;
    lzma_stream_buffer_encode;
    lzma_stream_decoder;
    lzma_stream_encoder;
    lzma_stream_flags_compare;
    lzma_stream_footer_decode;
    lzma_stream_footer_encode;
    lzma_stream_header_decode;
    lzma_stream_header_encode;
    lzma_version_number;
    lzma_version_string;
    lzma_vli_decode;
    lzma_vli_encode;
    lzma_vli_size;
};

XZ_5.1.2alpha {
global:
   lzma_stream_encoder_mt;
   lzma_stream_encoder_mt_memusage;
} XZ_5.0;

XZ_5.2.2 {
global:
    lzma_block_uncomp_encode;
    lzma_cputhreads;
    lzma_get_progress;
    lzma_stream_encoder_mt;
    lzma_stream_encoder_mt_memusage;

local:
    *;
} XZ_5.1.2alpha;

How do i ammend XZ_5.2 in this file or in any other src file within 5.2.5 src tree?

Solution 6:[6]

Simply removing the newest liblzma.so.%.% (in my case 5.2.5)from the lib folder worked for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 ForumsReg
Solution 3 Victor Villacorta
Solution 4 Daniel Robinson
Solution 5 UruGN
Solution 6 user19028144