Noob questions about Termux and ADB - Android Q&A, Help & Troubleshooting

I am working on a special project where I am trying to use my Android phone as a data collection and compute node in an edge platform. (no need and too long to go into details).
Anyways, I am an android noob, but I recently got a flagship samsung phone and I have gotten root access. It seems like I was able to successfully get root access in Termux app and in ADB.
I have been able to run nodeJS, which was one of my goals, and I have been able to use clang++ from termux pkg repo and compile and run basic c++ apps. I have more questions and more things to figure out, but I will just jump into the main ones.
What are the main differences between using ADB and Termux? Which has more native performance? What is termux under the hood? It's described as a terminal emulator (kind of confused by that description)... but I am wondering is it actually doing emulation? (therefore I am not getting native performance). I know like WSL (windows->Linux) is some emulation, and WINE (linux->windows) is some emulation... and I am wondering if the same is true with Termux? Because I do not want any emulation layers... I want to run apps/scripts on the bare metal of this phone. So I am wondering for example, when I am running nodeJS in (adb or termux) or running a program I compiled with clang++ (on ADB or termux)... Is that program running on bare metal or some emulation layer?
Also related to Termux... I am wondering since it is an 'app' like something that comes from the play store...when I launch a process from termux, say nodeJS.... is that process running within the Termux APP sandbox? (I understand the android OS does some management / sansboxing of apps)... Or is that process launched on the phone outside of termux. For example, can I close termux app, and have a process (say NodeJS or other program) run in the background forever.
I want to get the full performance possible to these apps, i.e. I don't want the android OS to limit the process time/usage and RAM usage (would that be happening, is there something I need to do to override, and give my apps no performance throttling).
---------------------------------------
I am also wondering if I am better off just installing some linux distro on this phone natively, and not using android... my only concern there is I may not get as good driver support to access the phone's GPS and camera (which is a requirement). any thoughts on that?

This is my output in termux when I try to upgrade its seems my dpkg is messed up how can I fix it. SOLVED

Related

theoretical 'high' perfornance x server using ipc

