#3021 Issue open: libsystemd-shared-252.so not found

Labels: support / question

LiamFry opened issue at 2023-06-27 07:33:

Backup (rear -v mkbackup) reports that a necessary file is missing. I don't understand ...

  • ReaR version: Relax-and-Recover 2.7 / Git
  • OS version: Debian GNU/Linux 12 (bookworm)
  • ReaR configuration files: (attached)
  • System architecture: x86_64
  • Storage layout: (attached)
  • Description of the issue:
    I am not sure if this is a rear issue yet I cannot find any useful information elsewhere. (I've tried!) During backup, I get the following message ...
Testing that the recovery system in /var/tmp/rear.PvzABq2iZtXbVTm/rootfs contains a usable system
/usr/lib/x86_64-linux-gnu/systemd/libsystemd-core-252.so requires additional libraries
        libsystemd-shared-252.so => not found
ReaR recovery system in '/var/tmp/rear.PvzABq2iZtXbVTm/rootfs' needs additional libraries, check /var/log/rear/rear-clara.log for details

dpkg --get-selections | grep libsystemd-shared shows that it's installed.
dpkg -L libsystemd-shared gives me the following ...

/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/systemd
/usr/lib/x86_64-linux-gnu/systemd/libsystemd-core-252.so
/usr/lib/x86_64-linux-gnu/systemd/libsystemd-shared-252.so
/usr/share
/usr/share/doc
/usr/share/doc/libsystemd-shared
/usr/share/doc/libsystemd-shared/NEWS.Debian.gz
/usr/share/doc/libsystemd-shared/changelog.Debian.gz
/usr/share/doc/libsystemd-shared/copyright
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/libsystemd-shared

All that said, a quick find / -name libsystemd-shared-252.so -ls reports this:

22458549 3252 -rw-r--r-- 1 root root 3327624 Feb 28 06:15 /usr/lib/x86_64-linux-gnu/systemd/libsystemd-shared-252.so

local.conf.txt
storage-layout.txt

jsmeix commented at 2023-06-27 09:06:

I am not a Debian user
so I cannot reproduce Debian specific issues.

In general when things are missing in the ReaR recovery system
you could manually add what is needed via something like

LIBS+=( /usr/lib/x86_64-linux-gnu/systemd/libsystemd-shared-252.so )

or

LIBS+=( /usr/lib/x86_64-linux-gnu/systemd/*.so* )

in your etc/rear/local.conf file.

See the descriptions about LIBS and COPY_AS_IS
in usr/share/rear/conf/default.conf

pcahyna commented at 2023-06-27 09:14:

I see a similar message on Fedora 37:

Testing that the recovery system in /tmp/rear.OBGH5kwM9RvJv5S/rootfs contains a usable system
There are binaries or libraries in the ReaR recovery system that need additional libraries
/usr/lib/systemd/libsystemd-core-251.14-2.fc37.so requires additional libraries
libsystemd-shared-251.14-2.fc37.so => not found

Weird.

LiamFry commented at 2023-06-27 10:28:

A quick run of ldd /usr/lib/x86_64-linux-gnu/systemd/libsystemd-core-252.so did report that libsystemd-shared-252.so was missing. This is damned odd.
I took my question to the Debian forums. I'll post here what I discover.

pcahyna commented at 2023-06-27 10:54:

Similar on Fedora 37:

# ldd /usr/lib/systemd/libsystemd-core-251.14-2.fc37.so 
        linux-vdso.so.1 (0x00007ffefb5d6000)
        libsystemd-shared-251.14-2.fc37.so => not found

libsystemd-shared-251.14-2.fc37.so is actually in /usr/lib/systemd .

jsmeix commented at 2023-06-27 10:56:

I guess that the RequiredSharedObjects function in ReaR
does not get called for libsystemd-core-252.so
so libsystemd-shared-252.so is not automatically
included into the ReaR recovery system.

RequiredSharedObjects is called in
build/GNU/Linux/390_copy_binaries_libraries.sh
for all existing programs in PROGS and REQUIRED_PROGS
and for all libraries in LIBS via

local all_libs=( "${LIBS[@]}" $( RequiredSharedObjects "${all_binaries[@]}" "${LIBS[@]}" ) )

and RequiredSharedObjects is called in
build/GNU/Linux/100_copy_as_is.sh
for all executable files in COPY_AS_IS via

for required_library in $( RequiredSharedObjects "${copy_as_is_executables[@]}" ) ; do

So when libsystemd-core-252.so is not specified in LIBS
but gets included into the recovery system via COPY_AS_IS
and when libsystemd-core-252.so is not an executable file
then RequiredSharedObjects is not called for libsystemd-core-252.so
so libsystemd-shared-252.so gets not automatically included
and when libsystemd-shared-252.so is not explicitly
specified to be included into the recovery system
then libsystemd-shared-252.so is missing in the recovery system.

jsmeix commented at 2023-06-27 10:58:

@pcahyna
Ah!
It seems the library configuration on the original system
(i.e. things like ldconfig and so on)
could be incomplete when ldd does not find it.

jsmeix commented at 2023-06-27 11:06:

FYI:

On my current openSUSE Leap 15.4 system
I have systemd-249.16 which contains only
/usr/lib/systemd/libsystemd-shared-249.so
and I noticed no issues with that in ReaR.

After "rear -D mkrescue" I get:

# find /var/tmp/rear.Dw2DUk0fyAfXiN6/rootfs | grep libsystemd

/var/tmp/rear.Dw2DUk0fyAfXiN6/rootfs/usr/lib64/libsystemd.so.0
/var/tmp/rear.Dw2DUk0fyAfXiN6/rootfs/usr/lib64/libsystemd.so.0.32.0
/var/tmp/rear.Dw2DUk0fyAfXiN6/rootfs/usr/lib/systemd/libsystemd-shared-249.so

and my var/log/rear/rear-HOSTNAME.log contains

+ source /root/rear.github.master/usr/share/rear/build/GNU/Linux/100_copy_as_is.sh
...
++ Log 'Adding required libraries of executables in all the copied files to LIBS'
...
2023-06-27 13:23:44.707937689 Adding required library '/usr/lib/systemd/libsystemd-shared-249.so' to LIBS
...
2023-06-27 13:23:45.113024540 Adding required library '/usr/lib64/libsystemd.so.0' to LIBS
.
.
.
+ source /root/rear.github.master/usr/share/rear/build/GNU/Linux/390_copy_binaries_libraries.sh
...
2023-06-27 13:23:53.056375594 Libraries being copied: ... /usr/lib/systemd/libsystemd-shared-249.so ... /usr/lib64/libsystemd.so.0 ...

As far as I see in particular in
usr/share/rear/prep/GNU/Linux/280_include_systemd.sh
and in usr/share/rear/conf/GNU/Linux.conf
it seems that
libsystemd-shared-249.so and libsystemd.so.0
are not specified in LIBS
but get included into the recovery system
via executables in COPY_AS_IS or
via programs in PROGS and REQUIRED_PROGS
which should normally be the preferred way
according to my reasoning in
https://github.com/rear/rear/issues/2743

LiamFry commented at 2023-06-28 08:53:

I found this post that offered some "solutions." Even though the question was asked for Ubuntu, I found it helpful for Debian.

TL;DR

One-off solution:
sudo bash -c "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/systemd/libsystemd-shared-252.so" rear -v mkbackup
(untested)
... OR ...
create an file in /etc/ld.so.conf.d
(This is the method I chose.)

I created /etc/ld.so.conf.d/libsystemd-core.conf
... into which I put /usr/lib/x86_64-linux-gnu/systemd
I then ran sudo ldconf

A run of ldd /usr/lib/x86_64-linux-gnu/systemd/libsystemd-core-252.so now resolves libsystemd-shared-252.so

I rebooted for good measure and ran a straight rear -v mkbackup -- it ran flawlessly.

I suppose why libsystemd-core-252.so has this issue is a question for the distro and subsystem teams.


[Export of Github issue for rear/rear.]