termux-pacman / pacman-for-termux

Special configured pacman for termux.
https://termux-pacman.dev
MIT License
72 stars 6 forks source link

After installing gpgme pacman stopped working. #25

Closed TadaCZE closed 1 week ago

TadaCZE commented 1 week ago

Describe the bug I was originally trying to install inkscape which failed to launch with the error: CANNOT LINK EXECUTABLE "inkscape": cannot locate symbol "gpgme_op_setownertrust" referenced by "/data/data/com.termux/files/usr/lib/libgpgmepp.so".... I thought that the packagers probably goofed up and forgot to include gpgme as dependency of Inkscape, so I decided to install it.

After installing the gpgme package in Termux, the following error started to be printed when executing inkscape and pacman: CANNOT LINK EXECUTABLE "pacman": cannot locate symbol "assuan_new_ext" referenced by "/data/data/com.termux/files/usr/lib/libgpgme.so".... I cannot uninstall gpgme, because pacman is broken, so I'm kind of asking for help here (preferrably one that doesn't involve nuking my whole Termux install).

To Reproduce Steps to reproduce the behavior:

  1. Install the gpgme package
  2. Execute any pacman command

Expected behavior After installing the gpgme package, pacman and Inkscape should not break.

Screenshots Screenshot_20241110-122918_Termux

Smartphone (please complete the following information):

Additional context Phone is rooted with aPatch

Maxython commented 1 week ago

First, run the following command and post the result of this command:

termux-info

If you have migrated to pacman-based bootstrap (i.e. you have pacman as your primary package manager in Termux), then run the following command and post the pkgsinfo.txt file with the result:

tail -n +1 ${PREFIX}/var/lib/pacman/local/{pacman,gpgme,inkscape}-*/desc > pkgsinfo.txt

Also, please send the last executed pacman commands that are described in your commit.

TadaCZE commented 1 week ago

termux-info also somehow depends on GPG, so also prints errors, but does give the following output:

CANNOT LINK EXECUTABLE "pacman-conf": cannot locate symbol "assuan_new_ext" referenced by "/data/data/com.termux/files/usr/lib/libgpgme.so"...
CANNOT LINK EXECUTABLE "pacman-conf": cannot locate symbol "assuan_new_ext" referenced by "/data/data/com.termux/files/usr/lib/libgpgme.so"...
CANNOT LINK EXECUTABLE "pacman": cannot locate symbol "assuan_new_ext" referenced by "/data/data/com.termux/files/usr/lib/libgpgme.so"...
Termux Variables:
TERMUX_APP_PACKAGE_MANAGER=pacman
TERMUX_APP__APK_FILE=/data/app/~~X7ZwfpdkMER2h8HY1vYZwg==/com.termux-cX50bLBL6i26M_mfCK9E-w==/base.apk
TERMUX_APP__APK_RELEASE=F_DROID
TERMUX_APP__APP_VERSION_CODE=1020
TERMUX_APP__APP_VERSION_NAME=0.119.0-beta.1
TERMUX_APP__DATA_DIR=/data/user/0/com.termux
TERMUX_APP__IS_DEBUGGABLE_BUILD=false
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PID=22704
TERMUX_APP__TARGET_SDK=28
TERMUX_VERSION=0.119.0-beta.1
TERMUX__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c214,c256,c512,c768
TERMUX__SE_INFO=default:targetSdkVersion=28:complete
TERMUX__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c214,c256,c512,c768
TERMUX__UID=10214
TERMUX__USER_ID=0
Packages CPU architecture:

Subscribed repositories:
# /data/data/com.termux/files/usr/etc/pacman.conf
Updatable packages:
All packages up to date
termux-tools version:
1.44.1
Android version:
14
Kernel build information:
Linux localhost 5.4.280-qgki-g004cf7a2803b #1 SMP PREEMPT Tue Oct 1 09:21:40 UTC 2024 aarch64 Android
Device manufacturer:
Fairphone
Device model:
FP5
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.styling versionCode:1000
com.termux.api versionCode:51

This is the pkgsinfo.txt, that is the result of running your command.

I don't exactly know what you mean by "the last executed pacman commands that are described in your commit", but I'm assuming you want me to include the commands that I've executed that've led up to this, so:

  1. I installed inkscape: pacman -S inkscape.
  2. I tried to install something that looked like maybe a dependency: pacman -S libgpg-error-glibc-static. This was probably unnecessary and stupid, I know, but I started typing libgpg and tab-completed which yielded nothing good.
  3. I tried to run inkscape once again: inkscape --export-type="png" Firefox_logo,_2019.svg.
  4. I finally found that gpgme package didn't actually start with the lib prefix: pacman -S gpgme.
  5. Then I looked back at the error and noticed it said libgpgmepp.so and remembered seeing the gpgmepp package, so decided to install it also for good measure (probably should've done that in the first place) using: pacman -S gpgmepp. This is when I found out that pacman was broken as it thrown out the linking error instead of executing.
  6. At this point I tried a few debugging steps unsuccessfully, like renaming the libgpgme.so file to something else, since I couldn't for obvious reasons uninstall gpgme, but otherwise this is the point I'm at right now.
TadaCZE commented 1 week ago

I am beginning to suspect that for some reason my system was in a broken state before all of this happened, since gpgme was a dependency of pacman, the pacman -S gpgme command should've just returned an error saying that it was already installed. But looking through my command history, I can't find any command that I've run that could've caused this.

Also, I dont't know if this is helpful or not, but I've looked at the beginning of fish history (which includes bash history) and pasted the commands that I've run to initially bootstrap termux:

wget
pkg i wget
mkdir usr-n
cd usr-n
wget https://github.com/termux-pacman/termux-packages/releases/download/bootstrap-2024.09.15-r1%2Bpacman-android-7/bootstrap-aarch64.zip
unzip bootstrap-aarch64.zip
rm bootstrap-aarch64.zip
pacman-key --init
pacman-key --populate
pacman -Sy
pkg install wget
pacman -S fish
chsh
Maxython commented 1 week ago

Ok, thanks for the information. I still have trouble understanding why libgpgme.so breaks your packages, so I'll ask you to do the following: 1) Post the file pacman.log, this is the file that stores all log messages from pacman. It is located at the following path:

/data/data/com.termux/files/usr/var/log/pacman.log

2) Check the libgpgme.so file by running the following command (then post the result):

ls -l /data/data/com.termux/files/usr/lib/libgpgme.so
file /data/data/com.termux/files/usr/lib/libgpgme.so
TadaCZE commented 1 week ago

Don't worry about it, I know how difficult it's to debug this sort of problem.

Anyways, pacman.log and:

-rwx------. 1 u0_a214 u0_a214 289000 Nov 10 12:15 /data/data/com.termux/files/usr/lib/libgpgme.so
/data/data/com.termux/files/usr/lib/libgpgme.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, stripped

I shouls note that I later tried deleting the file and replacing it with one from an extracted package from the termux-pacman repos. This shouldn't be relevant, since it had no effect, but the dates from pacman logs and ls might not match up.

Also I could just send you the whole termux file system if you want that? It's not like I have anything private there (except for SSH keys, I would need to remove that), mostly just used it as a way to have root shell access to other apps and to mess around with commands. Maybe you could post your public GPG key and I could give it to you encrypted?

Maxython commented 1 week ago

Also I could just send you the whole termux file system if you want that?

No need. I have an idea what's broken. According to your log from pacman.log, you rarely upgraded packages, but often updated the databases and then installed packages. This use of the package manager is called "partial upgrades" and it is not supported in Termux, since Termux tries to provide packages of the latest version. Here is some additional information to better understand what "partial upgrades" are - https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported

I suspect that you don't have an updated libassuan package, so check what version you have installed with this command:

grep -A 1 %VERSION% $PREFIX/var/lib/pacman/local/libassuan-*/desc

You should have version 3.0.1-2 installed (as of November 11, 2024). If you have a different version, try replacing the libassuan.so file with another one from the libassuan-3.0.1-2-aarch64.pkg.tar.xz package.

TadaCZE commented 1 week ago

Yup, you were right.

Thanks a lot for the help, really appreciate it!

TadaCZE commented 1 week ago

Although this issue is fixed, a few things bug me.

Shouldn't gpgme have already been installed and shouldn't it be a dependency of Inkscape?

Maxython commented 1 week ago

Shouldn't gpgme have already been installed and shouldn't it be a dependency of Inkscape?

The problem is not in the inkscape or gpgme packages, but in the fact that you did not update the packages and at the same time installed packages with the current version. Before your system crashed, you already had gpgme installed, but with an outdated (i.e. old) version. Because of this, the installed packages, with the current version, may break, since they are configured (compiled) to work with packages that have the current version. Simply put, you just needed to update the packages before installing the inkscape package, for example like this:

pacman -Syu
pacman -S inkscape