Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get Termux:X11 working in a proot-distro #299

Closed
LukeShortCloud opened this issue Apr 14, 2023 · 29 comments
Closed

Unable to get Termux:X11 working in a proot-distro #299

LukeShortCloud opened this issue Apr 14, 2023 · 29 comments

Comments

@LukeShortCloud
Copy link

LukeShortCloud commented Apr 14, 2023

Using Termux:X11 works perfectly when using Termux itself.

(termux)$ XDG_RUNTIME_DIR="${TMP}" termux-x11 &
(termux)$ DISPLAY=:0 dbus-launch --exit-with-session xfce4-session

termux.log

When using a proot-distro, nothing happens in Termux:X11. It shows a black screen with the signature Xorg "X" cursor which means that the termux-x11 process is running and working. Apparently the proot-distro is not able to utilize that Xwayland environment. I do see all of the related Xorg files in /tmp in the Arch Linux proot, too.

(termux)$ proot-distro login archlinux --shared-tmp
(archlinux)$ XDG_RUNTIME_DIR=/tmp DISPLAY=:0 dbus-launch --exit-with-session xfce4-session

proot-distro-archlinux.log

I have attached the standard output and error of running the xfce4-session command in both Termux and in the proot-distro for comparison. Thank you in advance for any help you can provide!

@sylirre
Copy link
Member

sylirre commented Apr 14, 2023

In your log file:

dbus[20579]: Unable to set up transient service directory: XDG_RUNTIME_DIR "/tmp" can be written by others (mode 041777)

Does it work if you do chmod o-rwx /tmp inside the proot-distro?

@LukeShortCloud
Copy link
Author

After removing permissions for others, the same warning appears but it complains about the new permissions.

dbus[20579]: Unable to set up transient service directory: XDG_RUNTIME_DIR "/tmp" can be written by others (mode 041770)

I then tried chmod 0755 to make the temporary file a normal folder (which can break things for other programs). That removes the above warning entirely. But Termux:X11 is still not working and all I get is a black screen with a mouse cursor.

All of the other warnings still appear about failing to launch various XFCE4 related programs:

Unable to launch "<XFCE_PROGRAM>": Failed to close file descriptor for child process (Invalid argument)

@twaik
Copy link
Member

twaik commented Apr 14, 2023

Read this.
termux/termux-packages#14039

@twaik
Copy link
Member

twaik commented Apr 14, 2023

Maybe it is some error in dbus-launch, try to run DISPLAY=:0 xfce4-session

@LukeShortCloud
Copy link
Author

Thanks everyone for all the hints. Here's everything new I've tested so far based on the latest suggestions:

  • DISPLAY=:0 xfce4-session (no use of dbus-launch) = Same warnings.
  • proot-distro login archlinux --bind /dev/null:/proc/sys/kernel/cap_last_cap --shared-tmp (Binding this kernel capability to disable it) = Same warnings.
  • I made sure that the dbus-launch binary was already installed correctly. This comes from the dbus package on Arch Linux and dbus-x11 on Debian.
  • adb shell settings put global settings_enable_monitor_phantom_procs false (Disable the limit on background processes) = Same warnings but this should help prevent issues I probably would encounter in the future.

I also tried a few things that did end up working:

  • DISPLAY=:0 firefox = Launching Firefox with the Arch Linux PRoot, which apparently does not rely on dbus at all, works.
  • proot-distro login debian--shared-tmp = I created and used a Debian PRoot and it worked.

I can only come to the conclusion that either (A) there's a bug in Arch Linux or (B) I'm missing other dependencies in Arch Linux. I've cross-checked many Termux:X11 guides about Arch Linux and installed everything that should be needed.

Here are all of the packages I have installed in Arch Linux:

$ sudo pacman -S dbus firefox networkmanager pulseaudio xfce4 xfce4-goodies lightdm xorg xorg-server

I don't think a display manager such as LightDM is necessary since we are manually starting a session via the CLI but it was listed in one of the guides I as following.

For reference, here are all of the guides I've been reading over:

@Saikatsaha1996
Copy link

After removing permissions for others, the same warning appears but it complains about the new permissions.

dbus[20579]: Unable to set up transient service directory: XDG_RUNTIME_DIR "/tmp" can be written by others (mode 041770)

I then tried chmod 0755 to make the temporary file a normal folder (which can break things for other programs). That removes the above warning entirely. But Termux:X11 is still not working and all I get is a black screen with a mouse cursor.

All of the other warnings still appear about failing to launch various XFCE4 related programs:

Unable to launch "<XFCE_PROGRAM>": Failed to close file descriptor for child process (Invalid argument)

I think it is not termux-x11 issue.. same issue with me.. Even vnc also not working.. you can better understand..

