- How to Install and Run a GNU/Linux OS on Your Android Device
- GNU/Linux Setup on Android
- How To Install GNU/Linux on Android Device
- Installing Linux Applications on Android
- [Guide] Running Linux on Android with 3D Acceleration / OpenGL (Root Required)
- Breadcrumb
- HolyChickenGuy
- Hentacler
- LedBass
- MishaalRahman
- NKS1608
- Richard177
- diejuse
- flunkyball
- saad maqsood
- flunkyball
- diejuse
- mr.knr
- pierro78
- zanfix
- pierro78
- zanfix
- pierro78
- Can Linux apps be run in Android?
- 15 Answers 15
How to Install and Run a GNU/Linux OS on Your Android Device
Installing a GNU/Linux environment on your android device can enhance and increase its productivity. Although the Android OS runs on the same Kernel as GNU/Linux, the two Operating systems run on different programs.
A common caveat of android apps is that they are sometimes more limited when compared to desktop apps for example, and one way to get around that is installing a GNU/Linux environment, which can be applicable on rooted or non-rooted devices. This guide assumes a non-rooted device is being used.
GNU/Linux Setup on Android
To Set up a GNU/Linux environment you will need to download GNURoot Debian and Xserver XSDL followed by applicable Linux commands to complete the process.
GNURoot allows you to create a Linux environment within a host OS. Normally you would need Linux’s “Chroot” functionality to do this however, GNURoot uses “proot” a software that allows you to achieve the same function without proot privileges.
The purpose of Xserver XSDL, is to provide an application that GNURoot connects to. An X server is needed to run software that is heavy on graphics.
Xserver XDSL provides options for customizing things like display resolution.
How To Install GNU/Linux on Android Device
1. Search and Install GNURoot Debian and Xserver XSDL from the Playstore.
2. After the download is completed run GNURoot Debian, however watch-out for a “root” shell, which is a fake root shell running in Andriod application sandbox, so ignore it.
Linux Shell on Android
3. To ensure you have the most recent upgrades run “apt-get update and apt-get upgrade”. You will need Apt-get to install software in a Debian/Ubunu Linux environment.
4. The next step is to install a graphical environment. You can do this by running “apt-get install lxde” for the environment with all the tools, alternatively you can run “apt-get install lxde-core” for just the desktop environment.
5. What is left now is a way to provide access to the terminal when in a graphical environment, a software called XTerm is used for this.
Finally you will need Synaptic Package Manager as a front-end to apt-get drivers for audio play back with Pulseaudio.
6. As a final step start xServer XSDL and download all fonts then go back to GNURoot to run these commands:
After this, revert back to XServer XSDL and wait for the LXDE desktop.
Running LXDE Desktop on Android
Installing Linux Applications on Android
Now that you have Debian Linux on your Android device you will need apps to enjoy it fully. To access the large repository of Linux apps use the Synaptic Package Manager previously installed.
Access Run from the start menu and type in “synaptic”. Press the search button when the Synaptic Package Manager opens and key in the name of the app you are looking for then mark it for installation.
Synaptic Package Manager
With your apps installed, you are finally good to go! Remember however, that because this is a Linux environment running within Android, it will not run as seamlessly as you would expect from the whole Linux package, some apps may not run at all. Also, android apps do not necessarily work differently within a Linux environment so don’t expect more than the usually from your android apps either.
It is also important to remember that some games will not work especially those requiring hardware acceleration But all in all, most apps and simple games will work just fine!
We hope you find this guide easy to follow, let us know if you have any comments, tips or suggestions or simply to let us know you successfully installed Linux on your Android device with these guidelines!
Источник
[Guide] Running Linux on Android with 3D Acceleration / OpenGL (Root Required)
Breadcrumb
HolyChickenGuy
Senior Member
Now on to the tutorial!
Now you have all those apps installed lets continue
Open Termux then enter:
Open Linux Deploy and configure it to your likings
And im not gonna tell you my password
After you’ve set up your configuration scroll down and configure init, mounts and ssh
Now you’ve set this all up go back to the main overview screen of Linux Deploy, hit the tripple dot menu and install!
After the install is done, hit START
Now open Termux and install SSH:
Now open Sparkle and click «edit user.sh» and delete everything then hit «save», Go back to the main screen of Sparkle and hit «Start», you should see a notification appear in your status bar
Now to start everything go back to Termux and assuming you’re still SSH’ed into Linux type:
If you want everything to automatically start when pressing «START» in Linux Deploy than you can configure this
Open Termux and connect to Linux via SSH and change the permissions/edit the rc.local file: (edit username to the username set in Linux Deploy)
Now every time you want to use Linux just open Sparkle, hit «Start», then go to Linux Deploy and start linux and your DE will automatically load up on your screen without entering a single command!
Hentacler
Member
LedBass
New member
What version of Sparkle did you use? I’ve tried this tutorial here but received an error of wayland-0 not found when I try to run my linux installation on my device
I’ve looked in the folder /data/data/com.sion.sparkle/files and this folder is empty
Thanks for the tutorial!
MishaalRahman
Editor in Chief
NKS1608
Member
I managed to use it, but with xfce KDE had a black screen, and I couldn’t use the audio even though I made the alsa plugin, and it doesn’t rotate the screen, but it’s very good.
Richard177
Member
diejuse
Member
flunkyball
Senior Member
@HolyChickenGuy
Thanks for the well done tutorial ! I followed it and it worked out of the box.
However, two issues I came accross to which I did not find the solution, yet:
1. Is there a way to rotate the screen ?
2. How can I bring the X-window to the second screen connected via USB->HDMI adapter ? I tried to set DISPLAY:1 but 1 was not found and :0 is the devices screen.
Cheers mate and keep up the good work.
saad maqsood
Member
You can Also use Termux Desktop
Termux desktop is much faster and easier to use and you can experience a complete Linux GUI with termux, and it Is also lightwight.
flunkyball
Senior Member
The described way basically is using Termux the way you propose. However it adds the 3D acceleration by using sparkle which is definitely a plus.
———- Post added at 09:49 PM ———- Previous post was at 09:47 PM ———-
@HolyChickenGuy
Thanks for the well done tutorial ! I followed it and it worked out of the box.
However, two issues I came accross to which I did not find the solution, yet:
1. Is there a way to rotate the screen ?
2. How can I bring the X-window to the second screen connected via USB->HDMI adapter ? I tried to set DISPLAY:1 but 1 was not found and :0 is the devices screen.
Cheers mate and keep up the good work.
diejuse
Member
mr.knr
Member
but what if i want to install LXQt on my device
#!/bin/bash
set -e
sudo chmod 777 /sparkle
sudo chmod 777 /sparkle/wayland-0
XDG_RUNTIME_DIR=/sparkle Xwayland &
sleep 1
export DISPLAY=:0
startplasma-x11
what should i change in the script.
pierro78
Senior Member
sorry for the probably dumb question but Xsdl seems to work work quite well in my use cases (like watching youtube videos in 360p on my Samsung Tab S5e) .
. so I am wondering : what are the advantages of Sparkle/Wayland over Xsdl ?? . will my youtube videos be smoother ??
. does Sparkle/Wayland has better touch support than Xsdl ?? . for example can you scroll a web browser window by touching inside the window (not the scrollbar) with your finger ??
zanfix
Member
sorry for the probably dumb question but Xsdl seems to work work quite well in my use cases (like watching youtube videos in 360p on my Samsung Tab S5e) .
. so I am wondering : what are the advantages of Sparkle/Wayland over Xsdl ?? . will my youtube videos be smoother ??
. does Sparkle/Wayland has better touch support than Xsdl ?? . for example can you scroll a web browser window by touching inside the window (not the scrollbar) with your finger ??
pierro78
Senior Member
wow 1080 ! that would be awesome ! thanks for the info !!
actually 360p is not so smooth on my S5e without android-shmem library .
if I understand correctly I just have to compile that in my chroot and then the shared memory feature is already supported in the Xserver xsdl that I installed from the playstore ??
zanfix
Member
wow 1080 ! that would be awesome ! thanks for the info !!
actually 360p is not so smooth on my S5e without android-shmem library .
if I understand correctly I just have to compile that in my chroot and then the shared memory feature is already supported in the Xserver xsdl that I installed from the playstore ??
android-shmem library can give you a performance boost if the application you are running can use the x server MIT-SHM extension
For video playback in a web browser, firefox-esr for example, the android-shm library will not give you any performance gain.
Since there is no hardware acceleration in xsdl, In order to put the minimum possible load on the cpu you should match the screen resolution of the xserver with the target max resolution of the videos you are planning to playback.
My tab s6 has 2560×1600 native resolution, i run the xserver at 1920×1200 so I keep the aspect ratio of the screen but match the clip (tube video) native resolution (so that no rescaling will happen)
I can get acceptable youtube video playback also on my old pixelc c, that has a quadcore a57
pierro78
Senior Member
well I don’t know what I did wrong previously . my youtube videos seem to play nice on 1080 in Xserver xsdl with arm64 vivaldi in my chroot (Tab S5e) with or without
env LD_PRELOAD=»/home/pierro78/android-shmem/libandroid-shmem-aarch64.so» icewm&
now !
and I don’t see any difference with or without LD_PRELOAD=»/home/pierro78/android-shmem/libandroid-shmem-aarch64.so» in vivaldi although it may support x server MIT-SHM extension as you said ??
also I have errors when using /home/pierro78/android-shmem/libandroid-shmem-aarch64.so when I start icewm (same errors if regular user or root) :
[email protected]:/home/pierro78# icewm&
[1] 8527
[email protected]:/home/pierro78# Failed to connect to session manager: Failed to connect to the session manager: SESSION_MANAGER environment variable not defined
shmget: key 0 size 4096 flags 01600 (flags are ignored)
shmget: bound UNIX socket /dev/shm/00002157
listening_thread: thread started
shmget: ID 0 shmid 21570001 FD 7 size 4096
shmat: shmid 21570001 shmaddr (nil) shmflg 0
shmat: mapped addr 0x735094b000 for FD 7 ID 0
shm_remove: deleting shmid 21570001
shm_remove: shmid 21570001 is still mapped to addr 0x735094b000, it will be deleted on shmdt() call
shmdt: unmapped addr 0x735094b000 for FD 7 ID 0 shmid 21570001
shmdt: deleting shmid 21570001
and when I start vivaldi as regular user :
shmctl: cmd 3 not implemented yet!
shmget: key 0 size 2946039 flags 01606 (flags are ignored)
shmget: cannot bind UNIX socket, bailing out
[7437:7437:0426/232122.758794:ERROR:CONSOLE(0)] «Unchecked runtime.lastError: The message port closed before a response was received.», source: chrome-extension://mpognobbkildjkofajifpdfhcoklimli/browser.html (0)
shmget: key 0 size 112140 flags 01606 (flags are ignored)
shmget: cannot bind UNIX socket, bailing out
shmget: key 0 size 368460 flags 01606 (flags are ignored)
shmget: cannot bind UNIX socket, bailing out
or if I start vivaldi as root user :
shmctl: cmd 3 not implemented yet!
shmget: key 0 size 2831220 flags 01606 (flags are ignored)
shmget: bound UNIX socket /dev/shm/00001f6e
shmget: ID 0 shmid 1f6e0001 FD 36 size 2834432
shmat: shmid 1f6e0001 shmaddr (nil) shmflg 0
shmat: mapped addr 0x71b6582000 for FD 36 ID 0
shm_remove: deleting shmid 1f6e0001
shm_remove: shmid 1f6e0001 is still mapped to addr 0x71b6582000, it will be deleted on shmdt() call
shmdt: unmapped addr 0x71b6582000 for FD 36 ID 0 shmid 1f6e0001
shmdt: deleting shmid 1f6e0001
listening_thread: thread started
[7990:7990:0426/232440.532571:ERROR:CONSOLE(0)] «Unchecked runtime.lastError: The message port closed before a response was received.», source: chrome-extension://mpognobbkildjkofajifpdfhcoklimli/browser.html (0)
I am not sure how to check if my libandroid-shmem-aarch64.so is working ??
I would expect some «files» in /dev/shm but there is nothing there .
Источник
Can Linux apps be run in Android?
Android is based on Linux; can native Linux applications be run on Android?
15 Answers 15
In general, no. Android apps generally run in a sandboxed Java-like virtual machine, so have to be written in Java or some language that compiles to virtual-machine bytecode that use the Android API.
However, the virtual machine does run on top of the underlying Linux OS, and there are ways to call native code. See https://developer.android.com/tools/sdk/ndk/index.html
So, while it is technically possible to run native Linux programs, as there is a Linux kernel running beneath everything, most users would not be able to install such applications or use them. (If you have root access or are building your own firmware, then you can do whatever you want.)
Yes you can. I have installed a complete Debian distribution in a chroot-jail enviroment using debootstrap. (You need a rooted device) I am now running ssh, apache, mysql, php and even a samba server under android on my htc-desire with no problems. It is possible to run x applications using a remote x server via ssh. It even runs openoffice.org and firefox. You can use this: http://code.google.com/p/android-xserver/ to run X-application on localhost but my HTC-desire has a to small screen to be productive 🙂 But it might be usefull on a Eee Pad Transformer or something like that.
Android does not run X Windows, nor does it have many of the standard GNU libraries. So, since most native linux applications require one or both of these, most will not run.
In addition, even Java programs can be limited, because the version of Java that Android applications are written in is a subset of the standard Java library.
Not directly, no. Android’s C runtime library, bionic, is not binary compatible with the GNU libc, which most Linux distributions use.
You can always try to recompile your binaries for Android and pray.
The old link is dead it was for a Debian install script There is an app for that in the android market but you will need root
android only use linux kernel, that means the GNU tool chain like gcc as are not implemented in android, so if you want run a linux app in android, you need recompile it with google’s tool chain( NDK ).
I think this article can provide a solution : Linux Today — Compile, Install and Run Linux apps on Android
Hope it helps.
You can get an ARM cross compiler that runs on Linux here. You can also download the Android NDK and compile some command line apps. I do not have any personal experience with using C++ with either solution, but I have compiled a few simple things with both. It is my understanding that the NDK is not a full C++ compiler as there have been complaints that it will not compile some common C++ code.
Note that since I am a new user, I cannot post the NDK link. :/
yes i have done that on several rooted machines i set a debian linux on a sdcard by dd. i copy this script http://jeanmichel.gens.free.fr/etc/install on /system/bin
i have not yet succeed to run a Xserver but i can use xwindows binaries through the android Xserver application
i can run update my debian with apt-get upgrade , run an apache server with PHP , run a ssh server and all binaries on a terminal including user management i have also a problem with semaphores handling please contact me if you have any trouble
Yes they can if they’re compiled under an arm linux first or using a cross compiler. Debian arm versatile works, there’s also arm-eabi for compiling under x86 linux to arm linux.
Yes, they can. If you do not have a rooted phone/tablet, then you could download c4droid here to compile your apps. Then, you could download Kevin Boone’s KBOX here to run the program.
Hell, of course yes, with several limitations.
Android is a kinda special Linux distribution, with no usual suff like X11, and you can’t install Apache2 with apt-get. But if you have ARM cross-compiler, you can copy your ELF files to the device, and run it from a terminal app or if you have installed some SSHD app, you can even use SSH from your desktop/notebook to access the Android device.
To copy and launch a native Linux executable, you have not root your device. That’s the point, where I am, I’ve compiled my own tiny webserver to Android (and also for webOS), it runs, hallelujah.
There comes the issues, which I can’t answer:
My tiny webserver use only stdlib and pthreads. I have no idea how to use the (native Linux) libraries comes with Android, there are useful ones, altough, I can live without them.
Now I can launch my app from a terminal app by hand. But I don’t know, what’s the best way of deploying such native apps to Android. I think I should be write a small Android app, which launches the server and not letting automatically stopped by the system (say, as like music players never killed). Also, if its a service, it should somehow started on boot. I’m not familiar with Android.
Short answer, no. Long answer, you can run Linux application if you install some software.
To avoid rooting your device, you can try the GnuRoot and XSDL combo to get a minimal chrooted environment, (Actually, it use proot to enable a rootless chrooted jail), or get the Debian Noroot application, which combine the former two application in a single virtual machine environment. Both can be fetch from Google Play.
However, there is a few drawbacks: first, the X11 Server bundled by XSDL and DNR is a compatibility layer wrapped around a Android port of SDL library and SurfaceFlinger. This means, hardware accelerated OpenGL graphics are not avaliable, and even the sound support requires some hacks. So, the author choose a simple Desktop Environment: XFCE4 suitable to low memmory and no 3D support. The second problem is the incompatibility from the DNR Virtual Machine of direct hardware acess, since it requires real root privileges. So you can’t burn DVD, print using USB cables. even the author’s projects may promise a workaround in a future. Finally, this solution enables to install user-space programs like LibreOffice, Gimp, Samba. not kernel-space modules.
Even with this limitations, the DNR is a very powerfull program.
Источник