termux / proot

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

My new PROOT guide - how to improve? #168

Closed falkor2k15 closed 3 years ago

falkor2k15 commented 3 years ago

I finally got Ubuntu to function pretty well in PROOT, but there's still a few errors cropping up compared to Linux Deploy's rooted CHROOT method:

So how to improve on this basic Ubuntu distro setup so that it functions as smooth and as close to Linux Deploy as possible...?

INSTALLING PROOT IN TERMUX - ONLINE Install Termux via Play Store Note: CTRL+ALT+V to paste into Termux Settings > Privacy > Permissions Manager > Files and media > give Termux full access before launching pkg update && pkg upgrade -y && pkg install proot-distro pulseaudio -y && pulseaudio --start --exit-idle-time=-1 && pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1

INSTALLING PROOT IN TERMUX - OFFLINE Install Termux via downloaded APK file (find in Play Store > click 3 dots > Share to get APK link > paste into: https://apkcombo.com/apk-downloader) Note: package location = /data/data/com.termux/cache/apt/archives (backup to a new internal storage folder called packages after online install) dpkg -R --install packages (termux-tools.deb ncurses-utils.deb libtalloc.deb proot.deb proot-distro.deb libsoxr.deb libogg.deb speedxdsp.deb libvorbis.deb libltdl.deb libwebrtc-audio-processing.deb libflac.deb libsndfile.deb pulseaudio.deb)

INSTALLING UBUNTU (MINIMAL W/ BASIC GUI) IN PROOT - ONLINE Note: install location = /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/root proot-distro install ubuntu-20.04 && proot-distro login ubuntu-20.04 --bind /storage/emulated/0:/root/Storage export DEBIAN_FRONTEND=noninteractive apt update && apt upgrade -y && apt install pulseaudio tightvncserver -y && apt install sudo lxterminal lxde-core -y --no-install-recommends && apt-get clean adduser android && echo "android ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers && exit proot-distro login ubuntu-20.04 --user android --bind /storage/emulated/0:/home/android/Storage vncserver && vncserver -kill :1 echo 'exec startlxde' > $HOME/.vnc/xstartup && export PULSE_SERVER=127.0.0.1 vncserver -geometry 1280x720 -dpi 150 Open RealVNC Viewer and connect to 127.0.0.1:1 vncserver -kill :1

BACK UP & RESTORE UBUNTU IN TERMUX - OFFLINE proot-distro backup ubuntu-20.04 --output /storage/emulated/0/ubuntu-20.04.tar.gz proot-distro restore /storage/emulated/0/ubuntu-20.04.tar.gz

ghost commented 3 years ago

@falkor2k15 Better to post guides on community pages, like Reddit (https://reddit.com/r/termux), if you want to make it discoverable by more people. This is an issue tracker and not general purpose forum.

Install Termux via Play Store

Do not install Termux from Play Store and do not suggest do that for other people. Play Store builds are dead.

falkor2k15 commented 3 years ago

Well, I did post 3 issues above - and the guide is more a way to reproduce those issues.

I don't find anywhere else to download Termux? A Termux website comes up in google, but is currently inaccessible for me.

ghost commented 3 years ago

Well, I did post 3 issues above

Yes, but that's not enough to understand the problem. Issue description like "returns fatal error" doesn't point on origin of the problem.

Proot behavior is very dependent on used Android device.

Proper issue report includes at least these steps:

  1. Description.
  2. Exact way to reproduce (command / script).
  3. System info, typically output of termux-info.

and the guide is more a way to reproduce those issues.

Maybe, though your guide contains lots of information unrelated to mentioned issues. You could shorten it to provide only commands terminating with errors.

I don't find anywhere else to download Termux? A Termux website comes up in google, but is currently inaccessible for me.

https://f-droid.org/en/packages/com.termux/

falkor2k15 commented 3 years ago

@xeffyr does that mean you would expect Ubuntu to be able to go through the upgrade process from a plain vanilla proot distro via the update-manager-core method as per Linux Deploy under normal circumstances (or for most devices)?

Rather than getting too granular with error messages or assuming device specific errors, I am under the impression that there might be some fundamental limitations with the proot method that are undocumented but could explain a lot of things in terms of PROOT vs. CHROOT? Sometimes a broader discussion/understanding of the issues can be a better approach, ie. Problem vs. Incident.

EDIT: Wow, it seems I'm quite a few versions behind in terms of what I got from the Play Store!

ghost commented 3 years ago

@falkor2k15 I recommend upgrading strictly through either

apt update && apt upgrade

or

apt update && apt dist-upgrade

Installing update-manager results in installation of things that will not work under proot. You may observe some dpkg issues, some known ones are mentioned in https://github.com/termux/proot-distro#fixing-dpkg-errors. It is not possible to permanently fix them.

there might be some fundamental limitations with the proot method that are undocumented but could explain a lot of things in terms of PROOT vs. CHROOT?

Chroot: run a process with alternate root file system directory.

Proot: start a process and take control over its execution flow, hijack arguments and return values over system calls to mimick chroot and custom user IDs (e.g. root).

So proot actually provides a fake execution environment, fake privileges, etc. Most of stuff requiring a true root will not work there.