Giter VIP home page Giter VIP logo

proot-distro's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

proot-distro's Issues

Chromium Browser for Ubuntu 20.04

Hey. so I recently installed Chromium Browser via apt. and after Installation I do some tweaking by adding no sandbox through the desktop entry /usr/share/applications afterwards it won't start. I tried to run it in terminal but it asks me to install chromium as a snap package

however. snapd obviously won't gonna work because it uses FUSE (i think) and Requires real root access.

Tried to Google. "chromium ppa for Ubuntu 20.04". but adding it still uses the focal repositories instead of the PPA. even pinning it. i could use Midori or Firefox but I want to run Chromium.

is there a way to install chromium without snaps in Ubuntu 20.04

add CentOS

I need centos 7 and also old ubuntu 14, is it possible to add distro manually without waiting the developer to add it, if so please create a tutorial how to add it!

provide possibility to run a command in the proot by preserving the host environment

This is a feature request.
I want to be able to run java in the normal termux session by using proot-distro login.
I want java to be able to access all host environment variables.
I am more or less able to achieve this by applying the following changes to proot-distro:

line 816 or so: change su -l to su -p
line 727 - 731 : comment out the whole /usr/bin/env section
line 753: comment out set -- "--cwd=/root" "$@"
Create the script file "java" in ~/../usr/local/bin/ with the following content:

#!/usr/bin/bash
#UBUNTU=/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu-20.04
cd $PWD
prootexec login --termux-home \
 --shared-tmp \
 ubuntu-20.04 -- \
 /usr/bin/java "$@"

... and make it executable

also see my comment on java in termux
. #40 #

aarch64 for armv81

hi.
I saw that in scripts, fore example ./archlinux.sh, in case armv81 will install ArchLinuxARN-armv7.
Why not aarch64?
armv81 is aarch64 or i am wrong?
If so can we update the scripts and use aarch64 for armv81?

Unsupported CPU Architecture (i686) in proot-distro

Now. I have Android 7.1 x86 installed with Termux on it. But the issue is that Ubuntu 20.04 isn't supported on i686.

It would be useful if you just use Ubuntu 18.04/16.04 LTS instead of Ubuntu 20.04 for Android x86

I am a Ubuntu User. proot-distro is easier to use. I use Ubuntu on my Phone using proot-distro more often.

Support for Backup Linux Distros?

is there a way to backup linux distros in proot-distro? so if things go wrong i could rollback to the previous state. just like VM Snapshots. for example. if have development files inside the proot environment then install other stuff and cause the linux environment to be problematic (eg. compiling linux programs with make). or accidentally entered a wrong command then reset a distribution and then start over from scratch. it would be nice to add backup/snapshot feature

[Feature] Ability To Create Docker-esque Containers/Python-esque venvs

Love this so far - had an idea: Right now, the distro configs are 1:1 (e.g. there's a config file called alpine.sh, archlinux.sh etc. and when you install you get just one copy of a distro),

I think it would be awesome to modify the process slightly to use those configs as templates (sort of like Dockerfiles) and then when installing being able to create as many named "containers" as you'd like. Obviously, nothing nearly as complex as Docker - no need for layers, overlayfs, etc. Just the ability to create separate installs without copying the distro config file. The config files are already essentially this way...

Then, when launching, being able to choose by name just as now.

(Could be relatively simple - default behavior is as it is now, create the install with the alias name the same as the distro name... but also having the ability to specify a different name for a second or third copy.)

Just a thought :)

Add Configurable Bind Mounts (proot's -b option)

Hello, i have an suggestion if it's okay to add Configurable Bind Mounts to proot-distro

So i could easily access files or relocate files/folders and bind fake proc files which is useful for some programs (proot's -b or --bind option implementation im proot-distro)

This issue is edited as to avoid useless/duplicate redundancies

Add proot's built-in port forwarding feature

So i was about to setup QEMU using proot-distro with SMB File sharing but the issue is SMB didn't start when QEMU is running. QEMU runs but SMB sharing didn't work only the 9p method (but the 9p protocol is not available for windows so smb is being used). so i was playing around with proot -p with debian chroot (which i asked in subreddit) then i could see some differences. when enabling the proot -p i tried to setup SMB with QEMU and it works. since SMB Server requires root access

This is useful for some applications like QEMU + smb and for lazy people needs to configure ports every time they reset the distro which is very tiring especially when you need to test packages

So it would be nice to add it

However it does not automatically bind to higher port (2000) if the server runs at port higher than 1024

Arch linux bug

1.recently i installed arch linux using proot-distro
then xfce4 and when i started xsdl
i got a error 'desktop Folder' not found
and xfce4 not working properly
2. when i tried lxde i got new error
'no session
for pid 14798'
please fix it

Run proot-distro as root

Is it possible to run proot-distro as root? So the /sys, /proc, /dev is automatically mounted.

IMG_20201227_232736

Unable to write files inside proot'ed Ubuntu

Suddenly, all the commands run after I enter the Ubuntu distribution via proot-distro login ubuntu throw error messages with "required key not available" in It.

Sounds like it lost the capacity of writing to my internal storage. Here is some of the errors thrown:

Initializing pyenv

/root/.pyenv/libexec/pyenv-init: line 131: cannot create temp file for here-document: Required key not available
pyenv: cannot rehash: /root/.pyenv/shims/.pyenv-shim exists
/root/.pyenv/plugins/pyenv-virtualenv/bin/pyenv-virtualenv-init: line 94: cannot create temp file for here-document: Required key not available

Making a git pull

remote: Enumerating objects: 82, done.
remote: Counting objects: 100% (82/82), done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 77 (delta 56), reused 62 (delta 41), pack-reused 0
error: unable to create temporary file: Required key not available
fatal: failed to write object
fatal: unpack-objects failed

Any ideas on how to solve this?

Error extracting rootfs

Getting an error when attempting to install ubuntu via proot-distro.

[*] Extracting rootfs, please wait...
tar: gzip: Cannot exec: Function not implemented
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
[*] Writing '/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/etc/profile'...
/data/data/com.termux/files/usr/bin/proot-distro: line 252: /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/etc/profile: No such file or directory

Have tar and gzip installed and all packages are up to date.

Arch Linux man Segmentation fault

man, throws a Segmentation fault when running it from Arch using fresh Arch Linux installed using the proot distro install archlinux command.

Here is the device:

  Operative System:      GNU/Linux
  Kernel Version:        5.4.0-faked
  CPU:                   Cortex-A53
  Architecture:          aarch64
  Vendor:                ARM
  CPU MAX MHz:           2189.0000
  CPU MIN MHz:           480.0000
  CPU Operation:         32-bit, 64-bit
  CPU Cores:             8
  RAM Total:             3.593
  RAM Available:         1.333
  Model:                 HUAWEI P40 lite E
  Version:               10.1.0.164C432
  Network Type:          LTE
  RIL(radio):            android infineon balong-ril 1.0
  Wi-fi Device Name:     HUAWEI_P40_lite_E-8f0096e
  DPI:                   272
  Timezone:              Europe/Madrid
  Board:                 ARTHTHD_L29_VA
  Platform:              kirin710
  Build Date:            Tue Dec 22 17,52,35 CST 2020
  Security Patch:        2020-10-01
  SDK Ver:               29
  SDK Min-Ver:           23

I updated the system running pacman -Syu afterwards and still.

When I install xfe,

When I install xfe, execute
$ apt install xfe
The error message is as follows:
dpkg: errors processing package libfpring-2-2:arm64(--configure):
dpkg: errors processing package gvfs:arm64(--configure):
dpkg: errors processing package fprintd(=1.90.1-1ubuntu1);
...
Errors were encountered while processing:
udisks2
gvfs-daemons
gvfs-backends
libfprint-2-2:arm64
gvfs:arm64
fprintd
libpam-fprintd:arm64
E:Sub-process /usr/bin/dpkg retuned an error code (1)

Can't access termux api

$ proot-distro login ubuntu
root@localhost:# ls
root@localhost:
# am
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/bin/sh": library "libc.so.6" not found
Aborted
root@localhost:# termux-info
CANNOT LINK EXECUTABLE "/data/data/com.termux/files/usr/bin/bash": library "libc.so.6" not found
Aborted
root@localhost:
# nano
CANNOT LINK EXECUTABLE "nano": library "libc.so.6" not found
Aborted

This is what i when i run Termux-Api commands

Not working on 32-bit cpu

When I try to install proot-distro it says:
Uable to locate package proot-distro. On Andronix I had a similar issuse, I coulnt install anything. But I know that there are 32-bit Linux distros

Bind $PREFIX/tmp to Guest /tmp directory

Hi. so i was just wondering if you can add a feature that the Termux's tmp directory is mounted to Guest /tmp directory. this is useful if termux runs at cold start. the guest tmp directory is also cleared as well to clean up cache and unwanted sockets. and. i can run Guest's GUI apps inside Termux X11 with Xhost.

Running Firefox inside Termux X11 using Debian Chroot
Screenshot_2020-09-29-10-08-16-70_86e29ab1b9fd3f2a477a649413bc8db4.png

A solution for Xvnc segmentation fault

For now we can use

vncserver -localhost -SecurityTypes None

to avoid crash of TigerVNC server.

However TigerVNC/tigervnc#800 proposes a solution which seems better: to preload a libgcc_s.so.1 library. Script proot-distro can be modified to export a LD_PRELOAD variable with appropriate architecture-specific value like /lib/aarch64-linux-gnu/libgcc_s.so.1.

  • TODO: verify that solution actually works.

$PREFIX/bin/getprop returns nothing

getprop doesn't seem to be functioning in the proot. Probably another bindpoint is needed. My end goal is to use the result of getprop ro.product.model as my prompt instead of localhost

`[root@localhost ~]# getprop
getprop: property_list
[root@localhost ~]# getprop ro.product.model

[root@localhost ~]# /system/bin/getprop ro.product.model

`

Auto Exit

The proot auto exits when i am building dlib

Add support for Debian distribution

Add support for these distributions:

  • Debian Stable (debian-stable or debian-buster (?))
  • Debian Sid (debian-sid) sid is low-prio

Will require building own rootfs tarballs and hosting somewhere (probably as attachments to proot-distro version tag).

does launch script contain sysvipc option by default?

Dear specialists,
DO you plan sysvipc Proot option as A default choice for all launching scripts of yours package, which are capable to launch installed Linux distributions?
Or did you added this feature only for unstable Termux scripts repo for now?
If you are waiting and if you are performing some development tests. Can I help you while participating in such Proot tests? If those tests are based on executing scripts or by typing commands, I AM really prepared to debug and test with you.
I can confirm, that introduced sysvipc option really do not cause stability issues. No extra hundred of MBS memory allocations, no Termux auto termination or even mate-session crashes are not presented.
Because I Am running Orca, complex Python program which intensively communicates with many .so libraryes, I think, that intensive work with this screen reader can be very useful to confirm new sysvipc extension stability.
I want to do something very useful also for you, advanced programmers here. Because I know, that I AM sometimes overloading you by my complex pleas such as adding shared memory support.
But really, it work like A charm! GTK3 library do not report shmget function not implemented error, also other apps do not report errors related to added shared memory functions.
So thank you very very much for yours tips how to help you testing, if is it necessary.

Permissions are being messed up after backing up the rootfs

Hello, so recently i did a backup of clean archlinux Installation and after backing up, it gives errors about sudo that the permissions are not set properly

And it gives warnings about permissions is not correct

Warnings about pacman:

warning: directory permissions differ on /usr/lib/pkgconfig/
filesystem: 700  package: 755

Warnings about sudo:

sudo: /etc/sudo.conf is owned by uid 10873, should be 0
sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Is it okay if permissions are retained?

Can't Login Ubuntu18.04

$ proot-distro login ubuntu-18.04
su: System error

OS: Android 9 aarch64
Host: HONOR KIW-AL10
Kernel: 3.10.108-lineageos-g6e87014
Uptime: 15 hours, 24 min
Packages: 66 (dpkg), 1 (pkg)
Shell: bash 5.0.17
Terminal: com.termux
CPU: (8)
Memory: 1649MiB / 2850MiB

Adding System V IPC support via LD_PRELOAD

Hello. I'm thinking about implementing System V IPC in proot. There are of course two options, one aesthetic and the other, as the Russians say, is just a "crutch" (костыль).

  1. implement at the proot level
  2. via LD_PRELOAD using the Peyla Library

What do you think about this ?

Proot doe snot do proper host/port resolution.

When starting a server inside of ubuntu, seems like port forwarding is not working. If I start same server in termux then it does. Using some low-ish ports like 8000 and localhost as hostname. Would greatly appreciate some advice.

emulating /dev/fuse to mount a remote filesystem via SSHFS?

I'm trying to mount a remote filesystem using sshfs (from Arch) but I get the following error:

[root@localhost ~]# sshfs 192.168.0.18:/ /mnt/mymount/
fuse: failed to open /dev/fuse: Permission denied

That makes sense, since being root inside of PRoot is not actually root. Is there a workaround such as changing a bind point or running in isolated mode?

Arch Linux base package depends upon systemd

Archlinux installation using proot-distro stops abruptly.
Getting this error:

warning: pacman is designated as a HoldPkg.
:: HoldPkg was found in target list. Do you want to continue? [y/N]

Please remove 'systemd' and 'dbus' from unnecessary packages in 'archlinux.sh', 'base' package depends upon 'systemd' and which inturn depends upon 'dbus', so they can't be removed.
base package
systemd package
Or for removing bloat, you can try something like this.

After adding the path to the libgcc_s.so.1 file to LD_PRELOAD, the Termux UTILITIES stopped working

A few days ago I had an SD card, where Termux was installed, went into "read-only" mode. Just yesterday I bought a new card and immediately delivered Termux and proot-distro. It seems that everything worked, but today I wanted to run utilities that are part of Termux (netstat, nano (in proot-distro rootfs nano was not installed), termux-api), but they sent me far further. The error was like this:

CANNOT LINK EXECUTABLE "nano": library "/usr/lib/arm-linux-gnueabihf/libgcc_s.so.1" needed or dlopened by "/data/data/com.termux/files/usr/bin/nano" is not accessible for he namespace "(default)"

Immediately libgcc_s.so.1 rushed into the eyes. I remembered that there were changes from the @xeffyr for fixing crash of TigerVNC server. As soon as I comment the line LD_PRELOAD in termux-proot.sh in the folder /usr/var/lib/proot-distro/installed-rootfs/ubuntu/etc/profile.d, all Termux utilities started working.

" You should not use command 'apt' as root."

This might be better suited for termux-packages, but running any apt command as a "root" user results in this warning:

[root@localhost home]# apt You should not use command 'apt' as root. This is dangerous as may damage your Termux installation and data.

I imagine that this warning is for people with rooted devices, but is this any actual danger of using it within a PRoot? If there is no danger, is there a way of bypassing the warning? My hacky solution is to have an alias of:
su -c 'apt update' alarm

to run it as an user not named "root"

lxc on android 👀

When I tried to decompile Samsung linux on dex app file I found lxc*.so files in it
So
can we somehow run lxc in termux like Samsung did in its Linux on dex app?

debian buster rootfs: sources.list is missing (security) update sources

Unfortunately (but intentionally, for other use cases), debootstrap generates a /etc/apt/sources.list that doesn't include the (security) update sources. It would be great if the missing sources could be added to the rootfs so one doesn't need to manually fix this (and so those who don't know this get security updates by default).

Current sources.list:

deb https://deb.debian.org/debian buster main contrib

Suggested sources.list:

deb https://deb.debian.org/debian buster main contrib
deb https://deb.debian.org/debian-security/ buster/updates main contrib
deb https://deb.debian.org/debian buster-updates main contrib

pkg proot-distro can't locate the package

admittedly it's on a Nexus 5 , Android 6.0.1 which is marginaly not supported my termux.
but i installed octave 5.1 without a glitch, and many other packages, so maybe it's something easy to fix?

pkg install proot-distro
image_2021-02-03_231823

User other than root

How to create a user other than root in proot ubuntu?
I really dont want to mess up with my installation.

QUESTION: Fake proc: when and how?

I've gone through trying out proot-distro default installation method using ubuntu-20.04
From what I gather, the fake proc entries are written on configuration, but are they always loaded?

What are the cases in which the fake proc entries should be explicitly mounted?

How To Install Xfce4?

Hello guys, I am using google translate to do this article, if it is difficult to read, please sympathize.

I am using proot-distro to install Xfce4 for it, I have followed some directions on Google, but for no reason, all failed.

Here if anyone knows how, guide me with ...

passing arguments when calling proot-distro login with a command

In termux I use a shell script that replaces java, cf. description "workaround for having java in termux" below. It works incredibly well. At its core is the command
proot -R $UBUNTU java "$@"
The only limitation is that I would like to mount some more directories that are not included by the -R switch.
I tried to use proot-distro instead of proot with the following command in the "java" script:
proot-distro login ubuntu-20.04 -- java "$@"
When I run a simple command like java --version this works, too, however I get error messages when I pass lists of quoted arguments.

Here is an example output of a java call that works fine, when I use proot -R $UBUNTU java "$@":

Starting new CIDER session ...
[nREPL] Starting server via /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/usr/bin/lein update-in :dependencies conj \[nrepl\ \"0.8.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.4\"\] -- repl :headless :host localhost
[nREPL] server started on 40408
[nREPL] Establishing direct connection to localhost:40408 ...
[nREPL] Direct connection to localhost:40408 established

Here is an example error, when I use proot-distro login ubuntu-20.04 -- java "$@":

[nREPL] Starting server via /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/usr/bin/lein update-in :dependencies conj \[nrepl\ \"0.8.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.4\"\] -- repl :headless :host localhost
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server:
java.lang.NumberFormatException: Invalid number: 0.8.2
 at clojure.lang.LispReader.readNumber (LispReader.java:352)
    clojure.lang.LispReader.read (LispReader.java:278)
    clojure.lang.LispReader.readDelimitedList (LispReader.java:1398)
    clojure.lang.LispReader$VectorReader.invoke (LispReader.java:1347)
    clojure.lang.LispReader.read (LispReader.java:285)
    clojure.lang.LispReader.read (LispReader.java:216)
    clojure.lang.LispReader.read (LispReader.java:205)
    clojure.lang.RT.readString (RT.java:1878)
    clojure.lang.RT.readString (RT.java:1873)
    clojure.core$read_string.invokeStatic (core.clj:3815)
    clojure.core$read_string.invoke (core.clj:3805)
    clojure.core$mapv$fn__8445.invoke (core.clj:6912)
    clojure.core.protocols$fn__8159.invokeStatic (protocols.clj:168)
    clojure.core.protocols/fn (protocols.clj:124)
    clojure.core.protocols$fn__8114$G__8109__8123.invoke (protocols.clj:19)
    clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
    clojure.core.protocols$fn__8146.invokeStatic (protocols.clj:75)
    clojure.core.protocols/fn (protocols.clj:75)
    clojure.core.protocols$fn__8088$G__8083__8101.invoke (protocols.clj:13)
    clojure.core$reduce.invokeStatic (core.clj:6828)
    clojure.core$mapv.invokeStatic (core.clj:6903)
    clojure.core$mapv.invoke (core.clj:6903)
    leiningen.update_in$parse_args.invokeStatic (update_in.clj:13)
    leiningen.update_in$parse_args.invoke (update_in.clj:9)
    leiningen.update_in$update_in.invokeStatic (update_in.clj:36)
    leiningen.update_in$update_in.doInvoke (update_in.clj:24)
    clojure.lang.RestFn.applyTo (RestFn.java:146)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__7419.invoke (main.clj:453)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)

Here is an example error, when I use proot-distro login ubuntu-20.04 -- java "\"$@\"" (escaped quotes around $@) :

Starting new CIDER session ...
[nREPL] Starting server via /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/usr/bin/lein update-in :dependencies conj \[nrepl\ \"0.8.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.4\"\] -- repl :headless :host localhost
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server:
Error occurred during initialization of VM
java.nio.charset.IllegalCharsetNameException: UTF-8 -Dmaven.wagon.http.ssl.easy=false -Dmaven.wagon.rto=10000 -Xbootclasspath/a:/data/data/com.termux/files/home/.lein/self-installs/leiningen-2.9.4-standalone.jar -Xverify:none -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Dleiningen.input-checksum= -Dleiningen.original.pwd=/data/data/com.termux/files/home/cloj-projects/clojupyter-fiddle -Dleiningen.script=/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/usr/bin/lein -classpath /data/data/com.termux/files/home/.lein/self-installs/leiningen-2.9.4-standalone.jar clojure.main -m leiningen.core.main update-in :dependencies conj [nrepl
	at java.nio.charset.Charset.checkName(java.base/Charset.java:308)
	at java.nio.charset.Charset.lookup2(java.base/Charset.java:482)
	at java.nio.charset.Charset.lookup(java.base/Charset.java:462)
	at java.nio.charset.Charset.defaultCharset(java.base/Charset.java:608)
	at sun.nio.cs.StreamEncoder.forOutputStreamWriter(java.base/StreamEncoder.java:56)
	at java.io.OutputStreamWriter.<init>(java.base/OutputStreamWriter.java:110)
	at java.io.PrintStream.<init>(java.base/PrintStream.java:110)
	at java.io.PrintStream.<init>(java.base/PrintStream.java:148)
	at java.lang.System.newPrintStream(java.base/System.java:1898)
	at java.lang.System.initPhase1(java.base/System.java:1974)

And finally, here is an example error, when I use proot-distro login ubuntu-20.04 -- java $@ (no quotes around $@):

Wrote /data/data/com.termux/files/home/cider_escaped_quotes.txt
Starting new CIDER session ...
[nREPL] Starting server via /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/usr/bin/lein update-in :dependencies conj \[nrepl\ \"0.8.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.4\"\] -- repl :headless :host localhost
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: mktemp: failed to create file via template ‘/tmp/lein-trampoline-XXXXXXXXXXXXX’: No such file or directory
java.lang.RuntimeException: EOF while reading
 at clojure.lang.Util.runtimeException (Util.java:221)
    clojure.lang.LispReader.readDelimitedList (LispReader.java:1403)
    clojure.lang.LispReader$VectorReader.invoke (LispReader.java:1347)
    clojure.lang.LispReader.read (LispReader.java:285)
    clojure.lang.LispReader.read (LispReader.java:216)
    clojure.lang.LispReader.read (LispReader.java:205)
    clojure.lang.RT.readString (RT.java:1878)
    clojure.lang.RT.readString (RT.java:1873)
    clojure.core$read_string.invokeStatic (core.clj:3815)
    clojure.core$read_string.invoke (core.clj:3805)
    clojure.core$mapv$fn__8445.invoke (core.clj:6912)
    clojure.core.protocols$fn__8159.invokeStatic (protocols.clj:168)
    clojure.core.protocols/fn (protocols.clj:124)
    clojure.core.protocols$fn__8114$G__8109__8123.invoke (protocols.clj:19)
    clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
    clojure.core.protocols$fn__8146.invokeStatic (protocols.clj:75)
    clojure.core.protocols/fn (protocols.clj:75)
    clojure.core.protocols$fn__8088$G__8083__8101.invoke (protocols.clj:13)
    clojure.core$reduce.invokeStatic (core.clj:6828)
    clojure.core$mapv.invokeStatic (core.clj:6903)
    clojure.core$mapv.invoke (core.clj:6903)
    leiningen.update_in$parse_args.invokeStatic (update_in.clj:13)
    leiningen.update_in$parse_args.invoke (update_in.clj:9)
    leiningen.update_in$update_in.invokeStatic (update_in.clj:36)
    leiningen.update_in$update_in.doInvoke (update_in.clj:24)
    clojure.lang.RestFn.applyTo (RestFn.java:146)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__7419.invoke (main.clj:453)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.main$main_opt.invokeStatic (main.clj:514)
    clojure.main$main_opt.invoke (main.clj:510)
    clojure.main$main.invokeStatic (main.clj:664)
    clojure.main$main.doInvoke (main.clj:616)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:40)

workaround for having java in termux

TL;DR
I create an ubuntu proot, where I install the openjdk. Back in termux I create a bash script named "java" which, when called, forwards to the real java within the ubuntu proot by using the proot command.

How
Set up the ubuntu-20.04 proot (more info here):

pkg install proot-distro
proot-distro list #(check ubuntu versions available)
proot-distro install ubuntu-20.04
proot-distro login ubuntu-20.04

Within the ubuntu distro install the openjdk:

apt update
apt upgrade
apt install openjdk-8-jdk

(I suppose this also works with later versions of the openjdk.)

Return to termux (press Ctrl-D)

Add the following line in ~/.bashrc
export UBUNTU=$PREFIX/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/
From the bash or fish prompt you can do this using the following command:
echo "export UBUNTU=\$PREFIX/var/lib/proot-distro/installed-rootfs/ubuntu-20.04/" >> ~/.bashrc
Restart the termux session so that .bashrc is executed and the variable $UBUNTU is set.

Create the script file "java" in ~/../usr/bin/ with the following content:

#!/usr/bin/bash
unset LD_PRELOAD
proot -R $UBUNTU java "$@"

From the fish prompt you can do this using the following command:

echo "#!/usr/bin/bash
unset LD_PRELOAD
proot -R \$UBUNTU java \"\$@\" " >> ~/../usr/bin/java

(I don't know how to do this from the bash prompt)

For more information about the proot command, check the manual.

Make the script "java" executable:
chmod 777 ../usr/bin/java

You can now call java with arguments from termux. I suppose you can do the same trick for javac.

I would be happy to hear about your suggestions for improvement.

Originally posted by @ronnac in termux/termux-packages#324 (comment)

[Feature Request] Verify the tarball after downloading

if [ ! -f "${DOWNLOAD_CACHE_DIR}/${tarball_name}" ]; then
echo -e "${BLUE}[${GREEN}*${BLUE}] ${CYAN}Downloading rootfs tarball...${RST}"
# Using temporary file as script can't distinguish the partially
# downloaded file from the complete. Useful in case if curl will
# fail for some reason.
echo
rm -f "${DOWNLOAD_CACHE_DIR}/${tarball_name}.tmp"
if ! curl --fail --retry 5 --retry-connrefused --retry-delay 5 --location \
--output "${DOWNLOAD_CACHE_DIR}/${tarball_name}.tmp" "$download_url"; then
echo -e "${BLUE}[${RED}!${BLUE}] ${CYAN}Download failure, please check your network connection.${RST}"
rm -f "${DOWNLOAD_CACHE_DIR}/${tarball_name}.tmp"
return 1
fi
echo
# If curl finished successfully, rename file to original.
mv -f "${DOWNLOAD_CACHE_DIR}/${tarball_name}.tmp" "${DOWNLOAD_CACHE_DIR}/${tarball_name}"
else
echo -e "${BLUE}[${GREEN}*${BLUE}] ${CYAN}Using cached rootfs tarball...${RST}"
fi
echo -e "${BLUE}[${GREEN}*${BLUE}] ${CYAN}Extracting rootfs, please wait...${RST}"
# --exclude='dev'||: - need to exclude /dev directory which may contain device files.
# --delay-directory-restore - set directory permissions only when files were extracted
# to avoid issues with Arch Linux bootstrap archives.
proot --link2symlink \
tar -C "${INSTALLED_ROOTFS_DIR}/${distro_name}" --warning=no-unknown-keyword \
--delay-directory-restore --preserve-permissions --strip="$DISTRO_TARBALL_STRIP_OPT" \
-xf "${DOWNLOAD_CACHE_DIR}/${tarball_name}" --exclude='dev'||:
# Write important environment variables to profile file as /bin/login does not

So the script extracts the tarball after downloading with no verification, I'd suggest verifying it after downloading.

This step is also recommended in the installation guide of most of the distros (e.g. arch linux).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.