Hi, I've been looking at running GNU Linux apps on a rooted android. device with modern hardware and I've yet to find a 'nice' way to run x apps with acceptable GUI performance. Currently I've tried the java implemention of x on android which is barely useable and various vnc - rpc intergrations running x11 using a virtual frame buffer which is much better but laggy.
My idea to solve this problem is to completely do away with the vnc etc.. proxying. that 8s hack the virtual frame buffer version of xorg so that the main pixel map surface is in ipc shared memory and use ipc to render this through the android api.
So is it possible to statically link the needed android libraries to allow abdroids ipc to work between a hacked xorg vfb and abdroids shared memory ipc to a native android app. Thus making high performance rendering with near zero memory coppies possible.
Secondly, and this would be a bonus, could I even get rid of ipc and a native android app by getting xorg on my root GNU Linux install to work directly with android graphics and UI apis. This would be ammazing.
Hopefully ipc is at a kernel level so it may be possible to just port the needed parts of android to GNU Linux to do this if the statically linking method is known not to work.
Any ideas and suggestions, what do you think of this idea for intergraring GNU Linux x apps and android.
I really like this idea and I've been looking for something like this. You said you used the "X server" android app? I'm kind of curious on the performance. Was it laggy or just that it wasn't fully what you expected?
jthree2001 said:
I really like this idea and I've been looking for something like this. You said you used the "X server" android app? I'm kind of curious on the performance. Was it laggy or just that it wasn't fully what you expected?
Click to expand...
Click to collapse
Currently I'm running xrdp and tightvncserver in a gnu/linux environment (using inode linking not chroot) and xfe as the windows manager.
I connect to this from android using a rdp client.
The main issues appear to be very slow performance on graphics updates, visably slow, which I put down to the overheards of running everything through vnc/rdp - over sockets - mem coppies, compression (which I should turn off to see if it helps) encryption and all that stuff that goes along with rdp and vnc that's not needed if you use something like shared memory and blit to that.
Performanc of the apps in xfe &co, for instance libraoffice or eclipse etc.... seems to be pretty good, so that's not the issue, just the graphics.
Running a Asus transformer infinity T700
my current messing arpund has been trying to get the Android NDK to compile and run on ARM, which in theory should be no problem so long as it doesn't rely on x86 machine code to do the job (which I doubt).
idky google locked down the architecture in the builds and didn't just leae it as any old gnu/linux or whatever and let the person making the build tweek any bugs, instead of having to hack googles custom build system for building the toold chain to for a specific architecture.
floowing some rough profiling
jthree2001 said:
I really like this idea and I've been looking for something like this. You said you used the "X server" android app? I'm kind of curious on the performance. Was it laggy or just that it wasn't fully what you expected?
Click to expand...
Click to collapse
Ok, I did some crude profiling using the setup
tightvncserver
xrdp
and xrdp client on android.
the major bottle neck was the rdp client on android which made my testing cpu limited since it was maxing out cpu usage. I beleive this may be due to a bug in Android on my tablet relating to non opengl es graphics..
anyhow I got some more usefull data
xrdp was typically sitting at around 40% cpu and all it's doing is taking data from tightvnc and shunting it over rdp to the client.
next on the list was the vncserver using typically less than 30% cpu.
I think this shows there is clearly a lot of overhead (based on the 40% cpu xrdp was using) of using a remote desktop protocol over sockets that should be easy to mitigate by using shared memory.
I also tried a different setup
tightvncserver
and a vnc client on android
taking rdp out of the loop
again the android client made the tests cpu limited but perforance was much better.
This VNC client is open source, so my next step is to create an opensource project and modify the VNC client so that the user input is up to scratch and look at using opengl for graphics (assuming that's where the bottle neck is) so that it's not longer cpu limited.
Once that is done (which should also failarize me with the VNC protocol and the client code).. I can look at replacing the graphics part of VNC with a shared memory buffer, but keeping the user IO over the existing VNC protocol as that makes sense...unless that also becomes a major issue.
That also leaves me some way of sending additional data back and forth without having to do it 'all' via shared memory which would be much more of a mission
in theory there shouldn't be any need for any kind of complicated mutexing between the android client and the x server sine the x server will be all but write only and the android client always read only.
on a side note,
running java linpack on android I get about 50mflops per cpu
with disk io I get about 1gig per second cached reads.
so some crude math would give me 250mega words
my screen is 1920 by 1080 (well actually 1200), but we'll call that 2k by 1k, or 2 mega words.
so a theoretical performance into the high tens of fps seems quite achievable, which is much bettern that the 5 or so tops that I'm getting atm by an order of magnitute.
having a quick poke around, mostly related to my xorg wows (that is it complaints about no tty device when starting up. it seems that it's not too difficult to get xorg running using a frame buffer driver after a few android services have been stopped. So i'm not sure if this is still needed or not.. IPC betwen gnu and android is still an interesting project.
So anyhow, I'm going to try and get xorg running properly, there are even tegra 3 drivers for xorg too, so in theory the performance should be substantially better than anything an ipc hack would be able to achieve.

[Q] Tablet ubuntu able to run edubuntu (kde etc)?

Hi all
Does anyone know if I can run kde-based software on the developer alpha of Ubuntu for tablets yet please? Not expecting reliability, just want to do some child user testing of the edubuntu suite on tablets.
Thanks
Chris
Currently you can't and probably neither in the near futur 'cause you need an X Server for that.
And there is no X server on ubuntu touch.
Huge thanks, that is really useful
Hempe said:
Currently you can't and probably neither in the near futur 'cause you need an X Server for that.
And there is no X server on ubuntu touch.
Click to expand...
Click to collapse
After some research on your reply I've a couple questions. Does it mean the Unity interface doesn't need X-server? Or are they just using a temporary workaround until X-server is implemented?
And does this apply to both Ubuntu for Android, and Ubuntu for tablets?
Huge thanks
Having done some further research I've made my decision - thanks hugely for providing the missing link in my knowledge. What follows is my best interpretation of the rumours.
Currently in place of X-server is SurfaceFlinger, ("because X-server uses 30 yr old code" - Canonical). Canonical publicly dabbled with using Wayland until mid-Feb, then decided to create their own revamped display server from scratch, called Mir, which they seem to have been working on since mid last year, and are trying to get GPU vendors to support, written to run across all devices and to meet the needs of the Unity interface, and written in Qt/QML which is what they want native apps written in.
Bottom line for me, is that the technology is still right up there in the clouds and nowhere near decided enough to base my business strategy on. Also, Ubuntu for tablets seems a pretty thin version of Ubuntu anyway, so Edubuntu was never an option and I'm unlikely to be able to leverage much from Ubuntu's Open Source libraries anyway.
Like others, (see the comment on jonobacon.org below), I find it frustrating that the wealth of code written for Ubuntu is no longer usable, but I reckon this is probably necessary to squeeze the most out of every single CPU cycle and milliamp. Ubuntu for tablet is dead in the water if it kills the battery and performs worse than the established competitors.
Therefore all indications are I need to write for Android, keeping my options as open as possible to migrate. So it is now Titanium/UnityIDE versus HTML5, particularly assessing relative performance.
http://www.omgubuntu.co.uk/2013/03/canonical-announce-custom-display-server-mir-not-wayland-not-x
http://www.jonobacon.org/2013/02/21/five-ubuntu-touch-facts/ -- not the article but the comment starting "In that case, wouldn't it be better to port existing apps instead of...."
http://www.omgubuntu.co.uk/2013/02/canonical-working-on-new-display-server
http://www.phoronix.com/scan.php?page=news_item&px=MTMwOTM
Just to clarify.
1. There are plans to make a X-Mir compatibility layer that will allow you to run programs that require an X-Server to work with mir.
2. Not all is lost at the moment it just looks that way.
Only Graphical Userinterfaces are affected. Your commandline tools and libraries don't need to be changed.
3. If you are looking for platform to write apps for, well there is worke being done to let you run your QML apps (intended for ubuntu touch) on android.
So if you choose to make QML apps they can be or will be able to run on linux, mac, windows and android
Wow, huge thanks, I missed that.
Does this mean EVERYTHING Ubuntu without a GUI will work? I want to run a NodeJS server. How likely is it that it will work perfectly now? How likely is it that it will work perfectly in the (nominally October 2013) release? (Sorry, just give me a keyword and I'll go off and do my research.)
Is Canonical planning to get X-Mir into the next ~Oct release?
My other query was whether QML on Android would perform as well. For others interested, it looks like it works directly with the Android SurfaceFlinger, bypassing the Dalvik VM, so performance should compare with native Java code.
Huge thanks once again
Chris
Sources:
http://www.youtube.com/watch?v=TEkubKZaUt8
http://victorpalau.net/2013/01/25/ubuntu-qml-todo-android-vs-ubuntu/

Very lightweight Android emulator

Sorry if this isn't the best section to be asking in, it's a big forum out there with so many boards.
I'm trying to run many instances of a certain Android app concurrently. I need either Google Play services to be available for a one-time sign in on each instance, or preferably a way to import app data to remove the need for Google Play or any other components of the Android environment besides the basic runtime needed to run the app.
I'm currently using an Android emulator (Nox) running on 640x360 at 20 fps, which is able to get me about 14 instances running on my local Windows. machine before things start crashing. The limiting factors seem to be the frequency of snapshots taken by the VMs and running low on RAM, which in turn increases CPU usage for defragmentation and page file management.
Is there any more efficient way to accomplish this task? Perhaps an x86 Android runtime with settings to reduce graphics quality? I've also looked at the Genymotion AMI on AWS but all of Amazon's VM options seem too powerful (and costly) to run my app on so many machines.
Thanks!

Interface Android application with Termux on the same device

Greetings. This is my first post; if another forum would have been more appropriate, please let me know.
My team has developed some machine learning software on Linux, mostly in Python, and mostly in the area of image and speech processing. Much of our input comes from Android devices, which exchange data with the backend server. Due to latency and other issues, we would like to look at putting our machine learning software on the Android device itself. Termux looks like an interesting solution; perhaps you know of other Linux shell apps.
My main question is: For communications between the "real" Android app, typically a Java program developed with Android Studio, and the "Linux machine" on the device, is the Linux instance treated like another system, with its own IP? Or is there a way to communicate directly between, say a camera app on the phone and the Linux instance?
btw, I am aware that Android OS is a Linux variant, so perhaps Termux is running on the same kernel?
Thanks,
Sid

Is there an Emulator which can run an app without the rest of the device?

Does something like that exist?
Of course, it would need some of the backend stuff, but I'd imagine you would just start it like a normal program without getting to see anything but the chosen app.
I'm on mostly in Windows, but Linux solutions would also be helpful.
It exist several apps that can start a specific app after emulator's Android has booted. GIYF ...
i think 'x8 sandbox' is the thing u are looking for.
x8 sandbox is good

Categories

Resources