termux/proot-distro#293 (comment)

@LukeShortCloud
Copy link
Author

LukeShortCloud commented Apr 15, 2023

Agreed. We can rule out Termux:X11 as being the issue because (1) individual X11 apps do work with Arch Linux and (2) the XFCE4 desktop environment does work with Debian. I'll go ahead and close this issue.

Thanks everyone for your help and insight! I'll report back if I can ever get Arch Linux to fully work.

@ochakov
Copy link

ochakov commented May 17, 2023

I have the same issue and would like to add my five cents.
I have a Samsung S7 FE tablet and a Pixel phone. Running proot-distro Ubuntu 22.04.
With the same setup exactly, the problem only occurs on Samsung, but not on Pixel.
I tried other distros as well with no luck.

Looks like the problem is related to Samsung.

@Saikatsaha1996
Copy link

I have the same issue and would like to add my five cents. I have a Samsung S7 FE tablet and a Pixel phone. Running proot-distro Ubuntu 22.04. With the same setup exactly, the problem only occurs on Samsung, but not on Pixel. I tried other distros as well with no luck.

Looks like the problem is related to Samsung.

No i checked.. it is actually our vendor issue..

Don't have any issues with miui device

@mio-19
Copy link

mio-19 commented Oct 10, 2023

Looks like the problem is related to Samsung.

I also have two devices available and the problem only occurs on Samsung

@Saikatsaha1996
Copy link

Looks like the problem is related to Samsung.

I also have two devices available and the problem only occurs on Samsung

Gki kernel? Kernel version 5.4 or 5.10 ?

@szw0407
Copy link

szw0407 commented Oct 24, 2023

Same on Samsung Galaxy Tab S7 FE, using ArchLinux proot, following the steps of https://ivonblog.com/en-us/posts/termux-proot-distro-archlinux/

Quite puzzled... Is there anything different between One UI and other Android based Operate systems?

@mio-19
Copy link

mio-19 commented Oct 24, 2023

Same on Samsung Galaxy Tab S7 FE, using ArchLinux proot, following the steps of https://ivonblog.com/en-us/posts/termux-proot-distro-archlinux/

Quite puzzled... Is there anything different between One UI and other Android based Operate systems?

It is caused by glib2. You need to disable close range related code blocks in glib/gspawn.c

@mio-19
Copy link

mio-19 commented Oct 24, 2023

Same on Samsung Galaxy Tab S7 FE, using ArchLinux proot, following the steps of https://ivonblog.com/en-us/posts/termux-proot-distro-archlinux/

Quite puzzled... Is there anything different between One UI and other Android based Operate systems?

There is something different on 5.4 gki android kernel but I don't know what exactly

@mio-19
Copy link

mio-19 commented Oct 24, 2023

Same on Samsung Galaxy Tab S7 FE, using ArchLinux proot, following the steps of https://ivonblog.com/en-us/posts/termux-proot-distro-archlinux/
Quite puzzled... Is there anything different between One UI and other Android based Operate systems?

It is caused by glib2. You need to disable close range related code blocks in glib/gspawn.c

I made a patched package here https://github.com/mio-19/aur-patches-aarch64/tree/3049fa6c9ecfe008aa58cbdf5dce69389088b69b/_kernel5_4/glib2-no-close-range

@szw0407
Copy link

szw0407 commented Oct 25, 2023

Same on Samsung Galaxy Tab S7 FE, using ArchLinux proot, following the steps of https://ivonblog.com/en-us/posts/termux-proot-distro-archlinux/
Quite puzzled... Is there anything different between One UI and other Android based Operate systems?

It is caused by glib2. You need to disable close range related code blocks in glib/gspawn.c

I made a patched package here https://github.com/mio-19/aur-patches-aarch64/tree/3049fa6c9ecfe008aa58cbdf5dce69389088b69b/_kernel5_4/glib2-no-close-range

Have you ever tried using Debian?

I tried using it following the steps on ivonblog, expecting it to work as many other issues mentioned that would work just fine, but I failed... Is there anything that website didn't mention?

Infact I am quite unfamiliar with Linux... I could hardly deal with such problems by simply reading archwiki...

@mio-19
Copy link

mio-19 commented Oct 25, 2023

Infact I am quite unfamiliar with Linux... I could hardly deal with such problems by simply reading archwiki...

It is a issue specific to a version of android kernel and isn't documented on archwiki.

If you installed an older version of Debian such as Debian 11 it should work fine. The issue was introduced by newer versions of glibc and glib.

@mio-19
Copy link

mio-19 commented Oct 25, 2023

@szw0407 Just to confirm, was the error message Failed to close file descriptor for child process (Invalid argument) ?

