Skip to content

apt: for glibc repos only no bionic repos. no path patches#361

Open
john-peterson wants to merge 1 commit into
termux-pacman:mainfrom
john-peterson:apt
Open

apt: for glibc repos only no bionic repos. no path patches#361
john-peterson wants to merge 1 commit into
termux-pacman:mainfrom
john-peterson:apt

Conversation

@john-peterson

@john-peterson john-peterson commented Nov 7, 2025

Copy link
Copy Markdown

vim:ft=text

update cert packet broken in glibc

after copying code from src/methods/connect.cc it seems the cert packet is broken

g++ tls.cc -lgnutls && a.out
strace a.out |& ack cert

in bionic

openat(AT_FDCWD, "/data/data/com.termux/files/usr/etc/tls/cert.pem", O_RDONLY|O_CLOEXEC) = 3

in glibc

newfstatat(AT_FDCWD, "/data/data/com.termux/files/usr/glibc/etc/ca-certificates/trust-source", 0x7fd68d7008, 0) = -1 ENOENT (No such file or directory)

vim tls.cc
#include
#include
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
using namespace std;
int main() {
int err;
gnutls_certificate_credentials_t credentials;
int r = gnutls_certificate_allocate_credentials(&credentials);
err = gnutls_certificate_set_x509_system_trust(credentials);
cout << "trust: " << err << endl;
return 0;
}

partly resolved but mysterious cert file read error even in proot

this is solved by specifying the cert file in apt.conf and might not interest you further but I had to investigate this . I can't understand why this happens even in proot . I even created a new --proot build in john-peterson/termux-packages@proot to build with blank prefix if that is the error

i can't find this among any bionic patches . I removed all patches and
this is the only problem it seems to stumble on permission of cert file

disable path fix before test

mv -iv $G/etc/apt/apt.conf/{,.bak}

this print nothing

apt-config dump|ack CaInfo

this works

apt -c $G/etc/apt/apt.conf.bak update

apt -o Acquire::https::CaInfo=$G/etc/ssl/certs/ca-certificates.crt update

but strace doesn't pick up the file read

strace apt ... |& ack cert

this fail

apt update
W: http://packages.termux.dev/apt/termux-glibc/dists/glibc/InRelease: No system certificates available. Try installing ca-certificates.

even in proot update fails

G=/data/data/com.termux/files/usr/glibc
proot ... -r $G /bin/bash
apt update
same error

and this fail how is that possible

whoops that was a typo . CaInf missing o. it also works when typed correct

apt -o Acquire::https::CaInf=/etc/ca-certificates/cacert.pem update

maybe some thing with proot or symlink permission locked to 777

ls -l /etc/ca-certificates/cacert.pem
-rw-r--r-- 1 u0_a206 u0_a206 234847 Oct 4 2024 /etc/ca-certificates/cacert.pem

stat /etc/ca-certificates/cacert.pem
Access: (0644/-rw-r--r--) Uid: (10206/ u0_a206) Gid: (10206/ u0_a206)

only for glibc repos

notice don't drag bionic lists into this apt cache . the whole purpose is to have only glibc repos here

if a dependency is missing copy it to glibc from bionic don't add the bionic repo! or manually add it to the status file until the list is updated online

in john-peterson/termux-packages@proot I propose that the -glibc suffix is dropped from all packet names since they should not mix with musl or bionic packets

if anyone still want to mix bionic and glibc packets against all odds . the packet can still be distinguished by the suite name

for bionic

apt install abc/stable

for glibc

apt install abc/glibc

but I don't recommend this to anyone

my view on all this . no more use less non proot or bionic patches from me

I am not fixing anything that works in proot glibc or debian anymore have already done that for years for no purpose

I am even creating a new proot repo to remove all path patches also . this recipe already has all path patches removed

path patches removed

all path patches are removed compared to bionic build . and it works anyway with only prefix build flag . I have included root.conf for potential path fixes if necessary . but I did not need any of them

this build recipe also works with the new --proot build flag and create a pristine build with no prefix or special paths

the proot build also restore the --root flag . in this build --root=abc means abc/prefix . dpkg append prefix to root flag

if dpkg is built with --prefix the work around is this that does not append the prefix

dpkg --root=abc <- broken . is actually abc/prefix

dpkg --admindir=$root/var/lib/dpkg --instdir=$root <- works no prefix inserted
--admindir can be omitted because it's prefix/var/lib/dpkg by default . --instdir is not prefix by default

add --installdir=prefix if glibc suffix removed

if the prefix shell is removed from packets add --installdir=prefix to dpkg wrapper

I have proposed this in john-peterson/termux-packages@proot for simplicity . simpler build logic and packets and dpkg -c output with no prefix in packet files


side note about copying debian packets to termux . that I asked about before

copy Debian packet to termux

the build.sh file is called debian/control debian/rules and they are scattered all over the web . there is no single debian build repo like this that contain all recipes . the Debian build recipes are all over the place impossible to find them in one place

after endless searching I found the Debian build system for R. it's in the same repo as the app. it seems like they expect the app to provide it

https://salsa.debian.org/edd/r-base

ack "Depends" debian/control|head -1
Build-Depends: gcc (>= 4:4.9.2-2), g++ (>= 4:4.9.2-2), gfortran (>= 4:4.9.2-2), libblas-dev, liblapack-dev, tcl8.6-dev, tk8.6-dev, bison, groff-base, libncur...

head -2 debian/rules

dpkg-buildpackage -B

this packet already works with debian proot but I will try to copy the rules file to build.sh as an exercise to learn the debian build system

it will require many new packets that are missing . if they fail to build I have to find the debian/rules for them also in a separate location unless it's in the source folder . if that will help finding the broken build flag

vim:ft=text

  # update cert packet broken in glibc

after copying code from src/methods/connect.cc it seems the cert packet is broken

g++ tls.cc -lgnutls && a.out
strace a.out |& ack cert

in bionic

openat(AT_FDCWD, "/data/data/com.termux/files/usr/etc/tls/cert.pem", O_RDONLY|O_CLOEXEC) = 3

in glibc

newfstatat(AT_FDCWD, "/data/data/com.termux/files/usr/glibc/etc/ca-certificates/trust-source", 0x7fd68d7008, 0) = -1 ENOENT (No such file or directory)

vim tls.cc
  #include <iostream>
  #include <cstddef>
  #include <gnutls/gnutls.h>
  #include <gnutls/x509.h>
using namespace std;
int main() {
	int err;
   gnutls_certificate_credentials_t credentials;
   int r = gnutls_certificate_allocate_credentials(&credentials);
      err = gnutls_certificate_set_x509_system_trust(credentials);
	cout << "trust: " << err << endl;
	return 0;
}

 # partly  resolved but mysterious cert file read error even in proot

 this is solved by specifying the cert file in apt.conf and might not interest you further  but I had to investigate this . I can't understand why this happens even in proot . I even created a new --proot build in john-peterson/termux-packages@proot to build with blank prefix if that is the error

i can't find this among any bionic patches . I removed all patches and
this is the only problem it seems to stumble on permission of cert file

disable path fix before test

mv -iv $G/etc/apt/apt.conf/{,.bak}

this print nothing

apt-config dump|ack CaInfo

this works

apt -c $G/etc/apt/apt.conf.bak update

apt -o Acquire::https::CaInfo=$G/etc/ssl/certs/ca-certificates.crt update

but strace doesn't pick up the file read

strace apt ... |& ack cert

this fail

apt update
W: http://packages.termux.dev/apt/termux-glibc/dists/glibc/InRelease: No system certificates available. Try installing ca-certificates.

even in proot update fails

G=/data/data/com.termux/files/usr/glibc
proot ... -r $G /bin/bash
apt update
same error

and this fail how is that possible

whoops that was a typo . CaInf missing o. it also works when typed correct

apt -o Acquire::https::CaInf=/etc/ca-certificates/cacert.pem update

maybe some thing with proot or symlink permission locked to 777

ls -l /etc/ca-certificates/cacert.pem
-rw-r--r-- 1 u0_a206 u0_a206 234847 Oct  4  2024 /etc/ca-certificates/cacert.pem

stat /etc/ca-certificates/cacert.pem
Access: (0644/-rw-r--r--)  Uid: (10206/ u0_a206)   Gid: (10206/ u0_a206)

  # only for glibc repos

notice don't drag bionic lists into this apt cache . the whole purpose is to have only glibc repos here

if a dependency is missing copy it to glibc from bionic don't add the bionic repo! or manually add it to the status file until the list is updated online

 in john-peterson/termux-packages@proot I propose that the -glibc suffix is dropped from all packet names since they should not mix with musl or bionic packets

if anyone still want to mix bionic and glibc packets  against all odds . the packet can still be distinguished by the suite name

for bionic

apt install abc/stable

for glibc

apt install abc/glibc

but I don't recommend this to anyone

 # my view on all this . no more use less non proot or bionic patches from me

I am not fixing anything that works in proot  glibc or debian anymore  have already done that for years for no purpose

I am even creating a new proot repo to remove all path patches also . this recipe already has all path patches removed

 # path patches removed

 all path patches are removed compared to bionic build . and it works anyway with only prefix build flag . I have included root.conf for potential path fixes if necessary . but I did not need any of them

 this build recipe also works with the new --proot build flag and create a pristine build with no prefix or special paths

the proot build also restore the --root flag . in this build --root=abc means abc/prefix . dpkg append prefix to root flag

if dpkg is built with --prefix the work around is this that does not append the prefix

dpkg --root=abc <- broken . is actually abc/prefix

dpkg --admindir=$root/var/lib/dpkg --instdir=$root <- works no prefix inserted
--admindir can be omitted because it's prefix/var/lib/dpkg by default . --instdir is not prefix by default

 # add --installdir=prefix if glibc suffix removed

 if the prefix shell  is removed from packets add --installdir=prefix to dpkg wrapper

I have proposed this in john-peterson/termux-packages@proot for  simplicity  . simpler build logic and packets and dpkg -c output with no prefix in packet files

---

side note about copying debian packets to termux . that I asked about before

 ## copy Debian packet to termux

 the build.sh file is called debian/control debian/rules and they are scattered all over the web . there is no single debian build repo like this that contain all recipes . the Debian build recipes are all over the place impossible to find them in one place

 after endless searching I found the Debian build system for R. it's in the same repo as the app. it seems like they expect the app to provide it

~~~
https://salsa.debian.org/edd/r-base

ack "Depends" debian/control|head -1
Build-Depends: gcc (>= 4:4.9.2-2), g++ (>= 4:4.9.2-2), gfortran (>= 4:4.9.2-2), libblas-dev, liblapack-dev, tcl8.6-dev, tk8.6-dev, bison, groff-base, libncur...

head -2 debian/rules

dpkg-buildpackage -B
~~~

this packet already works with debian proot but I will try to copy the rules file to build.sh as an exercise to learn the debian build system

it will require many new packets that are missing . if they fail to build I have to find the debian/rules for them also in a separate location unless it's in the source folder  . if that will help finding the broken build flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant