yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] tillum:
[MENTION=9758079]Hentacler[/MENTION] & [MENTION=9312173]robsmith11[/MENTION]

Well, I've rooted my Samsung Note 10+, still using the standard system on Android Q, just rooted with Magisk. Loving it. Getting this going however has proved problematic...

I'm open to suggestions. I've tried robsmith11's suggestion for running this with termux & archlinux. I seem to keep running into the same issue - permissions. I can symlink /data/data/com.sion.sparkle/files to another directory (have tried /tmp as well as /data/data/com.termux/files/arch/sparkle), however in the arch chroot I'm not able to access it.

$ export XDG_RUNTIME_DIR=/data/data/com.sion.sparkle/files

$ Xwayland

Output:

_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root

glamor: No eglstream capable devices found

could not connect to wayland server

(EE)

Fatal server error:

(EE) Couldn't add screen

(EE)

Any ideas?

Using bind (-b switch) in the initial proot command with startarch doesn't seem to work. I haven't found a reliable way to disable SElinux - open to workarounds. I'm happy to give sparkle root permissions, however seems this isn't possible without the app directly asking for them. Also not sure this would help. The issue (currently) seems that my archlinux chroot is unable to gain access to the sparkle files. Surely there's some way around this now I have a rooted device. Do you have any suggestions?

[MENTION=9758079]Hentacler[/MENTION] I'm not super paying attention to capta's, however it seems I'm only asked occasionally for one. I think as I've made numerous posts before and in the past been a driver for projects, my tag is set to 'Senior'. Not sure what other advice I have unfortunately, but I do hope you stick around.

---------- Post added at 08:27 AM ---------- Previous post was at 08:27 AM ----------

[MENTION=9758079]Hentacler[/MENTION] How are you running your linux in chroot? Interested in other approaches. Are you using a different terminal emulator for it? Do you use proot?
[Android Apps and Games] Hentacler:
In new versions of android, APKs can't access files of other APKs. There are workarounds implying using root rights and changing SELinux context on files... But I am a bit tired of all these android's new security improvements. I am officially done with attempts to support non-rooted devices and applications like termux.

But if you have root, you don't need to use termux or proot. You can use regular chroot:

1. Get minimal rootfs archive for any distribution that supports ARM: fedora, debian, ubuntu, arch linux, alpine linux etc.

2. Unpack it anywhere on your device: to sdcard partition (formatted in ext4), loop image file (also needs to be formatted in ext4), of even directly to internal memory (somewhere like /data/local/tmp/mydistro). Anywhere. Just make sure filesystem supports linux permissions. Loop file placed on sd card is good start.

3. Mount (if you need) your loop file or partition. Mount dev, proc, dev/pts, sys, tmp.

4. Chroot there.

Now you can start openssh server or use most linux console applications.

If you need graphical applications and/or audio, you can use sparkle. Or VNC.

Sorry for not giving more detailed instructions on using chroot.

Re terminal emulator: Sometimes I use ConnectBot's "local" mode. It works like terminal.

But most often I start sparkle and use xterm. Or use adb shell from PC. Or SSH client from PC via wi-fi. If you have SSH server running on your phone, you can even upload music to it via wi-fi. Or use rsync to syncronize music dir with PC. Or anything you can imagine :D
[Android Apps and Games] tillum:
[MENTION=9758079]Hentacler[/MENTION] Thanks mate, will give it a go. I'm taking it as a personal challenge to see if I can install arch on a chroot myself - will let you know how I go. I'm still keen to keep working to get Sparkle working with Termux - any directions you could point me in would be awesome. Otherwise, I'll keep hacking away at a full chroot. Cheers.
[Android Apps and Games] Hentacler:
Uff... Directions... Are you sure you can't disable SELinux like this? ("su" is ised to switch to root)

su
setenforce 0

If you can't, you may need to learn few things about SELinux:

1. SELinux makes decisions based on so-called contexts. Files, directories and processes may have context. You can check context with command like this

su
ls -Z /data/data/com.sion.sparkle/files
ps -Z

Check context on termux's dir and on sparkle's dir. In old good times contexts was the same. But on newer devices every app has its own context.

2. Access deniels are logged. Check your

logcat

Entries are something like "app with context AAA tried to access file with context BBB. There is no policy to allow such access. DENIED!!!"

3. In android its hard to change policies, but if you have root, you can change contexts. You give sparkle's files the same context as on termux's files.

4. ... But this is hard... For start, you can take some terminal emulator (like ConnectBot in local mode) and try to make sparkle's directory (/data/data/com.sion.sparkle/) accessible for it without root.
[Android Apps and Games] robsmith11:
I forgot to mention that I also run the following command as root while mounting everything for the chroot. (tmp is in the chroot directory and mounted as tmpfs):

chcon u:object_r:app_data_file:s0 tmp
[Android Apps and Games] tillum:
Getting closer! Thanks so much for both of your help.

I have been able to temporarily disable selinux by running setenforce 0 as root. I can then bind mount sparkles file directory, thus gaining access them in the termux chroot. Using robsmith11's script however (with xfce4 instead) gives me this:

_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root

glamor: No eglstream capable devices found

glamor: 'wl_drm' not supported

Missing Wayland requirements for glamor GBM backend

Missing Wayland requirements for glamor EGLStream backend

Failed to initialize glamor, falling back to sw

(EE)

Fatal server error:

(EE) failed to create screen resources(EE)

/usr/bin/startxfce4: X server already running on display :0

xrdb: Connection refused

xrdb: Can't open display ':0'

Failed to connect to bus: No such file or directory

dbus-update-activation-environment: error: unable to connect to D-Bus: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead

Unable to init server: Could not connect: Connection refused

xfce4-session: Cannot open display: .

Any ideas?
[Android Apps and Games] robsmith11:
Are you able to start something simple like xterm without any window manager running?

The error seems like it is specific to xfce4, maybe related to dbus.
[Android Apps and Games] tillum:
I don't think its specific to xfce4. Here's the output after trying to run xterm:

_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root

glamor: No eglstream capable devices found

glamor: 'wl_drm' not supported

Missing Wayland requirements for glamor GBM backend

Missing Wayland requirements for glamor EGLStream backend

Failed to initialize glamor, falling back to sw

(EE)

Fatal server error:

(EE) failed to create screen resources(EE)

xterm: Xt error: Can't open display: :0
[Android Apps and Games] tillum:
I finally have it working!! In the end I needed to create another archlinux install with termux - still haven't gotten it working in my original install. Here were my steps:

1. Root my device

2. Install archlinux in termux

3. As root in termux, run

setenforce 0

4. In archlinux, install weston, xorg-server-xwayland, and xfce4

5. Start sparkle in android

6. In archlinux, run rodsmith11's script:

#!/bin/bash
set -e
mkdir -p /tmp/sparkle
ln -s /data/data/com.sion.sparkle/files/wayland-0 /tmp/sparkle/wayland-0 || echo 'exists'
XDG_RUNTIME_DIR=/tmp/sparkle Xwayland &
sleep 1
export DISPLAY=:0
startxfce4

setenforce 0 needs to be run every time I reboot, or after returning it to normal with setenforce 1

I have yet to try it on an external monitor, and the resolution is very small. Have tried changing the dpi in setting.lua within sparkle, and while this works for text, the screen resolutuon is still tiny. How do I edit this?

Thanks again for your hard work getting this running!
[Android Apps and Games] tillum:
After some more testing, have found this is awesome! Much smoother and faster than Xserver XSDL. Resolution is fine on my monitor. I'm having issues with only having a left mouse click however - how do I configure this to support a right mouse click? [MENTION=9758079]Hentacler[/MENTION] - any luck here?
[Android Apps and Games] Hentacler:
If you have no mouse (bluetooth or usb), you can use volume_down+touch to perform right click. Volume_up is used to summon on-screen keyboard.

If you have mouse, right click and wheel are supposed to work. We can investigate if RMB doesn't work for you. In this case you will have to try special debug version that will produce a lot of output.

Re termux: I prefer full PC distributions like Debian or Fedora.

...Captcha again... DIE, DIE, DIE
[Android Apps and Games] tillum:
[MENTION=9758079]Hentacler[/MENTION] I'm using a mouse. Left click works, but mouse scroll and right click don't. They work fine in android, just not in sparkle. Would love to debug this - what do I need to do?

---------- Post added at 07:02 AM ---------- Previous post was at 07:01 AM ----------

@robsmith11 - did you get a mouse working with right click in sparkle with wayland?
[Android Apps and Games] robsmith11:
[MENTION=2122740]tillum[/MENTION]

