Jump to content

Running Linux on Pro1?


Recommended Posts

Hi folks, still enjoying my phone and now want to try out more exotic things. I'm currently running LineageOS and it seems to be working smoothly enough and I have also managed to run all my annoying apps that detect root. (Yay!)

But I'm wondering, what is the best way to run linux on this phone? My intention is to be able to run programs like Godot and MonoDevelop and ideally try and install box86 and try and get x86 Steam running.

I have been trying to use Linux Deploy with Sparkle(Wayland server?) but not had much luck so far, only being able to connect via VNC.
I'm also toying with the idea of moving over to Ubuntu Touch or SailFish but I don't know if that would make my life easier or not.

So any suggestions from people that have had their phones longer? :)

Link to post
Share on other sites
1 hour ago, PokeParadox said:

I'm also toying with the idea of moving over to Ubuntu Touch or SailFish but I don't know if that would make my life easier or not.

Getting a standard Linux install running on SailfishOS is pretty easy, thanks to containers. Hardware acceleration isn't available for those containers, as far as I know, so it might not be the best solution to play games.

  • Thanks 2
Link to post
Share on other sites

As far as I know, no solution exists to get accelerated OpenGL or video decoding as there is no DRM-API to make the GPU accessible from standard Linux programs. So games or videos in the Linux chroot will always fall back to software rendering (llvmpipe) and not be much fun to watch.

Also the sparkle project you mention is just an implementation of XWayland (not Wayland) running on Android. I therefore doubt that it will give better performance or more functionality than the (actively maintained and probably more mature) XServer XSDL.

That said, many people prefer to run their X-Server inside the Linux Chroot and then connect to it from Android via VNC or RDP, as you obviously tried yourself already. While also this does not solve the problem with Direct Rendering, it is in my regard a more stable solution, as startup and shutdown of the X-Server are under control of the Chroot, and do not depend on a separate Android App (that one might e.g. close by accident, killing all X11 programs). This also yields the possibility of being able to disconnect and reconnect a Linux session permanently running in the background.

I might migrate to UbuntuTouch when that becomes officially supported (or kind-of). That may solve some of the typical problems one has with a Linux-Chroot on Android (e.g. write access to Android-controlled partitions from Chroot is not possible for me, even rooted). But for now, I also run my Debian aside of LineageOS (16).

I posted my setup in another thread on this forum. It is designed for work, but listening to music is possible. My solution does take full advantage of the Pro1's keyboard. That's an important detail if you really want to do programming on your device, and it does not work with every random "Linux-GUI" solution unfortunately ...

Edited by claude0001
  • Like 1
  • Thanks 1
Link to post
Share on other sites
On 11/28/2020 at 12:05 AM, claude0001 said:

As far as I know, no solution exists to get accelerated OpenGL or video decoding as there is no DRM-API to make the GPU accessible from standard Linux programs. So games or videos in the Linux chroot will always fall back to software rendering (llvmpipe) and not be much fun to watch.

Also the sparkle project you mention is just an implementation of XWayland (not Wayland) running on Android. I therefore doubt that it will give better performance or more functionality than the (actively maintained and probably more mature) XServer XSDL.

That said, many people prefer to run their X-Server inside the Linux Chroot and then connect to it from Android via VNC or RDP, as you obviously tried yourself already. While also this does not solve the problem with Direct Rendering, it is in my regard a more stable solution, as startup and shutdown of the X-Server are under control of the Chroot, and do not depend on a separate Android App (that one might e.g. close by accident, killing all X11 programs). This also yields the possibility of being able to disconnect and reconnect a Linux session permanently running in the background.

I might migrate to UbuntuTouch when that becomes officially supported (or kind-of). That may solve some of the typical problems one has with a Linux-Chroot on Android (e.g. write access to Android-controlled partitions from Chroot is not possible for me, even rooted). But for now, I also run my Debian aside of LineageOS (16).

I posted my setup in another thread on this forum. It is designed for work, but listening to music is possible. My solution does take full advantage of the Pro1's keyboard. That's an important detail if you really want to do programming on your device, and it does not work with every random "Linux-GUI" solution unfortunately ...

I gave up with Sparkle, I now have Debian Buster with LXDE via VNC. I see what you mean about the keyboard not really being treated properly (I can't press up to restore the last command in the terminal, etc.) I installed just using Linux Deploy. It's installed as an image file, I'd prefer it to be to be a folder but it keeps failing for some reason :/

It's working ok apart from that and I have now setup MonoDevelop and Code::Blocks. Is it possible you could clarify how you got XRDP to work as for me it is just complaining that it is in a CHROOT environment when I try to start the XRDP service.

Link to post
Share on other sites
11 hours ago, PokeParadox said:

[...] Is it possible you could clarify how you got XRDP to work as for me it is just complaining that it is in a CHROOT environment when I try to start the XRDP service.

All server startup scripts in Debian are meant for systemd. They are not expected to work in a chroot (where systemd is not around).

Just start /usr/sbin/xrdp-sesman and /usr/sbin/xrdp manually, as I do in the final lines of my chroot startup script (attached to the post). For initial debugging, it is quite useful to start them with the flag --nodaemon from an interactive session, this way you can see what actually happens as you try to connect.

Edited by claude0001
  • Like 1
  • Thanks 1
Link to post
Share on other sites
  • 4 weeks later...
On 12/2/2020 at 4:21 PM, claude0001 said:

[...] All server startup scripts in Debian are meant for systemd. They are not expected to work in a chroot (where systemd is not around). [...]

Not sure if this will still help @PokeParadox, but just in case someone stumbles upon this thread:

After reading a little bit more about chrooting modern GNU/Linux systems, I've come to the conclusion that systemd-based distributions are not very well suited for running in a traditional Unix Chroot by first principles of systemd. Although my Debian 10 was in fact doing everything I needed, I thus decided to migrate to Devuan 3 (beowulf), a  distribution derived from (and almost identical to) Debian 10, but not depending on systemd.

As a result, my system feels much more solid now: In contrast to upstream Debian, the traditional (SysV) server init-scripts of Devuan can actually be used in the Chroot, so you can do things like

sudo service ssh [start|stop|status]

and it will just work. Also, Devuan provides a chroot-compatible logind (elogind), so one can start a working system D-BUS session using

# service elogind start
# service dbus start 

in the Chroot startup script, which was not possible with my previous Debian 10.

P.S.: I do not want to start a war over init systems here (which can happen quite easily in the Linux community). I do use upstream Debian (with systemd) on all my PCs and laptops, and usually do not care about the init system much. I just came to realise that, in the specific use-case of running GNU/Linux in an Android Chroot, the architecture of systemd comes with disadvantages I had not been aware of before.

Edited by claude0001
  • Like 2
  • Thanks 2
Link to post
Share on other sites
  • 3 months later...

Update: I can now run the X.org X11 server inside my Devuan chroot. Yes, the real thing, not TigerVNC or TightVNC.

The nice thing with X.org is that I can use it with xorgxrdp in the chroot and connect to my Linux distro via a much better-performing (native) RDP connection as compared to using VNC as backend for XRDP. I still use the Microsoft Remote Desktop 8 App combined with the default xrdp-0.9.9 shipping with Devuan 3/Debian 10.

As far as I can see, one can find no information on how to do this on the internet. Either it is really tricky and I am a genius, or no one cares about it ... difficult to say. 🙂

So, how to do it? The critical point with the xorgxrdp module for X.org is that it absolutely requires System-V-style shared-memory access. The Android Linux kernel does not provide that, as Google invented their own implentation of shared memory (/dev/ashmem) long ago.

So, the first step is to bind-mount /dev/ashmem to your Linux chroot, by having something like this in your chroot setup script (of course this requires root-access to your phone):

# Script to set up the Debian/Devuan chroot environment on boot of LineageOS
export ROOT=/data/DEBIAN
[...]
mount -o bind /dev/ashmem $ROOT/dev/ashmem
[...]

Having /dev/ashmem available to your Linux distribution is not enough, though, as GNU/Linux shared-memory calls are not compatible with that interface out-of-the-box. Luckily, some awesome people have made android-shmem, a library translating Sys-V-shared-memory-calls to Android-shared-memory-calls. You need to compile that library inside your chroot and then preload it previously to running any program depending on Sys-V-style shared memory, as explained on the GitHub page.

For xorgxrdp to work, one needs two things:

XRDP needs to be started with android-shmem preloaded. In Devuan 3, I do this by having the following edit in "/etc/rc5.d/S12xrdp":

[...]
# enable Sys-V shared memory access on Android kernel
export LD_PRELOAD="/usr/local/bin/libandroid-shmem-aarch64.so" 
[...]

X.org must be started via a wrapper script, also preloading the android-shmem library:

#!/bin/bash
#
# Wrapper script for Xorg when called from XRDP.
# Makes sure the 'android-shmem' library is preloaded before execution so that
# SYS-V-style shared memory calls will work on Android kernel. 
#
origparams="[email protected]"
exec env LD_PRELOAD="/usr/local/bin/libandroid-shmem-aarch64.so" /usr/lib/xorg/Xorg $origparams

On Debian/Devuan, most likely, you will want to configure /etc/xrdp/sesman.ini to lauch that wrapper script instead of X.org directly.

Attachment: MS Remote Desktop showing an xorgxrdp session on my Pro1 with a youtube browser window (with audio streaming via XRDP) and a simultaneous glxgears benchmark.  

 

 

Screenshot_20210401-222141_Microsoft_Remote_Desktop.png

Edited by claude0001
  • Like 1
  • Thanks 7
Link to post
Share on other sites

@claude0001

I must say, this look awesome (in my opinion) but as beginner in linux (small bash script, command line and vim basis, little ssh server with raspbian) it's not really easy what you have done.
I give up with some linux-in-android apps as it doesn't work and surely I have not the level in linux knowhow, but making a Debian working on pro1 would be so great.

This is the problem : I can't ask you for a noob tutorial, I guess your time is precious.
But I don't know how attacking the problem yet...Any advice will be much appreciate in order to get on the way. Whatever thank you so much for the share ! 

  • Like 2
Link to post
Share on other sites
3 hours ago, raymo said:

This is the problem : I can't ask you for a noob tutorial, I guess your time is precious.
But I don't know how attacking the problem yet...Any advice will be much appreciate in order to get on the way. Whatever thank you so much for the share !

If you just want to run a few Linux programs, something like Termux and AnLinux is definitely the easiest way to start. I have never used those Apps, though, so I cannot help with specific questions about them.

For advanced stuff, like the above, a "hand-made" chroot (with root access to Android/Lineage) will probably always be superior to (non-root) in-App solutions.

Setting up your own Linux chroot on Android is actually not that hard provided you have some experience with Linux. The real problem is that the required information is scattered all over the internet. Also, some things change with every Android/Lineage release, so How-To's from a few years ago may no longer be fully applicable today. I included a few useful links as well as my chroot autostart script in a previous post about my set-up. However, much information about fine-tuning I did is not in there, either.

For these reasons, I actually did plan to make a tutorial at some point -- also as a guide to myself should I ever need to reinstall. Once I have written things up, I will post a link here.

Edited by claude0001
  • Like 2
  • Thanks 2
Link to post
Share on other sites
1 hour ago, claude0001 said:

The real problem is that the required information is scattered all over the internet.

That's it, i'm always lost. However I learn something in every links, but it's like a puzzle and I'm not experimented, all pieces of this puzzle are a new point to focus, interesting, but not for clarity 😄...

1 hour ago, claude0001 said:

Once I have written things up, I will post a link here.

I bought this phone for 3 reasons :

-keyboard, of course

-Android alternative like LineageOS or something else (I hate android, so intrusive...)

-Community.

So much appreciate, and once again many thanks !

  • Like 2
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms