termux / proot

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

Zypper hangs after initial installation #160

Closed radumamy closed 3 years ago

radumamy commented 3 years ago

Zypper successfully installs packages as part of the initial distro deployment script but fails later on when performing distro upgrades or refresh.

Android 11 aarch64 Termux 0.113 Kernel 4.19.125-perf+

michalbednarski commented 3 years ago

This is actually caused by your distro configuration

When running as root, zypper at startup runs su -c umask -l root. That command was supposed to return single-line result, but bash launched from su also executes /root/.bash_profile, which contains switch-user, which starts interactive shell which here is connected to pipe from which no command is coming and therefore hangs.

You probably shouldn't be using /root/.bash_profile to login as different user but instead specify different command when launching proot instead of /bin/bash --login

radumamy commented 3 years ago

Thank you @michalbednarski. I have tested it with root user and zypper works as expected. I've disabled switch-user from /root/.bash_profile and replaced /bin/bash --login with /bin/su - myusername in my distro launch script. This also works. I'm not sure if this is the right way to login using a different user other than root. What is your suggestion? Kind Regards, Radu

michalbednarski commented 3 years ago

Usually directly running su is ok, though as you first write /root/.bash_profile from installation script with line launching first run script and then that script rewrites this file to not contain that line, it might make sense to rename that file to for example /root/.proot_startup (in both installation and first run scripts) and then launch as proot ... /bin/bash /root/.proot_startup

radumamy commented 3 years ago

Excellent. Thank you.