rpm: /lib64/liblzma.so.5: version `XZ_5.1.2alpha' not found (required by /lib/librpmio.so.3)
Solution 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
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:
-
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
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
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
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.
Sachin Aravind
Updated on June 11, 2022Comments
-
Sachin Aravind almost 2 years
I am stuck with this error. Not able to install any RPMs. Please help
OS is RHEL6.9 64 bit
Thanks in advance.
-
gaurav5430 almost 5 yearsnew to RHEL, how do we apply this patch ?
-
Brian Fitzgerald over 3 yearsNote that oracle asmcmd afd commands run rpm -qf /etc/redhat-release, via afddriverstate, via osds_acfslib.pm, and so can be affected by this issue.
-
Brian Fitzgerald over 3 yearspatch liblzma.map with "XZ_5.1.2alpha" fixed asmcmd afd_lsdsk for me.
-
Alexey about 2 yearsAfter applying the patch I get: Error: multiple versions [
lzma_stream_encoder_mt@@XZ_5.2'|
lzma_stream_encoder_mt@XZ_5.1.2alpha'] for symbol `lzma_stream_encoder_mt'. What I'm doing wrong? -
mayeulk about 2 yearsRemoving liblzma.so.5.2.3 worked for me. That was after some install related to R (ORE) on Oracle Linux.