@Saikatsaha1996
Copy link

Infact I am quite unfamiliar with Linux... I could hardly deal with such problems by simply reading archwiki...

It is a issue specific to a version of android kernel and isn't documented on archwiki.

If you installed an older version of Debian such as Debian 11 it should work fine. The issue was introduced by newer versions of glibc and glib.

Can you fell back to Android 12 ? In Android 12 with kernel 5.4 newer Ubuntu & Debian working..

@szw0407
Copy link

szw0407 commented Oct 25, 2023

@szw0407 Just to confirm, was the error message Failed to close file descriptor for child process (Invalid argument) ?

Yes, along with some other warnings.

I opened a discussion under that blog, with all errors, and the x11 app has only black screen and a cursor:

details

Similar things happen in Debian 12, and I am unable to deal with it.

@szw0407
Copy link

szw0407 commented Oct 25, 2023

Infact I am quite unfamiliar with Linux... I could hardly deal with such problems by simply reading archwiki...

It is a issue specific to a version of android kernel and isn't documented on archwiki.

If you installed an older version of Debian such as Debian 11 it should work fine. The issue was introduced by newer versions of glibc and glib.

Can you fell back to Android 12 ? In Android 12 with kernel 5.4 newer Ubuntu & Debian working..

Perhaps not.

Samsung devices cannot be downgraded unless being rooted, but that would destroy Knox. Unfortunately I am not yet ready for that.

@mio-19
Copy link

mio-19 commented Oct 26, 2023

Similar things happen in Debian 12, and I am unable to deal with it.

Yes all recent glibc versions have problems with close range which 5.4 gki android kernel doesn't have.

Glibc incorrectly thinks that the program doesn't have the permission instead of the kernel not having this feature. Glib will use a fallback method on kernels without this feature, but glib received the wrong message from glibc.

@szw0407
Copy link

szw0407 commented Oct 26, 2023

yeah, and I managed to install xfce4 on Debian 11, everything seemed fine so far...

Thanks for your support. Wish the issue you mentioned be fixed soon in a new release.

@BBCByComcast
Copy link

I Fix Glibc in All Latest Proot Distro Using Better Desktop Environment, Go My Issues And You See, It's KDE Plasma (or Kubuntu Desktop If You Are Ubuntu), Everything Fine with All Latest Proot Distro, Do You Accept My Issues?

@Saikatsaha1996
Copy link

I Fix Glibc in All Latest Proot Distro Using Better Desktop Environment, Go My Issues And You See, It's KDE Plasma (or Kubuntu Desktop If You Are Ubuntu), Everything Fine with All Latest Proot Distro, Do You Accept My Issues?

Will check..

@BBCByComcast
Copy link

I Fix Glibc in All Latest Proot Distro Using Better Desktop Environment, Go My Issues And You See, It's KDE Plasma (or Kubuntu Desktop If You Are Ubuntu), Everything Fine with All Latest Proot Distro, Do You Accept My Issues?

Will check..

Sure, That KDE Plasma And Kubuntu Desktop is Better....

@termux termux deleted a comment from BBCByComcast Oct 29, 2023
@mio-19
Copy link

mio-19 commented Oct 29, 2023

I Fix Glibc in All Latest Proot Distro Using Better Desktop Environment, Go My Issues And You See, It's KDE Plasma (or Kubuntu Desktop If You Are Ubuntu), Everything Fine with All Latest Proot Distro, Do You Accept My Issues?

Did you use a translator or something?

@oltenxyz
Copy link

oltenxyz commented Oct 29, 2023

I Fix Glibc in All Latest Proot Distro Using Better Desktop Environment, Go My Issues And You See, It's KDE Plasma (or Kubuntu Desktop If You Are Ubuntu), Everything Fine with All Latest Proot Distro, Do You Accept My Issues?

Did you use a translator or something?

That guy is wreaking havoc all over the repo. Today, I woke up to 27 unintelligible emails, just because I responded to a different issue from him.
EDIT: And thanks for that patch btw! :) Any idea on what goes wrong in the 5.4 kernel to cause it?

@szw0407
Copy link

szw0407 commented Nov 20, 2023

Similar things happen in Debian 12, and I am unable to deal with it.

Yes all recent glibc versions have problems with close range which 5.4 gki android kernel doesn't have.

Glibc incorrectly thinks that the program doesn't have the permission instead of the kernel not having this feature. Glib will use a fallback method on kernels without this feature, but glib received the wrong message from glibc.

I have just found something curious, when I just removed systemd using a package manager, though with lots of components of xfce removed, the startxfce4 command successfully launched the GUI environment. I've tested that on openSUSE in proot.

@termux termux locked and limited conversation to collaborators Jul 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants