termux / termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.
https://f-droid.org/en/packages/com.termux
Other
35.57k stars 3.73k forks source link

[Bug]: latest curl (libcurl?) breaks Termux #4179

Closed vbooka1 closed 5 days ago

vbooka1 commented 2 weeks ago

Problem description

all repositories return "bad" after pkg install curl

Steps to reproduce the behavior.

1) reinstall Termux or open Termux settings and clear storage and cache 2) run pkg anything, like pkg upgrade or pkg install mc - it will check all repositories, most of them will return "ok", and if you've tried to install anything it will install correctly 3) run pkg install curl, it will install correctly 4) run pkg anything, like pkg upgrade or pkg install any-other-package-different-from-the-2nd-step - it will check all repositories, return "bad" for ALL of them, and say "Error: None of the mirrors are accessible" in the end. 5) open Termux settings, clear storage and cache, do NOT install curl, run pkg install any-other-package-except-curl and it will work correctly again

What is the expected behavior?

installation of curl should not break Termux

System information

vbooka1 commented 2 weeks ago

bundled version works well:

~ $ curl -V
curl 8.8.0 (aarch64-unknown-linux-android) libcurl/8.8.0 OpenSSL/3.2.1 zlib/1.3.1 libssh2/1.11.0 nghttp2/1.62.1 nghttp3/1.3.0
Release-Date: 2024-05-22
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HSTS HTTP2 HTTP3 HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe UnixSockets

upgraded version fails with the following error:

~ $ curl -V
CANNOT LINK EXECUTABLE "curl": cannot locate symbol "SSL_set_value_uint" referenced by "/data/data/com.termux/files/usr/lib/libcurl.so"...
TomJo2000 commented 2 weeks ago

Could you please attach the output of termux-info?

It looks like you are probably running an out of date version of openssl.

Biswa96 commented 2 weeks ago

I can not reproduce the issue in my phone.

$ curl -V
curl 8.10.1 (aarch64-unknown-linux-android) libcurl/8.10.1 OpenSSL/3.3.2 zlib/1.3.1 libssh2/1.11.0 nghttp2/1.63.0 nghttp3/1.5.0
Release-Date: 2024-09-18
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HSTS HTTP2 HTTP3 HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe UnixSockets

$ openssl -v
OpenSSL 3.3.2 3 Sep 2024 (Library: OpenSSL 3.3.2 3 Sep 2024)
MuhammedSabbagh commented 2 weeks ago

adding to this issue, i just installed termux fresh and did pkg install curl and resulted in the same outcome, all mirrors return bad

...
...

[*] (1) https://termux.cdn.lumito.net/termux-main: bad
[*] (1) https://nl.mirror.flokinet.net/termux/termux-main: bad
[*] (1) https://ftp.fau.de/termux/termux-main: bad
[*] (1) https://termux.librehat.com/apt/termux-main: bad
[*] (1) https://mirror.autkin.net/termux/termux-main: bad
[*] (1) https://mirror.polido.pt/termux/termux-main: bad
[*] (1) https://dl.kcubeterm.com/termux-main: bad
[*] (1) https://termux.danyael.xyz/termux/termux-main: bad
[*] (1) https://mirror.mwt.me/termux/main: bad
[*] (1) https://mirrors.utermux.dev/termux/termux-main: bad
[*] (1) https://mirror.vern.cc/termux/termux-main: bad
[*] (1) https://plug-mirror.rcac.purdue.edu/termux/termux-main: bad
[*] (1) https://mirror.quantum5.ca/termux/termux-main: bad
[*] (1) https://mirror.fcix.net/termux/termux-main: bad
[*] (1) https://mirror.csclub.uwaterloo.ca/termux/termux-main: bad
[*] (1) https://mirror.endianness.com/termux/termux-main: bad
[*] (1) https://mirrors.rda.run/termux/termux-main: bad
[*] (1) https://repository.su/termux/termux-main/: bad
[*] (1) http://mirror.mephi.ru/termux/termux-main: bad
Error: None of the mirrors are accessible

EDI #1: opening curl showed this message, which likely seems like curl is the fault here:

curl

CANNOT LINK EXECUTABLE "curl": cannot locate symbol "SSL_set_value_uint" referenced by "/data/data/com.termux/files/usr/lib/libcurl.so"...

EDIT #2: Another Update, probably definitive: the problem occured because curl was probably updated when libcurl wasn't this is what caused the bug to happen, remedy is likely (and i'm not sure if it works) is to go to a termux repo and download libcurl and install it to hopefully recover the system's pkg manager, or simply clear data and start from zero (DATA WILL BE DESTROIED UPON CLEAR DATA, DO BACKUP!)

SOLUTION: use whatever tool you have to download libcurl from here https://plug-mirror.rcac.purdue.edu/termux/termux-main/pool/main/libc/libcurl/ and move it to termux's home and 'dpkg -i' it

RECOMMENDATION: not sure how curl and libcurl function but can't it be hard dependency? such problems happend when people did pkg install curl, although it's already installed on the base system

sylirre commented 5 days ago

Partial system upgrade is simple user mistake when working with rolling release distributions. It is not unique to Termux, on Arch Linux it is quite easy to run into similar condition too.

Reason why this happens is because user installs the latest package version while keeping old dependencies.

You can avoid running into this by upgrading first before installing something else:

pkg upgrade
pkg install curl

However you don't have to install curl. It is already part of Termux base environment.

For those who curious why Termux maintainers do not hardcode version constraints in packages: this will cause incompatibility between mirrors (they all have different synchronization schedules) and troubles with version management on device. Dependency version constraints are hardcoded in exceptional cases only. Termux follows practices commonly used in major distributions.

SOLUTION: use whatever tool you have to download libcurl from here

RECOMMENDATION: not sure how curl and libcurl function but can't it be hard dependency? such problems happend when people did pkg install curl, although it's already installed on the base system

curl already defines version constraint for libcurl dependency:

1

If you will look apt log, you will see that both curl and libcurl are pulled:

2

The culprit is openssl which remains to be older than expected by libcurl. But as I stated previously, we will not hardcode version constraints everywhere.

Particularly this case can be solved by apt update && apt full-upgrade, as apt depends neither on libcurl nor on openssl.

Reminding once more: partial upgrades are not supported! Do not follow package management practices from Debian or Ubuntu where user can almost never do apt upgrade. Termux is a rolling release environment where backwards compatibility between packages is not preserved.

XZiar commented 4 days ago

I can reproduce the issue on my side. I freshly installed the termux, upgrade openssl to latest(), everything is fine. Then when I upgrade curl(and libcurl), pkg upgrade compalins about no mirrors available.

I noticed that c-ares get installed when upgrading curl, maybe that's causing the error?

here's full log:

~ $ pkg upgrade
No mirror or mirror group selected. You might want to select one by running 'termux-change-repo'
Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main/: ok
Get:1 https://packages-cf.termux.dev/apt/termux-main stable InRelease [14.0 kB]
Get:2 https://packages-cf.termux.dev/apt/termux-main stable/main aarch64 Packages [520 kB]
Fetched 534 kB in 1s (385 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  curl libcurl openssl
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
~ $ apt-mark unhold openssl
Canceled hold on openssl.
~ $ pkg upgrade
No mirror or mirror group selected. You might want to select one by running 'termux-change-repo'
Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main/: ok
Hit:1 https://packages-cf.termux.dev/apt/termux-main stable InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  curl libcurl
The following packages will be upgraded:
  openssl
1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
Need to get 2315 kB of archives.
After this operation, 1278 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://packages-cf.termux.dev/apt/termux-main stable/main aarch64 openssl aarch64 1:3.3.2 [2315 kB]
Fetched 2315 kB in 0s (5690 kB/s)
(Reading database ... 4469 files and directories currently installed.)
Preparing to unpack .../openssl_1%3a3.3.2_aarch64.deb ...
Unpacking openssl (1:3.3.2) over (3.0.2) ...
Setting up openssl (1:3.3.2) ...

Configuration file '/data/data/com.termux/files/usr/etc/tls/openssl.cnf'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** openssl.cnf (Y/I/N/O/D/Z) [default=N] ? y
Installing new version of config file /data/data/com.termux/files/usr/etc/tls/openssl.cnf ...
~ $ pkg upgrade
No mirror or mirror group selected. You might want to select one by running 'termux-change-repo'
Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main/: ok
Hit:1 https://packages-cf.termux.dev/apt/termux-main stable InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  curl libcurl
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
~ $ apt-mark unhold libcurl
Canceled hold on libcurl.
~ $ pkg upgrade
No mirror or mirror group selected. You might want to select one by running 'termux-change-repo'
Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main/: ok
Hit:1 https://packages-cf.termux.dev/apt/termux-main stable InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  curl libcurl
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
~ $ apt-mark unhold curl
Canceled hold on curl.
~ $ pkg upgrade
No mirror or mirror group selected. You might want to select one by running 'termux-change-repo'
Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main/: ok
Hit:1 https://packages-cf.termux.dev/apt/termux-main stable InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  c-ares
The following packages will be upgraded:
  curl libcurl
2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1308 kB of archives.
After this operation, 1569 kB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
~ $ apt list --upgradable
Listing... Done
curl/stable 8.10.1-1 aarch64 [upgradable from: 7.83.0]
libcurl/stable 8.10.1-1 aarch64 [upgradable from: 7.83.0]
~ $ pkg upgrade
No mirror or mirror group selected. You might want to select one by running 'termux-change-repo'
Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main/: ok
Hit:1 https://packages-cf.termux.dev/apt/termux-main stable InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  c-ares
The following packages will be upgraded:
  curl libcurl
2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1308 kB of archives.
After this operation, 1569 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 https://packages-cf.termux.dev/apt/termux-main stable/main aarch64 c-ares aarch64 1.34.1 [191 kB]
Get:2 https://packages-cf.termux.dev/apt/termux-main stable/main aarch64 libcurl aarch64 8.10.1-1 [906 kB]
Get:3 https://packages-cf.termux.dev/apt/termux-main stable/main aarch64 curl aarch64 8.10.1-1 [212 kB]
Fetched 1308 kB in 0s (2949 kB/s)
Selecting previously unselected package c-ares.
(Reading database ... 4476 files and directories currently installed.)
Preparing to unpack .../c-ares_1.34.1_aarch64.deb ...
Unpacking c-ares (1.34.1) ...
Setting up c-ares (1.34.1) ...
(Reading database ... 4644 files and directories currently installed.)
Preparing to unpack .../libcurl_8.10.1-1_aarch64.deb ...
Unpacking libcurl (8.10.1-1) over (7.83.0) ...
Setting up libcurl (8.10.1-1) ...
(Reading database ... 4673 files and directories currently installed.)
Preparing to unpack .../curl_8.10.1-1_aarch64.deb ...
Unpacking curl (8.10.1-1) over (7.83.0) ...
Setting up curl (8.10.1-1) ...
~ $ pkg upgrade
No mirror or mirror group selected. You might want to select one by running 'termux-change-repo'
Checking availability of current mirror:
[*] https://packages-cf.termux.dev/apt/termux-main/: bad
Testing the available mirrors:
[*] (10) https://packages-cf.termux.dev/apt/termux-main: bad
[*] (1) https://mirror.twds.com.tw/termux/termux-main: bad
[*] (1) https://mirrors.in.sahilister.net/termux/termux-main/: bad
[*] (1) https://mirrors.cbrx.io/apt/termux/termux-main: bad
[*] (1) https://mirror.albony.in/termux/termux-main: bad
[*] (1) https://mirrors.nguyenhoang.cloud/termux/termux-main: bad
[*] (1) https://mirror.bardia.tech/termux/termux-main: bad
[*] (1) https://mirror.textcord.xyz/termux/termux-main: bad
[*] (1) https://termux.niranjan.co/termux-main: bad
[*] (1) https://mirrors.omsinchan.ac.th/termux/termux-main/: bad
[*] (1) https://mirrors.saswata.cc/termux/termux-main: bad
[*] (1) https://tmx.xvx.my.id/apt/termux-main: bad
[*] (1) https://mirror.nevacloud.com/applications/termux/termux-main: bad
[*] (1) https://mirror.freedif.org/termux/termux-main: bad
[*] (1) https://linux.domainesia.com/applications/termux/termux-main: bad
[*] (1) https://mirrors.ravidwivedi.in/termux/termux-main: bad
[*] (1) https://mirror.nyist.edu.cn/termux/apt/termux-main: bad
[*] (1) https://mirrors.ustc.edu.cn/termux/termux-main: bad
[*] (1) https://mirrors.qvq.net.cn/termux/termux-main: bad
[*] (1) https://mirrors.hust.edu.cn/termux/apt/termux-main: bad
[*] (1) https://mirrors.zju.edu.cn/termux/apt/termux-main: bad
[*] (1) https://mirror.sjtu.edu.cn/termux/termux-main/: bad
[*] (1) https://mirrors.bfsu.edu.cn/termux/apt/termux-main: bad
[*] (1) https://mirrors.tuna.tsinghua.edu.cn/termux/apt/termux-main: bad
[*] (1) https://mirrors.pku.edu.cn/termux/termux-main/: bad
[*] (1) https://mirrors.nju.edu.cn/termux/apt/termux-main: bad
[*] (1) https://mirrors.aliyun.com/termux/termux-main: bad
[*] (1) https://mirrors.sdu.edu.cn/termux/termux-main: bad
[*] (1) https://mirrors.sustech.edu.cn/termux/apt/termux-main: bad
[*] (1) https://mirrors.sau.edu.cn/termux/apt/termux-main: bad
[*] (1) https://mirrors.cqupt.edu.cn/termux/termux-main: bad
[*] (1) https://mirror.iscas.ac.cn/termux/apt/termux-main: bad
[*] (1) https://mirror.mwt.me/termux/main: bad
[*] (1) https://termux.3san.dev/termux/termux-main: bad
[*] (1) https://mirrors.medzik.dev/termux/termux-main: bad
[*] (1) https://termux.librehat.com/apt/termux-main: bad
[*] (1) https://termux.cdn.lumito.net/termux-main: bad
[*] (1) https://mirror.polido.pt/termux/termux-main: bad
[*] (1) https://packages.termux.dev/apt/termux-main: bad
[*] (1) https://ftp.agdsn.de/termux/termux-main: bad
[*] (1) https://ro.mirror.flokinet.net/termux/termux-main: bad
[*] (1) https://mirror.accum.se/mirror/termux.dev/termux-main: bad
[*] (1) https://mirrors.de.sahilister.net/termux/termux-main: bad
[*] (1) https://mirror.termux.dev/termux-main: bad
[*] (1) https://nl.mirror.flokinet.net/termux/termux-main: bad
[*] (1) https://mirror.leitecastro.com/termux/termux-main: bad
[*] (1) https://termux.mentality.rip/termux-main: bad
[*] (1) https://is.mirror.flokinet.net/termux/termux-main: bad
[*] (1) https://mirrors.cfe.re/termux/termux-main: bad
[*] (1) https://md.mirrors.hacktegic.com/termux/termux-main: bad
[*] (1) https://ftp.fau.de/termux/termux-main: bad
[*] (1) https://mirror.sunred.org/termux/termux-main: bad
[*] (1) https://mirror.autkin.net/termux/termux-main: bad
[*] (1) https://mirror.bouwhuis.network/termux/termux-main: bad
[*] (4) https://grimler.se/termux/termux-main: bad
[*] (1) https://mirror.quantum5.ca/termux/termux-main: bad
[*] (1) https://mirror.mwt.me/termux/main: bad
[*] (1) https://dl.kcubeterm.com/termux-main: bad
[*] (1) https://mirrors.utermux.dev/termux/termux-main: bad
[*] (1) https://gnlug.org/pub/termux/termux-main: bad
[*] (1) https://plug-mirror.rcac.purdue.edu/termux/termux-main: bad
[*] (1) https://mirror.fcix.net/termux/termux-main: bad
[*] (1) https://mirror.vern.cc/termux/termux-main: bad
[*] (1) https://mirror.csclub.uwaterloo.ca/termux/termux-main: bad
[*] (1) https://termux.danyael.xyz/termux/termux-main: bad
[*] (1) https://mirrors.middlendian.com/termux/termux-main: bad
[*] (1) http://mirror.mephi.ru/termux/termux-main: bad
[*] (1) https://repository.su/termux/termux-main/: bad
Error: None of the mirrors are accessible
~ $ termux-info
Termux Variables:
TERMUX_API_APP__VERSION_NAME=0.50.1+8651fd9
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP__AM_SOCKET_SERVER_ENABLED=true
TERMUX_APP__APK_PATH=/data/app/~~TGunNfz3H-oWMG_ivofnhA==/com.termux-9jhi67E1BIFJGzJBngXFJg==/base.apk
TERMUX_APP__APK_RELEASE=GITHUB
TERMUX_APP__FILES_DIR=/data/user/0/com.termux/files
TERMUX_APP__IS_DEBUGGABLE_BUILD=true
TERMUX_APP__IS_INSTALLED_ON_EXTERNAL_STORAGE=false
TERMUX_APP__PACKAGE_MANAGER=apt
TERMUX_APP__PACKAGE_NAME=com.termux
TERMUX_APP__PACKAGE_VARIANT=apt-android-7
TERMUX_APP__PID=27435
TERMUX_APP__SE_FILE_CONTEXT=u:object_r:app_data_file:s0:c23,c257,c512,c768
TERMUX_APP__SE_INFO=default:targetSdkVersion=28:complete
TERMUX_APP__SE_PROCESS_CONTEXT=u:r:untrusted_app_27:s0:c23,c257,c512,c768
TERMUX_APP__TARGET_SDK=28
TERMUX_APP__UID=10279
TERMUX_APP__USER_ID=0
TERMUX_APP__VERSION_CODE=118
TERMUX_APP__VERSION_NAME=0.118.0+e59e5c1
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0+e59e5c1
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main/ stable main
Updatable packages:
All packages up to date
termux-tools version:
1.43.6
Android version:
13
Kernel build information:
Linux localhost 4.19.191+ #1 SMP PREEMPT Wed Feb 28 12:34:37 CST 2024 aarch64 Android
Device manufacturer:
realme
Device model:
RMX3031
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.x11 versionCode:15
com.termux.gui versionCode:7
com.termux.api versionCode:51
com.termux.boot versionCode:1000
~ $
XZiar commented 4 days ago

Noticed that there's already an issue in package repo: https://github.com/termux/termux-packages/issues/21727

sylirre commented 4 days ago

@XZiar This ticket (#7179) is about CANNOT LINK EXECUTABLE "curl": cannot locate symbol "SSL_set_value_uint" referenced by "/data/data/com.termux/files/usr/lib/libcurl.so"... after running pkg install curl.

https://github.com/termux/termux-packages/issues/21727 is a different issue