Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The created static file does not work on another Linux system #86

Closed
nick-dimitrov opened this issue May 6, 2019 · 6 comments
Closed
Labels
nss Issues related to GLIBC NSS

Comments

@nick-dimitrov
Copy link

nick-dimitrov commented May 6, 2019

Hello,
Created static file "mplayer" on Linux Mint 18.3.Here it works correctly.
Log file:
Mint_18_DEBUG _mplayer.txt

In execution on Ubuntu 18.04 generates the following error:
Log file:
mplayer_ubuntu_18.txt

My info:

nick18@nick18 ~ $ cat /etc/*release*
DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=18.3
DISTRIB_CODENAME=sylvia
DISTRIB_DESCRIPTION="Linux Mint 18.3 Sylvia"
NAME="Linux Mint"
VERSION="18.3 (Sylvia)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 18.3"
VERSION_ID="18.3"
VERSION_CODENAME=sylvia
UBUNTU_CODENAME=xenial

nick18@nick18 ~ $ staticx --version
staticx 0.7.0

nick18@nick18 ~ $ python --version
Python 2.7.12

nick18@nick18 ~ $ python3 --version
Python 3.5.2

nick18@nick18 ~ $ pip --version
/home/nick18/.local/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
pip 19.0.3 from /home/nick18/.local/lib/python2.7/site-packages/pip (python 2.7)

nick18@nick18 ~ $ pip3 --version
pip 19.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)

nick18@nick18 ~ $pyinstaller --version
3.4

I did a few attempts by creating symbolic links. For example, /usr/lib/x86_64-linux-gnu/samba/libsecrets3.so.0
Adding Symlink libsecrets3.so => libsecrets3.so.0
I was not successful.
Could the reason be in missing DT_NEEDED tags as described in the comment,(line 106) in the elf.py file.
Where am I wrong? Can I bypass the problem? Thanks!

@JonathonReinhart
Copy link
Owner

Hi Nick, could you possibly post the output binary you built so I can have a look?

From my initial look, there's nothing you did wrong, and there's nothing you can do (outside of modifying staticx) to resolve it.

It looks like this might be an ELF symbol versioning issue:

...
/tmp/staticx-KOmjFj/.staticx.prog: /usr/lib/x86_64-linux-gnu/samba/libsamba3-util.so.0: version `SAMBA_4.3.11_UBUNTU' not found (required by /tmp/staticx-KOmjFj/libsmbregistry.so.0)
/tmp/staticx-KOmjFj/.staticx.prog: /tmp/staticx-KOmjFj/libndr.so.0: version `NDR_0.0.6' not found (required by /usr/lib/x86_64-linux-gnu/samba/libsecrets3.so.0)
...

Perhaps ld.so doesn't like something about the way I'm using RPATH to point to the bundled libraries.

@nick-dimitrov
Copy link
Author

nick-dimitrov commented May 8, 2019

Hi Jonathon,I apply the two mplayer files,static and debug.txt:
https://drive.google.com/open?id=1AohQFaGQP3J4DQkw-CLMZ-VZs9dvyRWM

./mplayer1 -vo help
./mplayer1 -vo gl 5.mkv
./mplayer1 -vo x11 5.mkv
./mplayer1 -vo xv 5.mkv
./mplayer1 -vo sdl 5.mkv

This file(mplayer1 ) was created on Linux Mint 18.3 Xfce.

nick18@nick18 ~ $ ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu9) 2.23

I run the file on another hard drive with Linux Mint 19.1 Xfce installed.

nick@nick:~$ ldd --version
ldd (Ubuntu GLIBC 2.27-3ubuntu1) 2.27

Here I also notice this:

/tmp/staticx-LKfFhk/.staticx.prog: /tmp/staticx-LKfFhk/libc.so.6: version `GLIBC_2.25' not found (required by /lib/x86_64-linux-gnu/libsystemd.so.0)
/tmp/staticx-LKfFhk/.staticx.prog: /tmp/staticx-LKfFhk/libc.so.6: version `GLIBC_2.27' not found (required by /lib/x86_64-linux-gnu/libsystemd.so.0)

===============
Here's another test example on Kubuntu 16.04,KDE environment and Qt platform plugin:
kde-cli-tools,kgamma5,kcmshell5

sudo apt install kde-cli-tools kgamma5

next:

staticx --loglevel DEBUG --no-compress -l /usr/lib/x86_64-linux-gnu/qt5/plugins/kcm_kgamma.so -l /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so /usr/bin/kcmshell5 /home/nickkde/kcmshell1

I run the static file on Linux Mint 19.1 Xfce,but I encounter the following problem:

./kcmshell1 kgamma
This application failed to start because it could not find or load the Qt platform plugin "xcb"
Reinstalling the application may fix this problem.

I apply the two files,static and debug.txt:
https://drive.google.com/open?id=1r39j8uOmDf18INP9OH3Iay6Q_RL2S6S1

@JonathonReinhart
Copy link
Owner

Hi @nick-dimitrov.

I think your issue was caused by GLIBC NSS (see issue #129). This is evidenced by the fact that you're seeing errors related to libsystemd.so and other Samba libraries. I suspect the /etc/nsswitch.conf on your "other" Linux system had something like this:

passwd:         files systemd winbind

Version v0.11.0 was just released which contains #139, a major fix for NSS. With this version, you shouldn't run into this type of issue any more.

I'm reasonably confident it will fix the problem you were seeing, so I'm going to close this issue.

Please try it out and report back! If it doesn't fix you issue, I'll be happy to re-open this. Thanks for the interest in my project.

@JonathonReinhart JonathonReinhart added nss Issues related to GLIBC NSS and removed needs investigation Issues that require further investigation before action labels Jul 28, 2020
@mammo0
Copy link

mammo0 commented Oct 15, 2020

Hello,

On my repo (https://github.com/mammo0/NordVPN-NetworkManager-Gui) I've encountered a similar error:

My goal is to build a Python application with Pyinstaller and afterwards make it portable with staticx. Everything works fine on my local machine. But then I tried to automate the build process with GitHub actions. Their runners run by default on Ubuntu 18.04.

Here is the build log of:

Pyinstaller

42 INFO: PyInstaller: 4.0
42 INFO: Python: 3.6.11
295 INFO: Platform: Linux-5.4.0-1026-azure-x86_64-with-debian-buster-sid
451 INFO: UPX is available.
454 INFO: Extending PYTHONPATH with paths
['/home/runner/work/NordVPN-NetworkManager-Gui/NordVPN-NetworkManager-Gui',
 '/home/runner/work/NordVPN-NetworkManager-Gui/NordVPN-NetworkManager-Gui']
462 INFO: checking Analysis
462 INFO: Building Analysis because Analysis-00.toc is non existent
462 INFO: Initializing module dependency graph...
463 INFO: Caching module graph hooks...
469 INFO: Analyzing base_library.zip ...
3513 INFO: Caching module dependency graph...
3590 INFO: running Analysis Analysis-00.toc
3615 INFO: Analyzing /home/runner/work/NordVPN-NetworkManager-Gui/NordVPN-NetworkManager-Gui/nord_nm_gui.py
3756 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-urllib3.packages.six.moves.py'.
4874 INFO: Processing pre-safe import module hook six.moves from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-six.moves.py'.
6285 INFO: Processing module hooks...
6286 INFO: Loading module hook 'hook-certifi.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
6288 INFO: Loading module hook 'hook-cryptography.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
6464 INFO: Loading module hook 'hook-PyQt5.QtGui.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks'...
6572 INFO: Loading module hook 'hook-PyQt5.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks'...
6609 WARNING: Hidden import "sip" not found!
6610 INFO: Loading module hook 'hook-importlib_metadata.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks'...
6611 INFO: Loading module hook 'hook-xml.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks'...
6658 INFO: Loading module hook 'hook-encodings.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks'...
6720 INFO: Loading module hook 'hook-keyring.backends.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks'...
6877 INFO: Loading module hook 'hook-PyQt5.QtWidgets.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks'...
6941 INFO: Loading module hook 'hook-PyQt5.QtCore.py' from '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks'...
6988 INFO: Looking for ctypes DLLs
6991 INFO: Analyzing run-time hooks ...
6996 INFO: Including run-time hook '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/hooks/rthooks/pyi_rth_pyqt5.py'
6998 INFO: Including run-time hook '/home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/_pyinstaller_hooks_contrib/hooks/rthooks/pyi_rth_certifi.py'
7006 INFO: Looking for dynamic libraries
8975 INFO: Looking for eggs
8975 INFO: Using Python library /home/runner/.pyenv/versions/3.6.11/lib/libpython3.6m.so.1.0
8981 INFO: Warnings written to /home/runner/work/NordVPN-NetworkManager-Gui/NordVPN-NetworkManager-Gui/build/nord_nm_gui/warn-nord_nm_gui.txt
9020 INFO: Graph cross-reference written to /home/runner/work/NordVPN-NetworkManager-Gui/NordVPN-NetworkManager-Gui/build/nord_nm_gui/xref-nord_nm_gui.html
9038 INFO: Appending 'datas' from .spec
9043 INFO: checking PYZ
9043 INFO: Building PYZ because PYZ-00.toc is non existent
9043 INFO: Building PYZ (ZlibArchive) /home/runner/work/NordVPN-NetworkManager-Gui/NordVPN-NetworkManager-Gui/build/nord_nm_gui/PYZ-00.pyz
9622 INFO: Building PYZ (ZlibArchive) /home/runner/work/NordVPN-NetworkManager-Gui/NordVPN-NetworkManager-Gui/build/nord_nm_gui/PYZ-00.pyz completed successfully.
9633 INFO: checking PKG
9634 INFO: Building PKG because PKG-00.toc is non existent
9634 INFO: Building PKG (CArchive) PKG-00.pkg
55590 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
55598 INFO: Bootloader /home/runner/.local/share/virtualenvs/NordVPN-NetworkManager-Gui-CPZTWrAn/lib/python3.6/site-packages/PyInstaller/bootloader/Linux-64bit/run_d
55598 INFO: checking EXE
55598 INFO: Building EXE because EXE-00.toc is non existent
55598 INFO: Building EXE from EXE-00.toc
55599 INFO: Appending archive to ELF section in EXE /home/runner/work/NordVPN-NetworkManager-Gui/NordVPN-NetworkManager-Gui/dist/nord_nm_gui
56167 INFO: Building EXE from EXE-00.toc completed successfully.

and staticx: https://pastebin.com/tUF1dLFz

If I try to execute the built binary on my local PC (Arch Linux), I get the following error message:

$ ./nord_nm_gui                                                              
[22372] PyInstaller Bootloader 3.x
[22372] LOADER: executable is /tmp/staticx-GnhEjH/nord_nm_gui
[22372] LOADER: homepath is /tmp/staticx-GnhEjH
[22372] LOADER: _MEIPASS2 is NULL
[22372] LOADER: archivename is /tmp/staticx-GnhEjH/nord_nm_gui
[22372] LOADER: Extracting binaries
[22372] LOADER: Executing self as child
[22372] LOADER: set _MEIPASS2 to /tmp/_MEItCkP03
[22372] LOADER: LD_LIBRARY_PATH=/tmp/_MEItCkP03
[22372] LOADER: Registering signal handlers
[22373] PyInstaller Bootloader 3.x
[22373] LOADER: executable is /tmp/staticx-GnhEjH/nord_nm_gui
[22373] LOADER: homepath is /tmp/staticx-GnhEjH
[22373] LOADER: _MEIPASS2 is /tmp/_MEItCkP03
[22373] LOADER: archivename is /tmp/staticx-GnhEjH/nord_nm_gui
[22373] LOADER: Already in the child - running user's code.
[22373] LOADER: Python library: /tmp/_MEItCkP03/libpython3.6m.so.1.0
[22373] Error loading Python lib '/tmp/_MEItCkP03/libpython3.6m.so.1.0': dlopen: /tmp/staticx-GnhEjH/libc.so.6: version `GLIBC_2.32' not found (required by /usr/lib/libpthread.so.0)
[22372] LOADER: Restoring signal handlers
[22372] LOADER: freeing args
[22372] LOADER: returning child exit status 255
[22372] LOADER: Back to parent (RC: 255)
[22372] LOADER: Doing cleanup
[22372] LOADER: Freeing archive status for /tmp/staticx-GnhEjH/nord_nm_gui

My local PC uses the libc version 2.32. The build system uses 2.27.

Edit: Forgot to mention that I used latest Pyinstaller (4.0) and staticx (0.12.0) version.

@JonathonReinhart
Copy link
Owner

Hi @mammo0. Please open a new issue, rather than piling on to an existing issue. Reference this one if you believe it to be related.

Also, please add --debug to your staticx invocation, and include the output of your resulting program when run on the target machine (this will included staticx debug bootloader output).

Thanks.

@mammo0
Copy link

mammo0 commented Oct 15, 2020

Thanks for your response, @JonathonReinhart!

As you wanted I opened another issue #159 that includes the debug output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nss Issues related to GLIBC NSS
Projects
None yet
Development

No branches or pull requests

3 participants