Matlab 2022b installer is unable to start on an OpenRC (non-Systemd Linux) system
Show older comments
Dear all,
Installer of Matlab 2022b first claimed that it cannot open a window.
Following answers on the Mathworks site and installing a few "missing" libraries (by running
./bin/glnxa64/QMATLABWindow
and installing the next missing one then re-running it) I quickly hit
error while loading shared libraries: libsystemd.so.0: cannot open shared object file: No such file or directory
I am stuck here as on my Gentoo box with OpenRC (rather than Systemd) as the init system I cannot simultaneously install systemd.
I would be greatful for helping me out. Thank you in advance,
Tamas
18 Comments
Erich
on 20 Sep 2022
Does Gentoo provide libelogind.so.0?
Here is a solution for Slackware (also without systemd):
https://www.linuxquestions.org/questions/slackware-14/how-to-fake-libsystemd-so-for-matlab-r2022b-4175716955/
Tamás Kárpáti
on 22 Sep 2022
Erich
on 22 Sep 2022
Hello Tamás,
As it worked for me, I must assume you're missing some other library then. Before I did the symlink trick, it looked like libsystemd.so.0 was the only missing library:
# ldd MATLABWindow | grep "not found"
libsystemd.so.0 => not found
And also I'll not I didn't create the libelogind.so.0 -> libsystemd.so.0 link in /lib64, rather I created the link in /opt/MATLAB/R2022b/bin/glnxa64 so the only affected software is MATLAB. (And also in the installer location so it could work properly.)
Have you tried using "ldd" to see which libraries the installer is looking for?
cd <installer_dir>/bin/glnxa64
ldd MathWorksProductInstaller
ldd MATLABWindow
Furthermore, one can use objdump to find out which specific symbols are required. I'm not going to go through every library, but we can see that one of the libraries MATLAB provides does depend on libsystemd:
objdump -xtT libdbus-1.so.3 | grep -i systemd
NEEDED libsystemd.so.0
required from libsystemd.so.0:
0x0562c8b9 0x00 06 LIBSYSTEMD_209
0000000000000000 DF *UND* 0000000000000000 LIBSYSTEMD_209 sd_is_socket
0000000000000000 DF *UND* 0000000000000000 LIBSYSTEMD_209 sd_listen_fds
Let's see if libelogind.so.0 (at least on my system) provides those symbols:
$ objdump -xtT /lib64/libelogind.so | grep sd_is_socket
00000000000562d0 g DF .text 0000000000000130 LIBSYSTEMD_209 sd_is_socket
00000000000567d0 g DF .text 000000000000016b LIBSYSTEMD_209 sd_is_socket_unix
0000000000056580 g DF .text 0000000000000250 LIBSYSTEMD_233 sd_is_socket_sockaddr
0000000000056400 g DF .text 000000000000017a LIBSYSTEMD_209 sd_is_socket_inet
$ objdump -xtT /lib64/libelogind.so | grep sd_listen_fds
0000000000055ed0 g DF .text 000000000000012a LIBSYSTEMD_227 sd_listen_fds_with_names
0000000000055dc0 g DF .text 000000000000010c LIBSYSTEMD_209 sd_listen_fds
Yep, it does. So no, in this case it's not dangerous to fake libsystemd.so.0 using libelogind.so.0. (To be fair I didn't go through and check every single library.)
Another thing you can try (which I didn't!) is if your system provides the same or newer system libraries (e.g. libdbus-1.so) you might be able to replace the MATLAB-provided system lilbraries with your own system libraries. This way it will drop the libsystemd.so requirement. (Neither MathWorksProductInstaller nor MATLABWindow directly depend on libsystemd.so - it's only the libraries they depend on that depend on libsystemd.so.)
Erich
on 22 Sep 2022
So I was curious and went ahead and checked ALL libraries and execuatables in the installer and the MATLAB installation and it turns out the only library that directly depends on libsystemd.so.0 is libdbus-1.so.3.19.11:
# ./find_systemd_files.sh
********************************************************************************
./bin/glnxa64/libdbus-1.so.3.19.11
NEEDED libsystemd.so.0
required from libsystemd.so.0:
0x0562c8b9 0x00 06 LIBSYSTEMD_209
0000000000000000 DF *UND* 0000000000000000 LIBSYSTEMD_209 sd_is_socket
0000000000000000 DF *UND* 0000000000000000 LIBSYSTEMD_209 sd_listen_fds
And here are my scripts that did the checks:
# cat find_systemd_files.sh
#!/bin/bash
find . -type f -exec ./examine_file.sh {} \;
# cat examine_file.sh
#!/bin/bash
if ! file "$1" | grep -q "ELF 64-bit LSB shared object\|ELF 64-bit LSB executable" ; then
exit
fi
if objdump -xtT "$1" 2>/dev/null | grep -q -i libsystemd ; then
echo "****************************************************************************
****"
echo "$1"
objdump -xtT "$1" | grep -i libsystemd
fi
The question I cannot answer is if the functionality that libsystemd.so.0 provides (and libelogind.so.0 also provides those same needed symbols) to libdbus-1.so is in turn required by MATLAB. Those two functions (sd_is_socket and sd_listen_fds) that libdbus-1.so requires are provided by libelogind.so.0, as I've already mentioned, so actually it doesn't matter if they are required or not. Faking libsystemd.so.0 using libelogind.so.0 is not only not dangerous, it is the correct solution.
Tamás Kárpáti
on 22 Sep 2022
Erich
on 22 Sep 2022
Interesting. Here is Slackware's libdbus-1.so for additional information:
# ldd /usr/lib64/libdbus-1.so.3.19.13
linux-vdso.so.1 (0x00007ffde2985000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fe24c102000)
libelogind.so.0 => /lib64/libelogind.so.0 (0x00007fe24c058000)
libc.so.6 => /lib64/libc.so.6 (0x00007fe24be79000)
/lib64/ld-linux-x86-64.so.2 (0x00007fe24c1db000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007fe24be6c000)
Most (all?) official Slackware packages (it is a binary distrubution unlike Gentoo) are compiled on an already-existing full Slackware installation, which means optional dependencies often get pulled in as long as they're part of a full Slackware installation.
Tamás Kárpáti
on 23 Sep 2022
Erich
on 23 Sep 2022
You can try opening a support ticket, but I doubt you'll get much help. Several years ago I found that there was a requirement on libpam.so (at the time Slackware shipped without PAM).
Here is part of their response:
Thank you for contacting MathWorks. Unfortunately, Slackware is not a qualified distribution for running MATLAB. This means we do not test or verify that the software runs on Slackware, and our ability to troubleshoot and provide support for the platform may be limited.
You may be able to install the PAM library through a third-party package created for Slackware.
Alternatively, any of our qualified Linux distributions are known to run R2017a without issue.
I solved the issue by compiling the PAM libraries and copying libpam.so into my MATLAB installation directory.
Tamás Kárpáti
on 23 Sep 2022
Tamás Kárpáti
on 26 Sep 2022
Joseph Young
on 28 Sep 2022
I just went through this with my system. It appears as though R2022b bundles its own version of libdbus-1.so.3 whereas R2022a uses the system version. The bundled version of libdbus-1.so.3 depends on the system's version of libsystemd.so.0, which is not present on OpenRC based systems. The simplest method to resolve this issue is to preload a working system version of libdbus-1.so.3, which doesn't necessarily require systemd. For example, the following command works on my system:
LD_PRELOAD=/usr/lib64/libdbus-1.so.3 ./bin/glnxa64/MATLABWindow
Running the installer with the same preload worked for me.
Tamás Kárpáti
on 30 Sep 2022
Joseph Young
on 30 Sep 2022
I'm glad to hear that you have a solution that works. Originally, I did the same as you and just fixed the symbolic links and that worked for me as well. I'll also mention that I override libstdc++ the same as you. As far as LD_PRELOAD, in bash, this is a list separated by colons. Therefore, my command line becomes:
LD_PRELOAD=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/libstdc++.so.6:/usr/lib64/libdbus-1.so.3 matlab
This can be added as an alias in .bashrc with something like
alias matlab='LD_PRELOAD=/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/libstdc++.so.6:/usr/lib64/libdbus-1.so.3 matlab'
As one more alternative, the actual executable itself can be patched using patchelf to replace the location of these libraries.
In other words, there are at least three ways to fix the problem: change the symbolic links, LD_PRELOAD, or patchelf. Anyway, it looks like you have something that works. Mostly, I'm trying to relay this information since it looks like this is the only location for such documentation and I don't think we're the only people running into this issue.
Tamás Kárpáti
on 1 Oct 2022
Joseph Young
on 3 Oct 2022
The utility patchelf is a utility for modifying ELF executables, which is the typical executable format under Linux. You can find a man file for it here. Most distributions have a version or at least one that can be installed. Basically, it's one way to modify where an executable looks for its shared libraries. To be clear, if LD_PRELOAD or changing the symbolic links doesn't work, it's not clear to me patchelf will either, but your mileage may vary.
Alternatively, Mathworks could revert to using the system version of libdbus-1.so.3 rather than bundling it, which would fix both of our problems. This is what R2022a appears to do. Though, they may have their own internal reasons for doing so.
Tamás Kárpáti
on 4 Oct 2022
Miles Malone
on 8 Nov 2022
A workaround on openrc or any other init systems where you've got elogind installed is to symlink libelogind.so.0 to libsystemd.so.0 as they both provide the symbols MATLABWindow is looking for. So symlink /lib64/libelogind.so.0 to /path/to/matlabInstallFiles/bin/glnxa64/libsystemd.so.0, and run install as per normal
Tamás Kárpáti
on 16 Nov 2022
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!