it's not a mouse, but my bluetooth keyboard has a track point and three buttons (left, middle, and right click) that all worked properly without any changes. It doesn't have a scroll wheel, so not sure if that's working.
[Android Apps and Games] tillum:
That sounds like a good workaround. I'm typing this on a logitech bluetooth keyboard (works fine), and using a logitech bluetooth mouse. Only left click work - no scroll or right click. I'm able to get right click working by left clicking while holding the volume down key on my phone... clunky. Would be awesome if I can figure out how to get the mouse working properly, or at least remap a workaround through the keyboard.

Xfce4 works awesome, and everything is much faster (as would be expected). Scribus now works, as does gimp and inkscape. Have been having a play around with Enlightenment (E17 desktop), and all the compositing effects work - lots of eye candy. Using Xfce4 as my workhorse currently however.
[Android Apps and Games] AtzeMatze:
Ok so this works great with Xfce, but I really wanna get native Sway to work. Anyone got an idea how to accomplish that?
[Android Apps and Games] zanfix:
Hi all,

I tried this on my tablet, android N, LOS14.1. debian stretch chroot.

starting Xwayland as non root gives me the following output:

zanf@localhost:~$ XDG_RUNTIME_DIR=/tmp/sparkle Xwayland :1 -noreset

Disabling glamor and dri3, EGL setup failed

Failed to initialize glamor, falling back to sw

(EE)

Fatal server error:

(EE) failed to create screen resources(EE)

zanf@localhost:~$

note: on screen 0 i have an X server running...

however

running it from root i get that the sparkle app will come to foreground, and the controlling terminal will output:

root@localhost:/home/zanf# XDG_RUNTIME_DIR=/tmp/sparkle Xwayland :1 -noreset

Disabling glamor and dri3, EGL setup failed

Failed to initialize glamor, falling back to sw

(running...)

At this point,. from another terminal, i try to run a simple program as xclock or xeyes:

zanf@localhost:~$ su

Password:

root@localhost:/home/zanf# DISPLAY=:1 xeyes

and i get the program to run in sparkle (i see the eyes :) )

Now my question is: why will it not run as non root user?

My chroot environment will set selinux to permissive on startup (the tablet is rooted...)

Any advice from someone with experience on the subject?
[Android Apps and Games] Hentacler:
No idea. But you may want to check:

1. tmpfs is mounted over your debian's /tmp (very important for those who don't trust sparkle to run it's user.sh script as root)

2. normal user has r+w access to /tmp and to /tmp/sparkle

3. normal user has access to /data/data/com.sion.sparkle/files/ or something.
[Android Apps and Games] zanfix:
Hi,

so ok... my /tmp/sparke had wrong permissions... fixed that.

I also mounted /tmp as tmpfs.

Now i'm able to run xeyes as non root user. I also tried xterm and that runs too.

I then tried running xfce with startxfce but that will not work. During loading Xwayland will crash with the following output:

zanf@localhost:~$ XDG_RUNTIME_DIR=/tmp/sparkle Xwayland :1 -noreset

_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.

Disabling glamor and dri3, EGL setup failed

Failed to initialize glamor, falling back to sw

(... is running at this point ...then)

*** stack smashing detected ***: Xwayland terminated

Aborted (core dumped)

zanf@localhost:~$

Same thing happens when I try anything else than simple test programs (as xeyes, xclock or xterm)

Any ideas?

---------- Post added at 04:38 AM ---------- Previous post was at 04:03 AM ----------

Ok i figured it out...

the library libandroid-shmem.so (used by Xsdl) that was preloaded was giving me the problem...

Xfce now starts...

:good:
[Android Apps and Games] yule dee:
please continue.

I think this is interesting:o
[Android Apps and Games] zanfix:
Well, Is there a way to go full screen/immersive mode?

I must say that video performance is much better that Xsdl! i changed the resolution of the display in android from native 2560x1600 (my tablet) to 1920x1350 (keeping aspect ratio) and it gets even better.

m6502 screensaver will output 70fps on my galaxy s9+ (xsdl ~30fps)

I tried enabling expanded desktop in android to get rid of the status bar and navigation bar but something goes wrong: the actual screen area becomes 1920x1238, so i end up with a black bar on the bottom of the screen and touch inputs are offset in Y respect to the screen, probably by 112 pixels, not sure, may be the actual height of the navigation bar?!

In samsung dex this does not happen... but the DEX taskbar is in the way at the bottom of the monitor... annoying

I also noticed that pressing SHIFT and arrow keys into a text editor will do something wrong (instead of selecting the text):

- SHIFT+LEFT arrow will output character '4'

- SHIFT+RIGHT arrow will output character '6'

- SHIFT+UP arrow will output character '8'

- SHIFT+DOWN arrow will output character '2'

This is strange because these are the keys corresponding to the arrow keys on a numeric keypad... ?!

I can reproduce this on two different devices so I assume it's the app fault and not the devices...

On samsung dex the right mouse button and mouse wheel will not work as mentioned by somebody before... using plain screen mirroring on the same device will make the problem disappear

On my tablet (pixelc with LOS14.1) while playing a video on youtube or vlc it happens that the video (or video output overall, can not say) will briefly pause and at that point audio will be badly out of sync.

Should the sound have good low latency? because it seems to me that some latency is there anyway... must test further

Other than these issues i'm having right now it's very good... :good::good::good:

Any advice?
[Android Apps and Games] Hentacler:
Immersive mode is easy to implement, but initially I was planning to make sparkle support not just Xwayland as client, but also any other wayland clients. I wanted non-fullscreen windows appear just on top of android. And it works to some degree... For Qt applications for example. You can run them without X11. Or not. Didn't test for year.

Directional keys are mapped to numpad keys indeed. This problem is very old (dating back to my very first attempts to make video output app). I barely remember why I did so. I believe that mapping them right didn't work for some distributions. Need to test again probably.

Mouse buttons and wheel works for me (with bluetooth mouse). If I want to fix it for some other device, I need either to have such device + 20 minutes or a lot of help from someone with such device (running debug versions, sending logs etc). This may take many hours.

The sound output... Sparkle provides ALSA interface for sound output. If I use ALSA directly (see mpv config below), I don't remember having any noticeable latency. But most applications use pulseaudio. On PC it works this way: application -> pulse -> alsa. Same for sparkle. But if pulse is used with sparkle's ALSA, latency appears.

Here is mpv player config (~/.config/mpv/mpv.conf) i used to test audio:

vo=x11
ao=alsa
sws-scaler=fast-bilinear

First options tells to use x11 video output. By PC standards it is legacy and not recommended mode, but for sparkle is is best we can get.

Second option is used to force ALSA audio output (no pulse).

Third option is... Well... For ARM processors scaling video (e.g. to make in fullscreen) is mega slow (high cpu load). Ideally, video should be scaled by hardware (gpu). Inability to use hardware scaling is one of the main reasons why x11 output is deprecated on PC. But we really have no choice and can only use slow software scaling. This option sets fastest software scaling algorithm available. Without this option my old (really old) handheld can't play 720p video if its scaled. But it can if we set this.

Btw, mpv can also be used to play youtube videos if youtube-dl is installed.

Okay. Sorry for long post. Anyway, sparkle is kind of abandoned (as I mentioned in first post). I use it for learning and as testing ground for my new mad ideas.

I still commit to it and fix things. But I can't put as much effort as before.
[Android Apps and Games] zanfix:
"Sorry for long post"

No that's fine!

"Directional keys are mapped to numpad keys indeed..."

I see...

"...or a lot of help from someone with such device (running debug versions, sending logs etc)."

Well i would be happy to help

"...tells to use x11 video output"

Yes i use this also in Xsdl with vlc and even on my s9+ scaling does indeed slow down things, actually does not bother me

"Btw, mpv can also be used to play youtube videos if youtube-dl is installed."

Yes sure i occasionally use this approach with vlc since 24bit more in Xsdl is way slower that 16bit mode on my tablet and with 16bit mode some videos will have very bad colors, but for some reason the problem is fixed playing them with vlc...

"sparkle is kind of abandoned (as I mentioned in first post)"

Well that's sad :( I's a very good app from video performance point of view.

...But I can't put as much effort as before

Well i understand that.

I have my own personal programming projects, one entirely in C on windows, so I could try to have a look at your code on gitlab, but I suppose that would not be simple task since I do not have any experience with android/linux coding, X window or wayland... :confused:

I may have a look anyway and get my head smashed on the desk... :silly:

"Immersive mode is easy to implement"

Would you be willing to at least add this one?
[Android Apps and Games] Hentacler:
I've remapped directional keys to right values. At least these values are right for Fedora. Should also work for Debian. But not totally sure. If directional keys don't work, you may want to check /usr/share/X11/xkb/keycodes/evdev. Here is what I have there:

<UP> = 111;
<LEFT> = 113;
<DOWN> = 116;
<RGHT> = 114;

We can also try to debug RMB and wheel. Here is special version:

ftp://ftp.drivehq.com/mogryph/sparkle/sparkle-inp.apk

If you start it (it is enough to start application itself, starting service or xwayland is not required), it will write to logcat all received input events.

Command to read logcat is:
logcat -s Sparkle (or adb logcat -s Sparkle)
Expected output is things like:
MotionEvent1 source=53250 action=2
KeyEvent source=257 keyCode=4

If you tell me what you get on RMB or wheel, I will make it supported...

But I don't insist of course. I don't really care. This project never had more than 2-3 users.
[Android Apps and Games] Hentacler:
12290 is (SOURCE_MOUSE | SOURCE_TOUCHSCREEN). So device is reported as both mouse and touchscreen in the same time. Very funny.

It can be fixed (or worked around) here:

https://gitlab.com/mogryph/sparkle-...n/java/com/sion/sparkle/SparkleView.java#L194

Also this file deserved good cleanup...

BUT NOT WHILE SAKURA BLOOMS OF COURSE!!!
[Android Apps and Games] HolyChickenGuy:
can someone help me get this working?

Im rooted on android 10

Using linux deploy

Distro: Debian (Unstable)

Install Type: File

Gui: X11 (LXDE) via XServer XSDL (I would love to use kde on sparkle)

What i've tried:

I followed this guide (https://xdaforums.com/showpost.php?p=81775137&postcount=37)

but with my debian install, and instead of using xorg-server-xwayland i used xwayland but this does nothing

My user.sh

The output logs i get:
[Android Apps and Games] Hentacler:
It can't mount your image... I don't really know why. Best way to debug this is to use terminal and learn to mount image manually.

Simplest command is like:

mount /sdcard/linux.img /data/local/tmp/fedora
#or
busybox mount /sdcard/linux.img /data/local/tmp/fedora
#or
mount -o loop /sdcard/linux.img /data/local/tmp/fedora

First argument is path to your image (it must exist of course). Second argument is mountpoint (any empty directory).

Sparkle's command should work... But if it doesn't, you need to find the command that works. Expectet result is mountpoint (directory) becoming filled with distribution files: usr, lib, opt etc.

Also sparkle's user.sh is kind of replacement of Linux Deploy. If you use user.sh, you no longer need to use Linux Deploy and click "start" there. Or if you use Linux Deploy, you may go without enabling sparkle's user.sh. In second case, you need to bind-mount /data to LD container and start Xwayland like this:

mkdir -p /tmp/sparkle
ln -s /data/data/com.sion.sparkle/files/wayland-0 /tmp/sparkle/wayland-0
XDG_RUNTIME_DIR=/tmp/sparkle Xwayland :1
[Android Apps and Games] HolyChickenGuy:
Im having issues mounting the directories in termux
[Android Apps and Games] HolyChickenGuy:
Edit:

I've updated the tutorial and moved it to a separate post!

https://xdaforums.com/android/general/guide-running-linux-android-3d-t4093343
[Android Apps and Games] Hentacler:
If Linux Deploy is able to mount your image, sparkle should be able too. Just need to find the command that works.

Or you can configure user.sh to use already mounted (by LD) image. Just specify right mountpoint ("point="). If sparkle detects that something is already mounted over this directory, it will ignore "source=" and will not try to mount it.

Regarding KDE... KDE works good. You just need to know one mega-important thing. By default, kwin (KDE's window manager) is configured to use OpenGL for window composition. Hardware OpenGL is not available on most of our handheld and software emulation is used. Its mega slow. You need to go to KDE settings -> Display and monitor -> Compositor and uncheck "Enable compositor on startup". Or (if you want transparency etc.) you can leave compositor enabled and switch rendering backend from OpenGL to XRender. I have no other problems with KDE.
[Android Apps and Games] robsmith11:
Is there any chance Sparkle will work on an Android device that can't be rooted?

I've upgraded my tablet to one that's much faster, but sadly lost Xwayland support. I'm using Xsdl, but the keyboard support is so buggy it's driving me crazy.
[Android Apps and Games] Mr.Aton:
hello there dev

i tried it with kali nethunter its working soo awsome..

is there any way we can achive this termux proot without root!

???????????

---------- Post added at 10:27 AM ---------- Previous post was at 10:17 AM ----------

can we somehow run sparkle with distros in termux which uses proot :silly:

is there any way to run without root??????