termux / termux-x11

Termux X11 add-on application.
https://termux.dev
GNU General Public License v3.0
2.12k stars 314 forks source link

Not work in chroot #166

Closed Ilya114 closed 2 years ago

Ilya114 commented 2 years ago

Hi, I'm trying launch termux-x11 in chroot(Linux Deploy) and get error: No protocol specified dbus[9050]: Unable to set up transient service directory: XDG_RUNTIME_DIR "/tmp" is owned by uid 10276, not our uid 0 No protocol specified xfce4-session: Cannot open display: . Are there solutions? /tmp Termux mounted as data/data/com.termux/files/usr/tmp. I also noticed that the application needs to be reinstalled after each use, otherwise the black screen (tested in proot). My device is Poco X3 Pro (HavocOS, Android 11)

screenshots ![Screenshot_20221029-003958_Termux](https://user-images.githubusercontent.com/93242944/198737709-42595a23-8693-4484-9ce5-c8133b771939.png) ![Screenshot_20221029-004215_Linux_Deploy](https://user-images.githubusercontent.com/93242944/198737711-10ddee0d-aae7-41d5-baa6-089492fb133b.png)
twaik commented 2 years ago

Read #45

Chuanhuan commented 1 year ago

I can write my own working example step by step:

install Termux:X11 .apk and .deb files (described here) and test it with a native Termux xfce4 installation that it works

install a rootfs.tar distro with Linux Deploy like this (the xfce4 does not work for me on Ubuntu 22) into /data/linux, do not install any additions like gui, audio, ssh, mounts, init etc.

go to Termux, enter su to switch superuser rights

mount all necessary folders from Android Linux kernel:

mkdir /dev/shm (if not exist)
mount --bind /dev /data/linux/dev
mount --bind /dev/pts /data/linux/dev/pts
mount --bind /dev/shm /data/linux/dev/shm
mount --bind /proc /data/linux/proc
mount --bind /sys /data/linux/sys
mount --bind /data/data/com.termux/files/usr/tmp /data/linux/tmp

log in to the installed Linux with chroot: chroot /data/linux /bin/su - apt-get update && apt-get upgrade apt-get install xfce4 xwayland

after this you must build the xfce4 environment using XServer XSDL from Play Store:

  • run XSDL
  • if you see the blue screen go back to Termux and enter export DISPLAY=:0 && startxfce4
  • go back to XSDL, if the desktop appears the xfce4 works
  • kill XSDL

open Termux:X11, Service was Created toast message should be appeared

open a new session in Termux and enter termux-x11 :0 &, it will switch to Termux:X11

switch back to the original chroot Termux session and enter these: rm /tmp/.X0-lock XDG_RUNTIME_DIR=/tmp Xwayland & export DISPLAY=:0 xfce4-session &

switch back to Termux:X11, wait a bit then you will see the xfce4 desktop (sometimes it does not load first time, in this case you must repeat the procedure from open Termux:X11 after kill it)

I'm still struggling with your method. My i3wm just stuck without any error message. Even I changed all /tmp and files permission. This still not work for my rooted Samsung S8+ rom. By the way, I use deploy and lhroot script, https://github.com/FerryAr/lhroot.

I also try different destroy like Manjaro and Debian still wm didn't show in termux-X11.