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

[Bug]: Unable to use Termux-X11 with x86 proot distributions #495

Open
xNul opened this issue Feb 11, 2025 · 4 comments
Open

[Bug]: Unable to use Termux-X11 with x86 proot distributions #495

xNul opened this issue Feb 11, 2025 · 4 comments

Comments

@xNul
Copy link

xNul commented Feb 11, 2025

Problem description

Arch Linux aarch64 works perfectly on my device. I'm able to run Termux-X11 and run xfce4 with no issues. Arch Linux x86 however, I cannot for the life of me get to work. The same commands that work perfectly on Arch Linux aarch64, fail for x86. All I see in Termux-X11 is a black screen with the default X cursor. No clear errors in the logs from my untrained eye.

Device: Pixel 9
OS: Android 15 (GrapheneOS)
Version: proot-distro latest (v4.21.0)

Arch Linux aarch64 working startxfce4 log

Arch Linux aarch64 working Termux-X11 debug log

Arch Linux x86 not working startxfce4 log

Arch Linux x86 not working Termux-X11 log

What steps will reproduce the bug?

Arch Linux aarch64

Termux

pd install archlinux
pd login archlinux
[root@localhost ~]# nano /etc/pacman.conf # uncomment DisableSandbox
[root@localhost ~]# pacman -Sy
[root@localhost ~]# pacman -Syu
[root@localhost ~]# pacman -S sudo
[root@localhost ~]# pacman -S xfce4
[root@localhost ~]# exit
./startxfce4_arch.sh

startxfce4_arch.sh

#!/data/data/com.termux/files/usr/bin/bash

# Kill open X11 processes
kill -9 $(pgrep -f "termux.x11") 2>/dev/null

# Enable PulseAudio over Network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1

# Prepare termux-x11 session
export XDG_RUNTIME_DIR=${TMPDIR}
TERMUX_X11_DEBUG=1 termux-x11 -ac -once -disable-dri3 :0 &> termux_x11.log &

# Wait a bit until termux-x11 gets started.
sleep 3

# Launch Termux X11 main activity
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

# Login in PRoot Environment. Do some initialization for PulseAudio, /tmp directory, vIPC
# and run XFCE4 as user root.
# See also: https://github.com/termux/proot-distro
# Argument -- acts as terminator of proot-distro login options processing.
# All arguments behind it would not be treated as options of PRoot Distro.
proot-distro login archlinux --no-sysvipc --shared-tmp -- /bin/bash -c  'export PULSE_SERVER=127.0.0.1 && export XDG_RUNTIME_DIR=${TMPDIR} && su - root -c "env DISPLAY=:0 LIBGL_ALWAYS_SOFTWARE=1 XDG_RUNTIME_DIR=${TMPDIR} startxfce4"' &> startxfce4.log

exit 0

Arch Linux x86

Termux

DISTRO_ARCH=x86_64 pd install --override-alias archlinuxx86 archlinux
pd login archlinuxx86
[root@localhost ~]# nano /etc/pacman.conf # uncomment DisableSandbox
[root@localhost ~]# pacman -Sy
[root@localhost ~]# pacman -Syu
[root@localhost ~]# pacman -S dhcpcd dnssec-anchors ldns less libedit nano net-tools netctl openresolv openssh vi which # for package-parity with aarch64. Termux-x11 still does not work, but it makes the logs easier to compare
[root@localhost ~]# pacman -S sudo
[root@localhost ~]# pacman -S xfce4
[root@localhost ~]# exit
./startxfce4_archx86.sh

startxfce4_archx86.sh

#!/data/data/com.termux/files/usr/bin/bash

# Kill open X11 processes
kill -9 $(pgrep -f "termux.x11") 2>/dev/null

# Enable PulseAudio over Network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1

# Prepare termux-x11 session
export XDG_RUNTIME_DIR=${TMPDIR}
TERMUX_X11_DEBUG=1 termux-x11 -ac -once -disable-dri3 :0 &> termux_x11x86.log &

# Wait a bit until termux-x11 gets started.
sleep 3

# Launch Termux X11 main activity
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

# Login in PRoot Environment. Do some initialization for PulseAudio, /tmp directory, vIPC
# and run XFCE4 as user root.
# See also: https://github.com/termux/proot-distro
# Argument -- acts as terminator of proot-distro login options processing.
# All arguments behind it would not be treated as options of PRoot Distro.
proot-distro login archlinuxx86 --no-sysvipc --shared-tmp -- /bin/bash -c  'export PULSE_SERVER=127.0.0.1 && export XDG_RUNTIME_DIR=${TMPDIR} && su - root -c "env DISPLAY=:0 LIBGL_ALWAYS_SOFTWARE=1 XDG_RUNTIME_DIR=${TMPDIR} startxfce4"' &> startxfce4x86.log

exit 0

What is the expected behavior?

Able to see and use the xfce4 desktop environment in Termux-X11 on Arch Linux x86.

@xNul
Copy link
Author

xNul commented Feb 12, 2025

I built Arch Linux aarch64 and x86 manually with the same result. aarch64 works perfectly. x86 has a black screen.

@xNul
Copy link
Author

xNul commented Feb 13, 2025

I'm also unable to use Termux-X11 with Ubuntu x86, but Ubuntu aarch64 works perfectly.

Interestingly, the logs are a bit different. I see a qemu: uncaught target signal 5 (Trap) - core dumped error for Ubuntu x86.

@xNul
Copy link
Author

xNul commented Feb 13, 2025

Alpine x86 fails as well. I think this is enough to indicate this issue affects all x86 proot distributions (possibly all QEMU proot distributions). Let me change the title to reflect it.

@xNul xNul changed the title [Bug]: Unable to use Termux-X11 with Arch Linux x86 [Bug]: Unable to use Termux-X11 with x86 proot distributions Feb 13, 2025
@xNul
Copy link
Author

xNul commented Feb 13, 2025

Tested a different desktop environment and Ubuntu aarch64 GNOME works. Ubuntu x86 GNOME has the same black screen issue.

michalbednarski added a commit to michalbednarski/libandroid-shmem that referenced this issue Feb 15, 2025
Don't assume that shmflg != 0 means SHM_RDONLY

termux/proot-distro#495
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant