termux / proot

An chroot-like implementation using ptrace.
https://wiki.termux.com/wiki/PRoot
Other
774 stars 160 forks source link

proot's `-L` argument doesn't work correctly #281

Open zavocc opened 1 year ago

zavocc commented 1 year ago

Problem description I'm upgrading my debian installation from bookworm to sid and apt spams a lot of symlink size warning, however proot-distro have -L argument passed to proot but still doesn't suppress the message

dpkg: warning: symbolic link '/usr/lib/arm-linux-gnueabihf/vdpau/libvdpau_nouveau.so' size has changed from 30 to 25  

Screenshot_2023-07-14-16-51-56-68_84d3000e3f4017145260f7618db1d683

Screenshot of htop showing the process of proot with -L flag passed Screenshot_2023-07-14-16-53-32-94_84d3000e3f4017145260f7618db1d683

Ubuntu 14.04 arm64 would fail to upgrade packages as error

Screenshot_2023-07-15-15-37-43-93_84d3000e3f4017145260f7618db1d683

Steps to reproduce Install a distribution that is behind updates that could trigger symlink size warning or error in dpkg

Installing debian with proot-distro install debian (bookworm), change sources.list from bookworm to sid, and do apt full-upgrade to witness it

However reproducing this on ARM32 device or termux installation which has 32-bit proot, the -L argument works correctly as is, doesn't yield symlink size warnings.

Expected behavior proot's -L argument should be able to suppress it based on how -L argument should do

Additional information

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=21407
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages-cf.termux.dev/apt/termux-main stable main
# x11-repo (sources.list.d/x11.list)
deb https://packages-cf.termux.dev/apt/termux-x11 x11 main
Updatable packages:
apt/stable 2.7.2 aarch64 [upgradable from: 2.7.1-1]
termux-tools version:
1.38.3
Android version:
11
Kernel build information:
Linux localhost 4.14.180-perf+ #2 SMP PREEMPT Sat Sep 3 23:17:03 CST 2022 aarch64 Android
Device manufacturer:
OPPO
Device model:
CPH1933
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.x11 versionCode:12
com.termux.styling versionCode:30
zavocc commented 1 year ago

ARM64 ubuntu 14.04 and other linux distros would also prevent packages from being updated as I was trying to run this on proot (i know it's eol'ed but it should help with this proot's case)

I've used this commands to setup ubuntu 14.04 and update packages

mkdir trusty
curl --output trusty.tar.gz https://cdimage.ubuntu.com/ubuntu-base/releases/14.04/release/ubuntu-base-14.04-core-arm64.tar.gz
proot --link2symlink tar -xvf trusty.tar.gz -C trusty

# for su to work correctly 
curl -L --output trusty/libdisableselinux.so https://github.com/CypherpunkArmory/UserLAnd-Assets-Debian/raw/master/assets/arm64/libdisableselinux.so
echo /libdisableselinux.so >> trusty/etc/ld.so.preload
chmod 755 trusty/libdisableselinux.so

echo nameserver 1.1.1.1 > trusty/etc/resolv.conf

env -u LD_PRELOAD proot -L -l -0 -b /dev -b /proc -b /sys -w / -r trusty /usr/bin/env -i TERM=$TERM su -l

# In Ubuntu
apt update && apt upgrade -y

Would also show symlink size errors but termination instead of warning. Only in arm64 though.

michalbednarski commented 1 year ago

On devices I've tested described problem didn't occur (might be device-specific or something is missing from repro)

When following instruction from first reply, only failure I've got:

Errors were encountered while processing:
 makedev
 mountall
 plymouth
 upstart
 udev
 ubuntu-minimal
 initramfs-tools

Which can be bypassed through

rm /var/lib/dpkg/info/makedev.postinst
rm /var/lib/dpkg/info/udev.postinst
dpkg --configure -a
zavocc commented 1 year ago

Weird. Here is the logs file just in case (generated with env -u LD_PRELOAD PROOT_VERBOSE=9 proot -L -l -0 -b /dev -b /proc -b /sys -w / -r trusty /usr/bin/env -i TERM=$TERM PATH=/usr/bin:/usr/sbin:/sbin:/bin dpkg -i /var/cache/apt/archives/base-files_7.2ubuntu5.6_arm64.deb > log.txt 2>&1)

log.txt