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

App force close as soon as xfce4 starts loading #44

Closed
zanfix opened this issue Oct 6, 2021 · 27 comments
Closed

App force close as soon as xfce4 starts loading #44

zanfix opened this issue Oct 6, 2021 · 27 comments
Labels
bug Something isn't working

Comments

@zanfix
Copy link

zanfix commented Oct 6, 2021

Termux:X11 app will force close as soon i start xfce4:

logcat output:

10-06 23:29:16.504 28813 28813 I ViewRootImpl@e068beb[TermuxActivity]: ViewPostIme key 1

10-06 23:29:16.635 13850 13850 I dbus-daemon: [session uid=10269 pid=13848] Activating service name='org.xfce.Xfconf' requested by ':1.0' (uid=10269 pid=13846 comm="xfce4-session" label="u:r:untrusted_app_27:s0:c13,c257,c512,c768")
10-06 23:29:16.649 13850 13850 I dbus-daemon: [session uid=10269 pid=13848] Successfully activated service 'org.xfce.Xfconf'
10-06 23:29:17.998 13864 13864 I shmem   : int android_shmget(key_t, size_t, int): bound UNIX socket /dev/shm/00003628 in pid=13864
10-06 23:29:17.998 13864 13864 I shmem   : void *android_shmat(int, const void *, int): mapped addr 0x75ec65f000 for FD 11 ID 0
10-06 23:29:17.999 13645 13645 I shmem   : void *shmat(int, const void *, int): mapped addr 0x7c234c6000 for FD 12 ID 0
10-06 23:29:17.999 13645 13645 I shmem   : int shmdt(const void *): unmapped addr 0x7c234c6000 for FD 12 ID 0 shmid 36280001
10-06 23:29:17.999 13645 13645 I shmem   : int shmdt(const void *): deleting shmid 36280001
10-06 23:29:17.999 13864 13864 I shmem   : int android_shmctl(int, int, struct shmid64_ds *): IPC_RMID for shmid=36280001
10-06 23:29:17.999 13864 13864 I shmem   : int android_shmdt(const void *): unmapped addr 0x75ec65f000 for FD 11 ID 0 shmid 36280001
10-06 23:29:17.999 13864 13864 I shmem   : int android_shmdt(const void *): deleting shmid 36280001
10-06 23:29:17.999 13864 13864 I shmem   : void *android_shmat(int, const void *, int): mapped addr 0x75ec65f000 for FD 11 ID 0
10-06 23:29:18.000 13645 13645 I shmem   : void *shmat(int, const void *, int): mapped addr 0x7c234c6000 for FD 14 ID 0
10-06 23:29:18.000 13645 13645 I shmem   : int shmdt(const void *): unmapped addr 0x7c234c6000 for FD 14 ID 0 shmid 36280002
10-06 23:29:18.000 13645 13645 I shmem   : int shmdt(const void *): deleting shmid 36280002
10-06 23:29:18.000 13864 13864 I shmem   : int android_shmctl(int, int, struct shmid64_ds *): IPC_RMID for shmid=36280002
10-06 23:29:18.000 13864 13864 I shmem   : int android_shmdt(const void *): unmapped addr 0x75ec65f000 for FD 11 ID 0 shmid 36280002
10-06 23:29:18.000 13864 13864 I shmem   : int android_shmdt(const void *): deleting shmid 36280002
10-06 23:29:18.000 13864 13864 I shmem   : void *android_shmat(int, const void *, int): mapped addr 0x75e7003000 for FD 11 ID 0
10-06 23:29:18.000 13645 13645 I shmem   : void *shmat(int, const void *, int): mapped addr 0x7c20ec5000 for FD 14 ID 0
10-06 23:29:18.000 13864 13864 I shmem   : int android_shmctl(int, int, struct shmid64_ds *): IPC_RMID for shmid=36280003
10-06 23:29:22.438 13925 13925 I shmem   : int android_shmget(key_t, size_t, int): bound UNIX socket /dev/shm/00003665 in pid=13925
10-06 23:29:22.438 13925 13925 I shmem   : void *android_shmat(int, const void *, int): mapped addr 0x73f2f95000 for FD 12 ID 0
10-06 23:29:22.439 13645 13645 I shmem   : void *shmat(int, const void *, int): mapped addr 0x7c235da000 for FD 20 ID 1
10-06 23:29:22.439 13645 13645 I shmem   : int shmdt(const void *): unmapped addr 0x7c235da000 for FD 20 ID 1 shmid 36650001
10-06 23:29:22.439 13645 13645 I shmem   : int shmdt(const void *): deleting shmid 36650001
10-06 23:29:22.439 13925 13925 I shmem   : int android_shmctl(int, int, struct shmid64_ds *): IPC_RMID for shmid=36650001
10-06 23:29:22.439 13925 13925 I shmem   : int android_shmdt(const void *): unmapped addr 0x73f2f95000 for FD 12 ID 0 shmid 36650001
10-06 23:29:22.439 13925 13925 I shmem   : int android_shmdt(const void *): deleting shmid 36650001                                                                                                                 10-06 23:29:22.439 13925 13925 I shmem   : void *android_shmat(int, const void *, int): mapped addr 0x73f2f95000 for FD 12 ID 0                                                                                     10-06 23:29:22.440 13645 13645 I shmem   : void *shmat(int, const void *, int): mapped addr 0x7c235da000 for FD 20 ID 1                                                                                             10-06 23:29:22.440 13645 13645 I shmem   : int shmdt(const void *): unmapped addr 0x7c235da000 for FD 20 ID 1 shmid 36650002
10-06 23:29:22.440 13645 13645 I shmem   : int shmdt(const void *): deleting shmid 36650002
10-06 23:29:22.440 13925 13925 I shmem   : int android_shmctl(int, int, struct shmid64_ds *): IPC_RMID for shmid=36650002
10-06 23:29:22.440 13925 13925 I shmem   : int android_shmdt(const void *): unmapped addr 0x73f2f95000 for FD 12 ID 0 shmid 36650002
10-06 23:29:22.440 13925 13925 I shmem   : int android_shmdt(const void *): deleting shmid 36650002
10-06 23:29:22.440 13925 13925 I shmem   : void *android_shmat(int, const void *, int): mapped addr 0x73f1a68000 for FD 12 ID 0
10-06 23:29:22.441 13645 13645 I shmem   : void *shmat(int, const void *, int): mapped addr 0x7c1f745000 for FD 20 ID 1
10-06 23:29:22.441 13925 13925 I shmem   : int android_shmctl(int, int, struct shmid64_ds *): IPC_RMID for shmid=36650003
--------- beginning of crash
10-06 23:29:22.521 13932 13932 F libc    : Fatal signal 5 (SIGTRAP), code -6 (SI_TKILL) in tid 13932 (xfsettingsd), pid 13932 (xfsettingsd)
10-06 23:29:22.529 13937 13937 E crash_dump64: unknown process state: t
10-06 23:29:22.531 13937 13937 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
10-06 23:29:22.532 13937 13937 I crash_dump64: performing dump of process 13932 (target tid = 13932)
10-06 23:29:22.532 13937 13937 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-06 23:29:22.532 13937 13937 F DEBUG   : Build fingerprint: 'samsung/gts6lwifixx/gts6lwifi:10/QP1A.190711.020/T860XXS3BUA1:user/release-keys'
10-06 23:29:22.532 13937 13937 F DEBUG   : Revision: '8'
10-06 23:29:22.532 13937 13937 F DEBUG   : ABI: 'arm64'
10-06 23:29:22.533 13937 13937 F DEBUG   : Timestamp: 2021-10-06 23:29:22+0200
10-06 23:29:22.533 13937 13937 F DEBUG   : pid: 13932, tid: 13932, name: xfsettingsd  >>> xfsettingsd <<<
10-06 23:29:22.533 13937 13937 F DEBUG   : uid: 10269
10-06 23:29:22.533 13937 13937 F DEBUG   : signal 5 (SIGTRAP), code -6 (SI_TKILL), fault addr --------
10-06 23:29:22.533 13937 13937 F DEBUG   :     x0  0000000000000000  x1  000000000000366c  x2  0000000000000005  x3  00000073c422d070
10-06 23:29:22.533 13937 13937 F DEBUG   :     x4  3032352e32323a39  x5  3032352e32323a39  x6  3032352e32323a39  x7  6e55203a6d305b1b
10-06 23:29:22.533 13937 13937 F DEBUG   :     x8  0000000000000083  x9  0000000000000001  x10 00000073c6e82060  x11 0000000000000080
10-06 23:29:22.533 13937 13937 F DEBUG   :     x12 0000000000055898  x13 6e55203a6d305b1b  x14 0000000000000194  x15 0000000000000008
10-06 23:29:22.533 13937 13937 F DEBUG   :     x16 00000073c65c0ea0  x17 00000073c659db50  x18 00000073c746e000  x19 0000000000000006
10-06 23:29:22.533 13937 13937 F DEBUG   :     x20 00000059b34bc9b9  x21 00000073c6e82020  x22 ffffffffffffffff  x23 00000073c637b9c8
10-06 23:29:22.533 13937 13937 F DEBUG   :     x24 0000000000000001  x25 00000059b34bc9b9  x26 0000000000000000  x27 0000000000000006
10-06 23:29:22.533 13937 13937 F DEBUG   :     x28 0000000000000000  x29 0000007ffed7c7b0
10-06 23:29:22.533 13937 13937 F DEBUG   :     sp  0000007ffed7c720  lr  00000073c62d1ab0  pc  00000073c659db58
10-06 23:29:22.533 13937 13937 F DEBUG   :
10-06 23:29:22.533 13937 13937 F DEBUG   : backtrace:
10-06 23:29:22.533 13937 13937 F DEBUG   :       #00 pc 00000000000d2b58  /apex/com.android.runtime/lib64/bionic/libc.so (tgkill+8) (BuildId: d00c50b4798c95f2447d684ed3ea7dcb)
10-06 23:29:22.533 13937 13937 F DEBUG   :       #01 pc 0000000000050aac  /data/data/com.termux/files/usr/lib/libglib-2.0.so (g_log_default_handler+172)

10-06 23:29:28.239 28813 28813 I ViewRootImpl@e068beb[TermuxActivity]: MSG_WINDOW_FOCUS_CHANGED 0 0

what i did from termux:

~ $ export XDG_RUNTIME_DIR=${TMPDIR}
~ $ termux-x11 :1 >/dev/null &
[1] 21373
~ $ res = 0
Activity is started
Got getWaylandFD
{ParcelFileDescriptor: java.io.FileDescriptor@81249e4}
Lorie requested fd
Got getLogFD
{ParcelFileDescriptor: java.io.FileDescriptor@ca51e4d}
Got finish request
App sent finishing command
Starting Xwayland
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 569, clipping.
>                   X11 cannot support keycodes above 255.
Errors from xkbcomp are not fatal to the X server

~ $ env DISPLAY=:1 xfce4-session
dbus[21414]: Unable to set up transient service directory: XDG_RUNTIME_DIR "/data/data/com.termux/files/usr/tmp" can be written by others (mode 041777)
/data/data/com.termux/files/usr/bin/iceauth:  creating new authority file /data/data/com.termux/files/usr/tmp/ICEauthority
xfce4-session: No SSH authentication agent found

(xfwm4:21431): xfwm4-WARNING **: 23:42:20.615: Cannot find a matching visual for the frame buffer config.

(xfwm4:21431): xfwm4-WARNING **: 23:42:20.620: Cannot find a matching GLX config, vsync disabled.
(EE) failed to read Wayland events: Connection reset by peer
Gdk-Message: 23:42:21.215: Thunar: Fatal IO error 11 (Try again) on X server :1.

Gdk-Message: 23:42:21.218: xfsettingsd: Fatal IO error 11 (Try again) on X server :1.

Gdk-Message: 23:42:21.219: xfwm4: Fatal IO error 11 (Try again) on X server :1.

Gdk-Message: 23:42:21.221: xfdesktop: Fatal IO error 22 (Invalid argument) on X server :1.

Gdk-Message: 23:42:21.234: xfce4-session: Fatal IO error 11 (Try again) on X server :1.

[1]+  Exit 1                  termux-x11 :1 > /dev/null
~ $ Gdk-Message: 23:42:21.280: xfce4-panel: Fatal IO error 22 (Invalid argument) on X server :1.


~ $
@sukualam
Copy link

sukualam commented Oct 7, 2021

Maybe you can try this command, maybe will not crash

before that, close termux x11 app (make sure it not running any session, maybe just force close it), then

export XDG_RUNTIME_DIR=${TMPDIR}
termux-x11 &
env DISPLAY=:0 xfce4-session

@zanfix
Copy link
Author

zanfix commented Oct 7, 2021

Maybe you can try this command, maybe will not crash

before that, close termux x11 app (make sure it not running any session, maybe just force close it), then

export XDG_RUNTIME_DIR=${TMPDIR} termux-x11 & env DISPLAY=:0 xfce4-session

Yes it works, with DISPLAY :0, thank you!

@zanfix zanfix closed this as completed Oct 7, 2021
@zanfix zanfix reopened this Oct 8, 2021
@zanfix
Copy link
Author

zanfix commented Oct 8, 2021

I had another crash on startup:

--------- beginning of crash
10-08 18:21:22.986 11515 11515 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x2c in tid 11515 (xfce4-session), pid 11515 (xfce4-session)
10-08 18:21:22.998 11575 11575 E crash_dump64: unknown process state: t
10-08 18:21:23.001 11575 11575 I crash_dump64: obtaining output fd from tombstoned, type: kDebuggerdTombstone
10-08 18:21:23.002 11575 11575 I crash_dump64: performing dump of process 11515 (target tid = 11515)
10-08 18:21:23.003 11575 11575 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-08 18:21:23.003 11575 11575 F DEBUG   : Build fingerprint: 'samsung/gts6lwifixx/gts6lwifi:10/QP1A.190711.020/T860XXS3BUA1:user/release-keys'
10-08 18:21:23.003 11575 11575 F DEBUG   : Revision: '8'
10-08 18:21:23.003 11575 11575 F DEBUG   : ABI: 'arm64'
10-08 18:21:23.003 11575 11575 F DEBUG   : Timestamp: 2021-10-08 18:21:23+0200
10-08 18:21:23.003 11575 11575 F DEBUG   : pid: 11515, tid: 11515, name: xfce4-session  >>> xfce4-session <<<
10-08 18:21:23.003 11575 11575 F DEBUG   : uid: 10270
10-08 18:21:23.003 11575 11575 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x2c
10-08 18:21:23.003 11575 11575 F DEBUG   : Cause: null pointer dereference
10-08 18:21:23.003 11575 11575 F DEBUG   :     x0  0000000000000000  x1  000000799902e6c0  x2  0000000000000000  x3  0000005dfd3e75a4
10-08 18:21:23.003 11575 11575 F DEBUG   :     x4  00000079990000a0  x5  00000079990000c0  x6  0000007999137380  x7  0000007999137360
10-08 18:21:23.003 11575 11575 F DEBUG   :     x8  0000000000000000  x9  0000000000000012  x10 0000000000000000  x11 0000000000000000
10-08 18:21:23.003 11575 11575 F DEBUG   :     x12 000000000054c1d8  x13 0000007999132e20  x14 0000007999001550  x15 0000007999001560
10-08 18:21:23.003 11575 11575 F DEBUG   :     x16 0000005dfd400ed8  x17 000000799981117c  x18 0000000000000000  x19 0000000000000000
10-08 18:21:23.003 11575 11575 F DEBUG   :     x20 0000005dfd4021b0  x21 0000000000000001  x22 000000799bb41020  x23 0000000000000000
10-08 18:21:23.003 11575 11575 F DEBUG   :     x24 0000000000000000  x25 000000799bb41020  x26 0000000000000000  x27 000000799990049c
10-08 18:21:23.004 11575 11575 F DEBUG   :     x28 00000079990f5540  x29 0000007feb594a60
10-08 18:21:23.004 11575 11575 F DEBUG   :     sp  0000007feb594a30  lr  0000005dfd3e75f0  pc  0000005dfd3f1588
10-08 18:21:23.004 11575 11575 F DEBUG   :
10-08 18:21:23.004 11575 11575 F DEBUG   : backtrace:
10-08 18:21:23.004 11575 11575 F DEBUG   :     NOTE: Function names and BuildId information is missing for some frames due
10-08 18:21:23.004 11575 11575 F DEBUG   :     NOTE: to unreadable libraries. For unwinds of apps, only shared libraries                                       10-08 18:21:23.004 11575 11575 F DEBUG   :     NOTE: found under the lib/ directory are readable.
10-08 18:21:23.004 11575 11575 F DEBUG   :       #00 pc 0000000000024588  /data/data/com.termux/files/usr/bin/xfce4-session
10-08 18:21:23.012 11575 11575 E crash_dump64: AM data write failed: Broken pipe

from termux:

~ $ export XDG_RUNTIME_DIR=${TMPDIR}
~ $ termux-x11 &
[1] 11223
~ $ res = 0
Activity is started
Got getWaylandFD
{ParcelFileDescriptor: java.io.FileDescriptor@5d208ff}
Lorie requested fd
Got getLogFD
{ParcelFileDescriptor: java.io.FileDescriptor@d65b6cc}
Got finish request
App sent finishing command
Starting Xwayland
argv[0] = /data/data/com.termux/files/usr/bin/Xwayland
2F 64 61 74 61 2F 64 61  74 61 2F 63 6F 6D 2E 74  |  /data/data/com.t
65 72 6D 75 78 2F 66 69  6C 65 73 2F 75 73 72 2F  |  ermux/files/usr/
62 69 6E 2F 58 77 61 79  6C 61 6E 64              |  bin/Xwayland
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 569, clipping.
>                   X11 cannot support keycodes above 255.
Errors from xkbcomp are not fatal to the X server

~ $ env DISPLAY=:0 xfce4-session
/data/data/com.termux/files/usr/bin/iceauth:  creating new authority file /data/data/com.termux/files/usr/tmp/ICEauthority
xfce4-session: No SSH authentication agent found
gpg-agent[11531]: directory '/data/data/com.termux/files/home/.gnupg' created
gpg-agent[11531]: directory '/data/data/com.termux/files/home/.gnupg/private-keys-v1.d' created
gpg-agent[11532]: gpg-agent (GnuPG) 2.3.2 started

(xfwm4:11533): GLib-CRITICAL **: 18:21:19.255: g_str_has_prefix: assertion 'prefix != NULL' failed

(xfwm4:11533): xfwm4-WARNING **: 18:21:22.334: Another compositing manager is running on screen 0

(xfsettingsd:11544): GLib-CRITICAL **: 18:21:22.542: g_str_has_prefix: assertion 'prefix != NULL' failed

(xfsettingsd:11544): GLib-GObject-CRITICAL **: 18:21:22.549: g_value_get_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed

(xfsettingsd:11544): GLib-GObject-CRITICAL **: 18:21:22.554: g_value_get_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed

(xfsettingsd:11544): GLib-GObject-CRITICAL **: 18:21:22.569: g_value_get_string: assertion 'G_VALUE_HOLDS_STRING (value)' failed
(EE) failed to read Wayland events: Connection reset by peer
Gdk-Message: 18:21:22.970: xfwm4: Fatal IO error 11 (Try again) on X server :0.

Gdk-Message: 18:21:22.971: xfdesktop: Fatal IO error 0 (Success) on X server :0.

Gdk-Message: 18:21:22.975: xfsettingsd: Fatal IO error 11 (Try again) on X server :0.

Gdk-Message: 18:21:22.976: Thunar: Fatal IO error 11 (Try again) on X server :0.

Gdk-Message: 18:21:23.002: xfce4-panel: Fatal IO error 0 (Success) on X server :0.


(xfwm4:11571): Gtk-WARNING **: 18:21:23.009: cannot open display: :0.0
[1]+  Exit 1                  termux-x11
Segmentation fault
~ $

edit: started fine the second time I tried... after restarting termux and termux:x11

@twaik
Copy link
Member

twaik commented Oct 9, 2021

Can you please try to start termux-x11 with TERMUX_X11_LOG_FILE exported?

~ $ env TERMUX_X11_LOG_FILE=log.txt termux-x11 &

After that you can start xfce4-session and if it still has problems you will have special log file that you can upload here.

@zanfix
Copy link
Author

zanfix commented Feb 4, 2022

Can you please try to start termux-x11 with TERMUX_X11_LOG_FILE exported?

~ $ env TERMUX_X11_LOG_FILE=log.txt termux-x11 &

After that you can start xfce4-session and if it still has problems you will have special log file that you can upload here.

I am having more force closes after some time using the app (maybe 30min...1h once opened). I do not see nothing relevant in logcat.

Can I use the TERMUX_X11_LOG_FILE in some other way since I am not using the starter app?

@zanfix
Copy link
Author

zanfix commented Feb 4, 2022

This is what it seems to put out on logcat

02-04 15:37:17.064 20960 20960 W DesktopBar: removeNotification for unknown key: 0|com.termux.x11|1|null|10283

02-04 15:37:17.407   976  1338 I WindowManager: Reparenting to original parent: Surface(name=WindowToken{3825300 android.view.ViewRootImpl$W@c136583})/@0xd8f35cf, destroyLeash=true, surface=Surface(name=5c78739 Application Error: com.termux.x11)/@0x12e256
02-04 15:37:17.425   884  1490 I Layer   : id=3707 removeFromCurrentState Surface(name=5c78739 Application Error: com.termux.x11)/@0x12e256 - animation-leash#0 (91)
02-04 15:37:17.426   884  1490 I SurfaceFlinger: id=3707 Removed Surface(name=5c78739 Application Error: com.termux.x11)/@0x12e256 - animation-leash#0 (91)
02-04 15:37:17.427   976  1338 I WindowManager: Destroying surface Surface(name=Application Error: com.termux.x11)/@0xd735feb called by com.android.server.wm.WindowStateAnimator.destroySurface:1834 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:733 com.android.server.wm.WindowState.destroySurfaceUnchecked:3642 com.android.server.wm.RootWindowContainer.performSurfacePlacementNoTrace:813 com.android.server.wm.RootWindowContainer.performSurfacePlacement:671 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacementLoop:180 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement:111 com.android.server.wm.WindowSurfacePlacer.performSurfacePlacement:99
02-04 15:37:17.427   884  1490 I Layer   : id=3702 removeFromCurrentState Application Error: com.termux.x11#0 (91)
02-04 15:37:17.428   884  1490 I SurfaceFlinger: id=3702 Removed Application Error: com.termux.x11#0 (91)
02-04 15:37:17.430   884  1490 I Layer   : id=3701 removeFromCurrentState 5c78739 Application Error: com.termux.x11#0 (91)
02-04 15:37:17.432   884  1490 I SurfaceFlinger: id=3701 Removed 5c78739 Application Error: com.termux.x11#0 (91)
02-04 15:37:17.439   884   884 I Layer   : id=3707[1] Destroyed Surface(name=5c78739 Application Error: com.termux.x11)/@0x12e256 - animation-leash#0
02-04 15:37:17.439   884   884 I Layer   : id=3701[1] Destroyed 5c78739 Application Error: com.termux.x11#0
02-04 15:37:17.439   884   884 I Layer   : id=3702[1] Destroyed Application Error: com.termux.x11#0

@twaik
Copy link
Member

twaik commented Feb 1, 2023

Can you please try again with latest build?

@zanfix
Copy link
Author

zanfix commented Feb 1, 2023

Can you please try again with latest build?

Hi, i cloned the repo and built the application but it appears i have problems during build.
Please note that i do not use Android IDE, but i use gradle directly.

This is the output:
android@blackbox64:~/src/termux-x11$ ./gradlew build

> Task :app:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :app:compileReleaseJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :app:lintReportDebug
Wrote HTML report to file:///home/android/src/termux-x11/app/build/reports/lint-results-debug.html

> Task :app:lintDebug FAILED
Lint found 2 errors, 10 warnings. First failure:

/home/android/src/termux-x11/app/src/main/java/com/termux/x11/MainActivity.java:149: Error: Overriding method should call super.onPictureInPictureModeChanged [MissingSuperCall]
    public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Explanation for issues of type "MissingSuperCall":
   Some methods, such as View#onDetachedFromWindow, require that you also call
   the super implementation as part of your method.


The full lint text report is located at:
  /home/android/src/termux-x11/app/build/intermediates/lint_intermediate_text_report/debug/lint-results-debug.txt

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:lintDebug'.
>                 Lint found errors in the project; aborting build.
  
                  Fix the issues identified by lint, or create a baseline to see only new errors:
                  ```
                  android {
                      lint {
                          baseline = file("lint-baseline.xml")
                      }
                  }
                  ```
  
                  For more details, see https://developer.android.com/studio/write/lint#snapshot
  
                  Lint found 2 errors, 10 warnings. First failure:
  
  /home/android/src/termux-x11/app/src/main/java/com/termux/x11/MainActivity.java:149: Error: Overriding method should call super.onPictureInPictureModeChanged [MissingSuperCall]
      public void onPictureInPictureModeChanged (boolean isInPictureInPictureMode, Configuration newConfig) {
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
     Explanation for issues of type "MissingSuperCall":
     Some methods, such as View#onDetachedFromWindow, require that you also call
     the super implementation as part of your method.
  
  
  The full lint text report is located at:
    /home/android/src/termux-x11/app/build/intermediates/lint_intermediate_text_report/debug/lint-results-debug.txt

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 23s
338 actionable tasks: 57 executed, 281 up-to-date
android@blackbox64:~/src/termux-x11$ 

Here is lint-results-debug.txt from app/build/intermediates/lint_intermediate_text_report/debug/

Please note that I compiled the app manually due to the fact that I do not use termux-x11 with termux.
As you suggested in issue #45, i added the following calls in app/src/main/jni/lorie/compositor.cpp, in function void lorie_compositor::start() :

  • putenv("XDG_RUNTIME_DIR=/data/data/com.termux.x11/files/tmp"); after LogInit(); call
  • chmod("/data/data/com.termux.x11/files/tmp/wayland-0", 0777); after wl_display_add_socket_auto(display); call

I noticed that the apk gets created even if gradle does not complete the build, and installed it on my device, but something does not work.

The termux-x11 window app appears but nothing appears inside of it.

The wayland-0 socket gets created and Xwayland (inside chroot) starts, but startxfce logs show that applications are
unable to connect to the display:

Xwayland output:

_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Unsupported maximum keycode 708, clipping.
>                   X11 cannot support keycodes above 255.
Errors from xkbcomp are not fatal to the X server
startxfce4 output:
/usr/bin/startxfce4: X server already running on display unix:0
xrdb: No such file or directory
xrdb: Can't open display 'unix:0'

(xfce4-session:143): Gdk-CRITICAL **: 22:37:47.871: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed
_IceTransmkdir: ERROR: euid != 0,directory /tmp/.ICE-unix will not be created.
/usr/bin/iceauth:  creating new authority file /tmp/xdg-runtime-dir/ICEauthority

(xfwm4:212): Gtk-WARNING **: 22:37:48.188: cannot open display: wayland-0

(xfsettingsd:213): Gdk-CRITICAL **: 22:37:48.254: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed

(xfsettingsd:213): dbind-WARNING **: 22:37:48.259: Could not open X display

(xfsettingsd:213): GLib-GObject-WARNING **: 22:37:48.298: invalid cast from 'GdkWaylandDisplay' to 'GdkX11Display'

(xfce4-panel:218): Gdk-CRITICAL **: 22:37:48.352: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed

(xfce4-panel:218): dbind-WARNING **: 22:37:48.357: Could not open X display
xfce4-panel-Message: 22:37:48.445: Unable to open display from environment variable DISPLAY='wayland-0', exiting.

(Thunar:223): Gdk-CRITICAL **: 22:37:48.533: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed

(Thunar:223): dbind-WARNING **: 22:37:48.538: Could not open X display

(xfdesktop:232): Gdk-CRITICAL **: 22:37:56.552: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed

(xfdesktop:232): dbind-WARNING **: 22:37:56.558: Could not open X display
** Message: 22:37:56.633: couldn't access control socket: /tmp/xdg-runtime-dir/keyring/control: No such file or directory
discover_other_daemon: 0SSH_AUTH_SOCK=/tmp/xdg-runtime-dir/keyring/ssh
xdpyinfo:  unable to open display "wayland-0".
grep: /proc/267: Is a directory
grep: 143/environ: No such file or directory

(xfsettingsd:258): Gdk-CRITICAL **: 22:37:56.706: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed

(xfsettingsd:258): dbind-WARNING **: 22:37:56.712: Could not open X display
i3lock: Could not connect to X11, maybe you need to set DISPLAY?

** (xiccd:280): CRITICAL **: 22:37:56.733: Can't open display: wayland-0

(xfce4-notifyd:267): Gdk-CRITICAL **: 22:37:56.743: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed

(xfce4-notifyd:267): dbind-WARNING **: 22:37:56.747: Could not open X display

(xfsettingsd:258): GLib-GObject-WARNING **: 22:37:56.754: invalid cast from 'GdkWaylandDisplay' to 'GdkX11Display'

(polkit-gnome-authentication-agent-1:299): Gdk-CRITICAL **: 22:37:56.785: gdk_seat_get_keyboard: assertion 'GDK_IS_SEAT (seat)' failed

(polkit-gnome-authentication-agent-1:299): dbind-WARNING **: 22:37:56.790: Could not open X display
Error spawning command line “dbus-launch --autolaunch=80d63844b7413dc50b3b875261f696c7 --binary-syntax --close-stderr”: Child process exited with code 1

(polkit-gnome-authentication-agent-1:299): polkit-gnome-1-WARNING **: 22:37:56.821: Unable to determine the session we are in: No session for pid 299
How can we figure out what is the problem?

@twaik
Copy link
Member

twaik commented Feb 1, 2023

  1. Problems related to onPictureInPictureModeChanged will be fixed in next commit.
  2. startxfce4 tries to start new X server, it is not using existing instance. Use xfce4-session.
  3. (xfwm4:212): Gtk-WARNING **: 22:37:48.188: cannot open display: wayland-0. It is trying to open wayland socket, but termux-x11 does not support any wayland clients except Xwayland. When you are starting any clients pass environment variable GDK_BACKEND=x11.
  4. _XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.. If you really want to get rid of this you should use my starter.apk.

About using starter.
You do not need to do this.

putenv("XDG_RUNTIME_DIR=/data/data/com.termux.x11/files/tmp"); after LogInit(); call
chmod("/data/data/com.termux.x11/files/tmp/wayland-0", 0777); after wl_display_add_socket_auto(display); call

You should simply start my starter from android root shell with XDG_RUNTIME_DIR pointing to directory you need. You can erase parts that are trying to execute Xwayland if you want. It's target is to create socket and push it to the Lorie process.

@twaik
Copy link
Member

twaik commented Feb 2, 2023

Do you have any progress?

@twaik
Copy link
Member

twaik commented Feb 2, 2023

Any updates?

@twaik
Copy link
Member

twaik commented Feb 2, 2023

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

According to this code you get this error because you are not running Xwayland as root.

@zanfix
Copy link
Author

zanfix commented Feb 2, 2023

Hi, I will have more time to test this evening i think.

But what I can say is that just by switching back the termux-x11 version, everything works again. I don't have to change anything in my setup/configuration.

Here is a working startfxce session, still running while I am typing this comment, accessed remotely...

startxfce4 log:
/usr/bin/startxfce4: X server already running on display unix:0
xrdb: No such file or directory
xrdb: Can't open display 'unix:0'

(xfce4-session:142): Gdk-WARNING **: 23:09:09.851: The Wayland compositor does not provide any supported shell interface, not using Wayland display
_IceTransmkdir: ERROR: euid != 0,directory /tmp/.ICE-unix will not be created.
/usr/bin/iceauth:  creating new authority file /tmp/xdg-runtime-dir/ICEauthority

(xfwm4:198): xfwm4-WARNING **: 23:09:10.757: Unsupported GL renderer (llvmpipe (LLVM 12.0.1, 128 bits)).

(xfsettingsd:234): xfsettingsd-WARNING **: 23:09:10.974: Unknown mode '2560x1600 @ 60.0' for output XWAYLAND0, aborting.

(Thunar:250): Gdk-WARNING **: 23:09:11.277: The Wayland compositor does not provide any supported shell interface, not using Wayland display
** Message: 23:09:11.756: couldn't access control socket: /tmp/xdg-runtime-dir/keyring/control: No such file or directory
discover_other_daemon: 0SSH_AUTH_SOCK=/tmp/xdg-runtime-dir/keyring/ssh

(wrapper-2.0:265): Gdk-WARNING **: 23:09:11.814: The Wayland compositor does not provide any supported shell interface, not using Wayland display
grep: /proc/307: Is a directory
grep: 142/environ: No such file or directory

(xfsettingsd:290): Gdk-WARNING **: 23:09:11.851: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(xfce4-notifyd:307): Gdk-WARNING **: 23:09:11.897: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(polkit-gnome-authentication-agent-1:321): Gdk-WARNING **: 23:09:11.941: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(wrapper-2.0:326): Gdk-WARNING **: 23:09:11.990: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(wrapper-2.0:348): Gdk-WARNING **: 23:09:11.992: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(polkit-gnome-authentication-agent-1:321): polkit-gnome-1-WARNING **: 23:09:12.007: Unable to determine the session we are in: No session for pid 321

(wrapper-2.0:362): Gdk-WARNING **: 23:09:12.042: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(wrapper-2.0:376): Gdk-WARNING **: 23:09:12.122: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(wrapper-2.0:374): Gdk-WARNING **: 23:09:12.123: The Wayland compositor does not provide any supported shell interface, not using Wayland display
libclock-Message: 23:09:12.136: could not get proxy for org.freedesktop.login1

(xfce4-panel:246): libclock-WARNING **: 23:09:12.136: could not instantiate a sleep monitor

(wrapper-2.0:375): Gdk-WARNING **: 23:09:12.225: The Wayland compositor does not provide any supported shell interface, not using Wayland display

** (xiccd:316): WARNING **: 23:09:12.248: EDID is empty

(wrapper-2.0:411): Gdk-WARNING **: 23:09:12.313: The Wayland compositor does not provide any supported shell interface, not using Wayland display

** (xiccd:316): CRITICAL **: 23:09:12.382: failed to create colord device: failed to obtain org.freedesktop.color-manager.create-device auth

(wrapper-2.0:411): libactions-WARNING **: 23:09:12.781: Calling CanShutdown failed GDBus.Error:org.xfce.SessionManager.Error.Failed: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

(wrapper-2.0:411): libactions-WARNING **: 23:09:12.814: Calling CanRestart failed GDBus.Error:org.xfce.SessionManager.Error.Failed: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

(xfce4-session:142): xfce4-session-WARNING **: 23:09:12.824: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(xfce4-session:142): xfce4-session-WARNING **: 23:09:12.852: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(xfce4-session:142): xfce4-session-WARNING **: 23:09:12.894: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)
[658:658:0201/230929.858511:ERROR:gpu_init.cc(523)] Passthrough is not supported, GL is disabled, ANGLE is 
Fontconfig error: Cannot load default config file
Fontconfig error: Cannot load default config file

(exo-open:2125): Gdk-WARNING **: 23:15:37.310: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(xfce4-mime-helper:2131): Gdk-WARNING **: 23:15:37.374: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(mousepad:2289): Gdk-WARNING **: 23:16:10.332: The Wayland compositor does not provide any supported shell interface, not using Wayland display
�[90m[main 2023-02-01T22:26:46.556Z]�[0m window#load: attempt to load window (id: 1)
�[90m[main 2023-02-01T22:26:46.599Z]�[0m update#setState idle
�[90m[main 2023-02-01T22:26:46.713Z]�[0m ExtensionHostStarterWorker created
�[90m[main 2023-02-01T22:26:48.401Z]�[0m window#load: window reported ready (id: 1)
�[90m[main 2023-02-01T22:26:48.611Z]�[0m Starting extension host with pid 4309 (fork() took 20 ms).
�[90m[main 2023-02-01T22:26:48.612Z]�[0m ExtensionHostStarterWorker.start() took 30 ms.
�[90m[main 2023-02-01T22:27:16.605Z]�[0m update#setState checking for updates
�[90m[main 2023-02-01T22:27:16.682Z]�[0m update#setState available for download

(exo-open:5108): Gdk-WARNING **: 23:30:46.528: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(xfce4-mime-helper:5114): Gdk-WARNING **: 23:30:46.590: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(xfce4-terminal:5123): Gdk-WARNING **: 23:30:46.759: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(mousepad:5322): Gdk-WARNING **: 23:31:44.344: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(mousepad:6637): Gdk-WARNING **: 23:39:05.699: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(mousepad:27072): Gdk-WARNING **: 07:45:26.502: The Wayland compositor does not provide any supported shell interface, not using Wayland display

(wrapper-2.0:411): libactions-WARNING **: 07:58:45.855: Calling CanShutdown failed GDBus.Error:org.xfce.SessionManager.Error.Failed: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

(wrapper-2.0:411): libactions-WARNING **: 07:58:45.893: Calling CanRestart failed GDBus.Error:org.xfce.SessionManager.Error.Failed: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1

(xfce4-session:142): xfce4-session-WARNING **: 07:58:45.903: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(xfce4-session:142): xfce4-session-WARNING **: 07:58:45.940: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

(xfce4-session:142): xfce4-session-WARNING **: 07:58:45.968: failed to run script: Failed to execute child process “/usr/bin/pm-is-supported” (No such file or directory)

@twaik
Copy link
Member

twaik commented Feb 2, 2023

just by switching back the termux-x11 version

What exactly do you mean here?

@zanfix
Copy link
Author

zanfix commented Feb 2, 2023

just by switching back the termux-x11 version

What exactly do you mean here?

I use as base an older version (looks like 1.02.06 i think), applied manually patch from #45 (comment), #45 (comment), https://github.com/termux/termux-x11/issues/125#issuecomment-1141082618 and https://github.com/termux/termux-x11/issues/125#issuecomment-1223568064

@twaik
Copy link
Member

twaik commented Feb 2, 2023

I think you can do it a bit later. I found a bug with screen resizing, I am fixing it at the moment.

@twaik
Copy link
Member

twaik commented Feb 5, 2023

Hi. Can you please test latest build?

@zanfix
Copy link
Author

zanfix commented Feb 6, 2023

Hi, I tried as you suggested:

About using starter.
You do not need to do this.

putenv("XDG_RUNTIME_DIR=/data/data/com.termux.x11/files/tmp"); after LogInit(); call
chmod("/data/data/com.termux.x11/files/tmp/wayland-0", 0777); after wl_display_add_socket_auto(display); call

You should simply start my starter from android root shell with XDG_RUNTIME_DIR pointing to directory you need. You >can erase parts that are trying to execute Xwayland if you want. It's target is to create socket and push it to the Lorie >process.

I call termux-x11 script from my scripts as root as follows:

export XDG_RUNTIME_DIR=${TERMUX_X11_FILES_FOLDER}/tmp 
sh /data/local/termux-x11/termux-x11 :0 &

This is the content of termux-x11 script:

export CLASSPATH=/data/local/termux-x11/starter.apk
unset LD_LIBRARY_PATH LD_PRELOAD
exec /system/bin/app_process / com.termux.x11.starter.Starter "$@"

This is the output of termux-x11 script:

Loading shared library: /data/local/termux-x11/starter.apk!/lib/arm64-v8a/libx11-starter.so
Looks like com.termux lacks "Draw Over Apps" permission.
You can grant com.termux the "Draw Over Apps" permission from its App Info activity:
	Android Settings -> Apps -> Termux -> Advanced -> Draw over other apps.
res = 0
Activity is started
Got getWaylandFD
{ParcelFileDescriptor: java.io.FileDescriptor@9b6b12e}
Lorie requested fd
Got getLogFD
{ParcelFileDescriptor: java.io.FileDescriptor@459a4cf}
Got finish request
App sent finishing command
Starting Xwayland
execv: No such file or directory

Xwayland cannot connect.
here the output:

_XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
(EE) could not connect to wayland server

I noticed that the socket that gets created in /data/data/com.termux.x11/files/tmp/termux-x11 belongs to root. I dont think this is correct.

localhost / # ls -l /data/data/com.termux.x11/files/tmp/
total 0
srwxr-xr-x 1 root root 0 2023-02-06 01:04 termux-x11
localhost / #

Even if I manually chmod 0777 and chown the socket to the user and group of termux-x11 android app (once my main script gets back control from termux-x11 script) Xwayland cannot connect

Since you changed the socket name i also export WAYLAND_DISPLAY=termux-x11 before invoking Xwayland

@zanfix
Copy link
Author

zanfix commented Feb 6, 2023

I'm quite sure it's something wrong with permissions, will do more tests asap.
May sound stupid but I think that the problem is the Starter apk is actually running as root through app_process

@zanfix
Copy link
Author

zanfix commented Feb 6, 2023

Ok...
I managed to make it work.

Here is what I modified in starter.c
JNIEXPORT jint JNICALL
Java_com_termux_x11_starter_Starter_createWaylandSocket(unused JNIEnv *env, unused jobject thiz) {
    int fd;
    errno = 0;
    //
    // GZ
    int res=0;
    FILE * f;
    struct stat sb;

    unlink(getWaylandSocketPath());
    if (socket_action(&fd, (char *) getWaylandSocketPath(), bind) < 0) {
        perror("socket");
        return -1;
    }

    //
    // GZ
    f = fopen("/data/local/termux-x11/termux-x11.log","w+");
    
    res=chmod(getWaylandSocketPath(), 0777);
    fprintf(f,"chmod res=%d\n",res);

    res=stat(getenv("XDG_RUNTIME_DIR"), &sb);
    fprintf(f,"stat res=%d\n",res);
    fprintf(
        f,
        "sb.st_uid=%d, sb.st_gid=%d\n",
        sb.st_uid,
        sb.st_gid
    );

    res=chown(getWaylandSocketPath(), sb.st_uid, sb.st_gid);
    fprintf(f,"chown res=%d\n",res);

    fclose(f);

    return fd;
}

the socket has to belong to the termux-x11 android app uid/gid. It cannot belong to root.
I also commented out in the java part the starting of XWayland...

EDIT: chmod 0777 appears to be enough

@twaik
Copy link
Member

twaik commented Feb 9, 2023

EDIT: chmod 0777 appears to be enough

Can you please try to fchmod and fchown the file descriptor being sent to Termux:X11 and not chmod socket ? I think it is not good that socket itself is can be opened by anyone. A lot of chroot applications can try to connect it and crash a server.

@zanfix
Copy link
Author

zanfix commented Feb 10, 2023

Initially, I actually tried using the f variants of chmod and chown using the available fd and it did not work.
I tried again now just to be sure: fchmod and fchown return both 0, but it does not work.
The reason I use 0777 permissions is because termux app uid/gid and chroot user uid/gid that runs Xwayland are different (Xwayland does not run as root)
What I could try to do is to set the gid of the socket to something that is available to both... i will test...

@zanfix
Copy link
Author

zanfix commented Feb 11, 2023

The solution I found is to chmod the socket to 0660 instead of 0777 and add into the chroot a group called termux-x11 with gid equal of the gid of the termux-x11 app, and add to this new group the user that runs Xwayland

@twaik
Copy link
Member

twaik commented Feb 17, 2023

It looks like I found a way to fix a dozen of issues and make it much easier to implement two dozens more. I will simply move wayland server to starter. It will be invoked from cli, so it will be able to work with root-owned sockets. Also it will let me add more cli options (it was complicated earlier because I needed to keep starter and main app compatible, now it is not a problem because starter is launched directly from apk of main app) like dpi, resolution, custom wayland or x socket path... And android application will behave like simple client, connecting to wayland server with binder... Can you help me testing this please?

@zanfix
Copy link
Author

zanfix commented Feb 17, 2023

Hi, yes sure.
Should the conversation be moved somewhere else then?

@twaik
Copy link
Member

twaik commented Mar 3, 2023

@zanfix Can I close this?

@zanfix
Copy link
Author

zanfix commented Mar 3, 2023

I think so yes

@twaik twaik closed this as completed Mar 3, 2023
@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
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants