TurboVNC / turbovnc

Main TurboVNC repository
https://TurboVNC.org
GNU General Public License v2.0
747 stars 137 forks source link

vncserver fails at startup on Jetson NX (Arm64) in user-mode #346

Closed gorghino closed 1 year ago

gorghino commented 1 year ago

Hi, I recently installed turbovnc in my Jetson NX (custom carrierboard) with latest Jetpack 5.0.2 but I got an immediate kill after starting a vncserver in user-mode. Apparently it works with sudo only.

I built it from sources with CMAKE_BUILD_TYPE=RelWithDebInfo (to paste logs here).

Linux nvidia-a208 5.10.104-tegra #6 SMP PREEMPT Sun Oct 9 15:25:29 CST 2022 aarch64 aarch64 aarch64 GNU/Linux

# R35 (release), REVISION: 1.0, GCID: 31346300, BOARD: t186ref, EABI: aarch64, DATE: Thu Aug 25 18:41:45 UTC 2022

vncserver Log:

nvidia@nvidia-a208:~/turbovnc/build/bin$ cat /home/nvidia/.vnc/nvidia-a208:1.log
TurboVNC Server (Xvnc) 64-bit v3.0.2 (build 20221021)
Copyright (C) 1999-2022 The VirtualGL Project and many others (see README.txt)
Visit http://www.TurboVNC.org for more information on TurboVNC

21/10/2022 14:40:56 Enabled security type 'vnc'
21/10/2022 14:40:56 Enabled security type 'otp'
21/10/2022 14:40:56 Enabled security type 'unixlogin'
21/10/2022 14:40:56 Enabled security type 'plain'
21/10/2022 14:40:56 Desktop name 'TurboVNC: nvidia-a208:1 (nvidia)' (nvidia-a208:1)
21/10/2022 14:40:56 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
21/10/2022 14:40:56 Listening for VNC connections on TCP port 5901
21/10/2022 14:40:56   Interface 0.0.0.0
21/10/2022 14:40:56 Framebuffer: BGRX 8/8/8/8
21/10/2022 14:40:56 New desktop size: 1240 x 900
21/10/2022 14:40:56 New screen layout:
21/10/2022 14:40:56   0x00000040 (output 0x00000040): 1240x900+0+0
21/10/2022 14:40:56 Maximum clipboard transfer size: 1048576 bytes
21/10/2022 14:40:56 VNC extension running!
xstartup.turbovnc: Creating new session bus instance:
xstartup.turbovnc:   unix:abstract=/tmp/dbus-sX805FHOed,guid=ed9675cf767f433cbff241f363527739
xstartup.turbovnc: Using 'ubuntu' window manager in
xstartup.turbovnc:   /usr/share/xsessions/ubuntu.desktop
xstartup.turbovnc: Executing /etc/X11/Xsession "env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd --session=ubuntu"
Killing Xvnc process ID 58332

Xvnc log:

nvidia@nvidia-a208:~/turbovnc/build/bin$ ./Xvnc
TurboVNC Server (Xvnc) 64-bit v3.0.2 (build 20221021)
Copyright (C) 1999-2022 The VirtualGL Project and many others (see README.txt)
Visit http://www.TurboVNC.org for more information on TurboVNC

21/10/2022 14:42:36 Enabled security type 'vnc'
21/10/2022 14:42:36 Enabled security type 'otp'
21/10/2022 14:42:36 Enabled security type 'unixlogin'
21/10/2022 14:42:36 Enabled security type 'plain'
(EE) Segmentation fault at address 0x0
(EE) 
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE) 
Aborted (core dumped)

GDB:

(gdb) r
Starting program: /home/nvidia/turbovnc/build/bin/Xvnc 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
TurboVNC Server (Xvnc) 64-bit v3.0.2 (build 20221021)
Copyright (C) 1999-2022 The VirtualGL Project and many others (see README.txt)
Visit http://www.TurboVNC.org for more information on TurboVNC

21/10/2022 14:44:15 Enabled security type 'vnc'
21/10/2022 14:44:15 Enabled security type 'otp'
21/10/2022 14:44:15 Enabled security type 'unixlogin'
21/10/2022 14:44:15 Enabled security type 'plain'

Program received signal SIGSEGV, Segmentation fault.
0x0000aaaaaababdf8 in rfbClipScreens ()
(gdb) backtrace
#0  0x0000aaaaaababdf8 in rfbClipScreens ()
#1  0x0000aaaaaaba5f58 in OsVendorInit ()
#2  0x0000aaaaaac5518c in OsInit ()
#3  0x0000aaaaaab4ecf4 in dix_main ()
#4  0x0000fffff7b75e10 in __libc_start_main (main=0xaaaaaab4eac0 <main>, argc=1, argv=0xfffffffff378, init=<optimized out>, 
    fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>) at ../csu/libc-start.c:308
#5  0x0000aaaaaab4eaf8 in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Valgrind:

nvidia@nvidia-a208:~/turbovnc/build/bin$ valgrind ./Xvnc 
==58704== Memcheck, a memory error detector
==58704== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==58704== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==58704== Command: ./Xvnc
==58704== 
TurboVNC Server (Xvnc) 64-bit v3.0.2 (build 20221021)
Copyright (C) 1999-2022 The VirtualGL Project and many others (see README.txt)
Visit http://www.TurboVNC.org for more information on TurboVNC

21/10/2022 14:46:17 Enabled security type 'vnc'
21/10/2022 14:46:17 Enabled security type 'otp'
21/10/2022 14:46:17 Enabled security type 'unixlogin'
21/10/2022 14:46:17 Enabled security type 'plain'
==58704== Invalid read of size 8
==58704==    at 0x213DF8: rfbClipScreens (in /home/nvidia/turbovnc/build/bin/Xvnc)
==58704==    by 0x20DF57: OsVendorInit (in /home/nvidia/turbovnc/build/bin/Xvnc)
==58704==    by 0x2BD18B: OsInit (in /home/nvidia/turbovnc/build/bin/Xvnc)
==58704==    by 0x1B6CF3: dix_main (in /home/nvidia/turbovnc/build/bin/Xvnc)
==58704==    by 0x4B8AE0F: (below main) (libc-start.c:308)
==58704==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==58704== 
(EE) Segmentation fault at address 0x0
(EE) 
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE) 
==58704== 
==58704== Process terminating with default action of signal 6 (SIGABRT)
==58704==    at 0x4B9DD78: raise (raise.c:51)
==58704==    by 0x4B8AAAB: abort (abort.c:79)
==58704==    by 0x2BFD77: OsAbort (in /home/nvidia/turbovnc/build/bin/Xvnc)
==58704==    by 0x2BA38F: AbortServer (in /home/nvidia/turbovnc/build/bin/Xvnc)
==58704==    by 0x2BB0BB: FatalError (in /home/nvidia/turbovnc/build/bin/Xvnc)
==58704==    by 0x2BD023: OsSigHandler (in /home/nvidia/turbovnc/build/bin/Xvnc)
==58704==    by 0x580C5DDB: ??? (in /usr/lib/aarch64-linux-gnu/valgrind/memcheck-arm64-linux)
==58704== 
==58704== HEAP SUMMARY:
==58704==     in use at exit: 1,064 bytes in 2 blocks
==58704==   total heap usage: 12 allocs, 10 frees, 6,254 bytes allocated
==58704== 
==58704== LEAK SUMMARY:
==58704==    definitely lost: 0 bytes in 0 blocks
==58704==    indirectly lost: 0 bytes in 0 blocks
==58704==      possibly lost: 0 bytes in 0 blocks
==58704==    still reachable: 1,064 bytes in 2 blocks
==58704==         suppressed: 0 bytes in 0 blocks
==58704== Rerun with --leak-check=full to see details of leaked memory
==58704== 
==58704== For lists of detected and suppressed errors, rerun with: -s
==58704== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Aborted (core dumped)

Thank you!

dcommander commented 1 year ago

It's odd that there don't appear to be debugging symbols in your build. (RelWithDebInfo is supposed to add those.) Thus, it's difficult to determine exactly where in the code the segfault is occurring or why. I can't see any obvious reason why a segfault would occur in rfbClipScreens(). You're going to have to do more digging, since I have no way of reproducing this failure on my end. (I have an Arm64 SoC running Ubuntu, but it works fine with TurboVNC.)

dcommander commented 1 year ago

@gorghino Do you have any further information regarding the bug? Can you determine the proximate cause of the segfault, for instance?

gorghino commented 1 year ago

Hi @dcommander Sorry for the big delay with the answer but I've used a different machine in last months. I got back my Nvidia devkit and I tried again to compile turbovnc. I still have problem with running it though.

Build log: turbovnc_build.log

I'm using it without any EDID HDMI dongle nor HDMI screen connected to the carrier board. In fact DISPLAY is not set. (is this the problem?)

nvidia@nvidia-desktop:~/turbovnc/build$ gdb /opt/TurboVNC/bin/Xvnc
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/TurboVNC/bin/Xvnc...
(gdb) r
Starting program: /opt/TurboVNC/bin/Xvnc 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
TurboVNC Server (Xvnc) 64-bit v3.0.3 (build 20230102)
Copyright (C) 1999-2022 The VirtualGL Project and many others (see README.txt)
Visit http://www.TurboVNC.org for more information on TurboVNC

02/01/2023 06:48:51 Using security configuration file /opt/TurboVNC/etc/turbovncserver-security.conf
02/01/2023 06:48:51 Enabled security type 'tlsvnc'
02/01/2023 06:48:51 Enabled security type 'tlsotp'
02/01/2023 06:48:51 Enabled security type 'tlsplain'
02/01/2023 06:48:51 Enabled security type 'x509vnc'
02/01/2023 06:48:51 Enabled security type 'x509otp'
02/01/2023 06:48:51 Enabled security type 'x509plain'
02/01/2023 06:48:51 Enabled security type 'vnc'
02/01/2023 06:48:51 Enabled security type 'otp'
02/01/2023 06:48:51 Enabled security type 'unixlogin'
02/01/2023 06:48:51 Enabled security type 'plain'

Program received signal SIGSEGV, Segmentation fault.
0x0000aaaaaabaefb8 in rfbClipScreens (list=list@entry=0xaaaaab0b8718 <rfbScreens>, w=0, h=0) at /home/nvidia/turbovnc/unix/Xvnc/programs/Xserver/hw/vnc/rfbscreen.c:39
39    xorg_list_for_each_entry_safe(screen, tmp, list, entry) {
(gdb) backtrace
#0  0x0000aaaaaabaefb8 in rfbClipScreens (list=list@entry=0xaaaaab0b8718 <rfbScreens>, w=0, h=0) at /home/nvidia/turbovnc/unix/Xvnc/programs/Xserver/hw/vnc/rfbscreen.c:39
#1  0x0000aaaaaabaa118 in OsVendorInit () at /home/nvidia/turbovnc/unix/Xvnc/programs/Xserver/hw/vnc/init.c:1612
#2  0x0000aaaaaac58d74 in OsInit () at /home/nvidia/turbovnc/unix/Xvnc/programs/Xserver/os/osinit.c:317
#3  0x0000aaaaaab53e04 in dix_main (argc=1, argv=0xffffffff1a98, envp=<optimized out>) at /home/nvidia/turbovnc/unix/Xvnc/programs/Xserver/dix/main.c:154
#4  0x0000fffff7bbde10 in __libc_start_main (main=0xaaaaaab53bd0 <main>, argc=1, argv=0xffffffff1a98, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=<optimized out>) at ../csu/libc-start.c:308
#5  0x0000aaaaaab53c08 in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

VALGRIND

nvidia@nvidia-desktop:~$ valgrind --leak-check=full --show-leak-kinds=all /opt/TurboVNC/bin/Xvnc
==3044== Memcheck, a memory error detector
==3044== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3044== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==3044== Command: /opt/TurboVNC/bin/Xvnc
==3044== 
TurboVNC Server (Xvnc) 64-bit v3.0.3 (build 20230102)
Copyright (C) 1999-2022 The VirtualGL Project and many others (see README.txt)
Visit http://www.TurboVNC.org for more information on TurboVNC

02/01/2023 06:57:39 Using security configuration file /opt/TurboVNC/etc/turbovncserver-security.conf
02/01/2023 06:57:39 Enabled security type 'tlsvnc'
02/01/2023 06:57:39 Enabled security type 'tlsotp'
02/01/2023 06:57:39 Enabled security type 'tlsplain'
02/01/2023 06:57:39 Enabled security type 'x509vnc'
02/01/2023 06:57:39 Enabled security type 'x509otp'
02/01/2023 06:57:39 Enabled security type 'x509plain'
02/01/2023 06:57:39 Enabled security type 'vnc'
02/01/2023 06:57:39 Enabled security type 'otp'
02/01/2023 06:57:39 Enabled security type 'unixlogin'
02/01/2023 06:57:39 Enabled security type 'plain'
==3044== Invalid read of size 8
==3044==    at 0x216FB8: rfbClipScreens (rfbscreen.c:39)
==3044==    by 0x212117: OsVendorInit (init.c:1612)
==3044==    by 0x2C0D73: OsInit (osinit.c:317)
==3044==    by 0x1BBE03: dix_main (main.c:154)
==3044==    by 0x4B42E0F: (below main) (libc-start.c:308)
==3044==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==3044== 
(EE) Segmentation fault at address 0x0
(EE) 
Fatal server error:
(EE) Caught signal 11 (Segmentation fault). Server aborting
(EE) 
==3044== 
==3044== Process terminating with default action of signal 6 (SIGABRT)
==3044==    at 0x4B55D78: raise (raise.c:51)
==3044==    by 0x4B42AAB: abort (abort.c:79)
==3044==    by 0x2C395F: OsAbort (utils.c:1351)
==3044==    by 0x2BDF77: AbortServer (log.c:872)
==3044==    by 0x2BECA3: FatalError (log.c:1010)
==3044==    by 0x2C0C0B: OsSigHandler (osinit.c:156)
==3044==    by 0x2C0C0B: OsSigHandler (osinit.c:110)
==3044==    by 0x580C5DDB: ??? (in /usr/lib/aarch64-linux-gnu/valgrind/memcheck-arm64-linux)
==3044== 
==3044== HEAP SUMMARY:
==3044==     in use at exit: 1,064 bytes in 2 blocks
==3044==   total heap usage: 19 allocs, 17 frees, 10,402 bytes allocated
==3044== 
==3044== 40 bytes in 1 blocks are still reachable in loss record 1 of 2
==3044==    at 0x484C0A4: calloc (in /usr/lib/aarch64-linux-gnu/valgrind/vgpreload_memcheck-arm64-linux.so)
==3044==    by 0x2C0FDF: ospoll_create (ospoll.c:226)
==3044==    by 0x2C0CFB: OsInit (osinit.c:205)
==3044==    by 0x1BBE03: dix_main (main.c:154)
==3044==    by 0x4B42E0F: (below main) (libc-start.c:308)
==3044== 
==3044== 1,024 bytes in 1 blocks are still reachable in loss record 2 of 2
==3044==    at 0x4849CC4: malloc (in /usr/lib/aarch64-linux-gnu/valgrind/vgpreload_memcheck-arm64-linux.so)
==3044==    by 0x484C30F: realloc (in /usr/lib/aarch64-linux-gnu/valgrind/vgpreload_memcheck-arm64-linux.so)
==3044==    by 0x2BF183: LogSWrite (log.c:624)
==3044==    by 0x2BF2CF: LogVMessageVerbSigSafe (log.c:776)
==3044==    by 0x2BE053: VErrorFSigSafe (log.c:1042)
==3044==    by 0x2BE053: ErrorFSigSafe (log.c:1051)
==3044==    by 0x2C0BD7: OsSigHandler (osinit.c:148)
==3044==    by 0x2C0BD7: OsSigHandler (osinit.c:110)
==3044==    by 0x580C5DDB: ??? (in /usr/lib/aarch64-linux-gnu/valgrind/memcheck-arm64-linux)
==3044== 
==3044== LEAK SUMMARY:
==3044==    definitely lost: 0 bytes in 0 blocks
==3044==    indirectly lost: 0 bytes in 0 blocks
==3044==      possibly lost: 0 bytes in 0 blocks
==3044==    still reachable: 1,064 bytes in 2 blocks
==3044==         suppressed: 0 bytes in 0 blocks
==3044== 
==3044== For lists of detected and suppressed errors, rerun with: -s
==3044== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Aborted (core dumped)
dcommander commented 1 year ago

The crux of the issue is that Xvnc should not be launched directly, and I'm sorry it took me so long to notice that you were doing that. You should use the vncserver script to launch it, as documented in the User's Guide and elsewhere. I can confirm that attempting to start Xvnc with no arguments causes a segfault, and I will fix that, but that particular use case has never been supported. In general, Xvnc isn't useful unless you at least pass -rfbauth to it. Basically, the segfault was hiding a more friendly error that would have occurred had you tried to actually connect to the server.

gorghino commented 1 year ago

Hi @dcommander I checked why I was posting Xvnc logs (launching Xvnc directly) and everything started with a killed Xvnc process during vncserver command.

nvidia@ubuntu:~$ /opt/TurboVNC/bin/vncserver 

Desktop 'TurboVNC: ubuntu:1 (nvidia)' started on display ubuntu:1

Starting applications specified in /opt/TurboVNC/bin/xstartup.turbovnc
Log file is /home/nvidia/.vnc/ubuntu:1.log

nvidia@ubuntu:~$ ps aux | grep vnc
nvidia      3426  0.0  0.0  10304   656 pts/0    S+   12:50   0:00 grep --color=auto vnc

nvidia@ubuntu:~$ cat /home/nvidia/.vnc/ubuntu:1.log
TurboVNC Server (Xvnc) 64-bit v3.0.2 (build 20221128)
Copyright (C) 1999-2022 The VirtualGL Project and many others (see README.txt)
Visit http://www.TurboVNC.org for more information on TurboVNC

27/02/2023 12:50:25 Using security configuration file /etc/turbovncserver-security.conf
27/02/2023 12:50:25 Enabled security type 'tlsvnc'
27/02/2023 12:50:25 Enabled security type 'tlsotp'
27/02/2023 12:50:25 Enabled security type 'tlsplain'
27/02/2023 12:50:25 Enabled security type 'x509vnc'
27/02/2023 12:50:25 Enabled security type 'x509otp'
27/02/2023 12:50:25 Enabled security type 'x509plain'
27/02/2023 12:50:25 Enabled security type 'vnc'
27/02/2023 12:50:25 Enabled security type 'otp'
27/02/2023 12:50:25 Enabled security type 'unixlogin'
27/02/2023 12:50:25 Enabled security type 'plain'
27/02/2023 12:50:25 Desktop name 'TurboVNC: ubuntu:1 (nvidia)' (ubuntu:1)
27/02/2023 12:50:25 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
27/02/2023 12:50:25 Listening for VNC connections on TCP port 5901
27/02/2023 12:50:25   Interface 0.0.0.0
27/02/2023 12:50:25 Framebuffer: BGRX 8/8/8/8
27/02/2023 12:50:25 New desktop size: 1240 x 900
27/02/2023 12:50:25 New screen layout:
27/02/2023 12:50:25   0x00000040 (output 0x00000040): 1240x900+0+0
27/02/2023 12:50:25 Maximum clipboard transfer size: 1048576 bytes
27/02/2023 12:50:25 VNC extension running!
xstartup.turbovnc: Creating new session bus instance:
xstartup.turbovnc:   unix:abstract=/tmp/dbus-VzHj9iz2Ir,guid=74bebb42957d0c37f43e86a463fc6ed2
xstartup.turbovnc: Using 'ubuntu' window manager in
xstartup.turbovnc:   /usr/share/xsessions/ubuntu.desktop
xstartup.turbovnc: Executing /etc/X11/Xsession "env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd --session=ubuntu"
Killing Xvnc process ID 3350

I added "-x" to /etc/X11/Xsession and I found the problem:

nvidia@ubuntu:~$ cat .xsession-errors
+ date
+ echo Xsession: X session started for nvidia at Mon Feb 27 15:45:56 +04 2023
Xsession: X session started for nvidia at Mon Feb 27 15:45:56 +04 2023
+ [ ! -d /etc/X11/Xsession.d ]
+ tempfile
+ WRITE_TEST=/tmp/filemMsKRV
+ echo *
+ rm -f /tmp/filemMsKRV
+ run-parts --list /etc/X11/Xsession.d
+ SESSIONFILES=/etc/X11/Xsession.d/20dbus_xdg-runtime
/etc/X11/Xsession.d/20flatpak
/etc/X11/Xsession.d/20x11-common_process-args
/etc/X11/Xsession.d/30x11-common_xresources
/etc/X11/Xsession.d/35x11-common_xhost-local
/etc/X11/Xsession.d/40x11-common_xsessionrc
/etc/X11/Xsession.d/50x11-common_determine-startup
/etc/X11/Xsession.d/55gnome-session_gnomerc
/etc/X11/Xsession.d/60x11-common_localhost
/etc/X11/Xsession.d/60x11-common_xdg_path
/etc/X11/Xsession.d/60xbrlapi
/etc/X11/Xsession.d/70im-config_launch
/etc/X11/Xsession.d/75dbus_dbus-launch
/etc/X11/Xsession.d/90atk-adaptor
/etc/X11/Xsession.d/90gpg-agent
/etc/X11/Xsession.d/90qt-a11y
/etc/X11/Xsession.d/90x11-common_ssh-agent
/etc/X11/Xsession.d/95dbus_update-activation-env
/etc/X11/Xsession.d/99x11-common_start
+ [ -n /etc/X11/Xsession.d/20dbus_xdg-runtime
/etc/X11/Xsession.d/20flatpak
/etc/X11/Xsession.d/20x11-common_process-args
/etc/X11/Xsession.d/30x11-common_xresources
/etc/X11/Xsession.d/35x11-common_xhost-local
/etc/X11/Xsession.d/40x11-common_xsessionrc
/etc/X11/Xsession.d/50x11-common_determine-startup
/etc/X11/Xsession.d/55gnome-session_gnomerc
/etc/X11/Xsession.d/60x11-common_localhost
/etc/X11/Xsession.d/60x11-common_xdg_path
/etc/X11/Xsession.d/60xbrlapi
/etc/X11/Xsession.d/70im-config_launch
/etc/X11/Xsession.d/75dbus_dbus-launch
/etc/X11/Xsession.d/90atk-adaptor
/etc/X11/Xsession.d/90gpg-agent
/etc/X11/Xsession.d/90qt-a11y
/etc/X11/Xsession.d/90x11-common_ssh-agent
/etc/X11/Xsession.d/95dbus_update-activation-env
/etc/X11/Xsession.d/99x11-common_start ]
+ set +e
+ . /etc/X11/Xsession.d/20dbus_xdg-runtime
+ [ -z unix:abstract=/tmp/dbus-AhDDPnwaFO,guid=b9fa4cf012e2a783f268d3ef63fc97f4 ]
+ [ -x /usr/bin/dbus-update-activation-environment ]
+ dbus-update-activation-environment --verbose --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-AhDDPnwaFO,guid=b9fa4cf012e2a783f268d3ef63fc97f4
dbus-update-activation-environment: setting DISPLAY=:1
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 exited with status 1
+ . /etc/X11/Xsession.d/20flatpak
+ command -v flatpak
+ unset G_MESSAGES_DEBUG
+ echo /home/nvidia/.local/share/flatpak+ 
new_dirs=
+ GIO_USE_VFS=local+  flatpak --installationsread
 -r install_path
+ share_path=/home/nvidia/.local/share/flatpak/exports/share
+ :
+ read -r install_path
+ share_path=/var/lib/flatpak/exports/share
+ :
+ read -r install_path
+ echo 
+ new_dirs=
+ export XDG_DATA_DIRS
+ XDG_DATA_DIRS=/home/nvidia/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop
+ . /etc/X11/Xsession.d/20x11-common_process-args
+ cat /etc/X11/Xsession.options
+ OPTIONS=# $Id: Xsession.options 189 2005-06-11 00:04:27Z branden $
#
# configuration options for /etc/X11/Xsession
# See Xsession.options(5) for an explanation of the available options.
allow-failsafe
allow-user-resources
allow-user-xsession
use-ssh-agent
use-session-dbus
+ /usr/bin/which env
+ STARTUP_FULL_PATH=/usr/bin/env
+ [ -n /usr/bin/env ]
+ [ -e /usr/bin/env ]
+ [ -x /usr/bin/env ]
+ STARTUP=env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd --session=ubuntu
+ . /etc/X11/Xsession.d/30x11-common_xresources
+ [ -d /etc/X11/Xresources ]
+ type xrdb
+ run-parts --list /etc/X11/Xresources
+ RESOURCEFILES=/etc/X11/Xresources/x11-common
+ [ -n /etc/X11/Xresources/x11-common ]
+ xrdb -merge /etc/X11/Xresources/x11-common
+ has_option allow-user-resources
+ [ 
allow-user-xsession
use-ssh-agent
use-session-dbus != # $Id: Xsession.options 189 2005-06-11 00:04:27Z branden $
#
# configuration options for /etc/X11/Xsession
# See Xsession.options(5) for an explanation of the available options.
allow-failsafe
allow-user-resources
allow-user-xsession
use-ssh-agent
use-session-dbus ]
+ return 0
+ [ -f /home/nvidia/.Xresources ]
+ . /etc/X11/Xsession.d/35x11-common_xhost-local
+ type xhost
+ id -un
+ xhost +si:localuser:nvidia
localuser:nvidia being added to access control list
+ . /etc/X11/Xsession.d/40x11-common_xsessionrc
+ [ -r /home/nvidia/.xsessionrc ]
+ . /home/nvidia/.xsessionrc
+ logo_path=/usr/share/backgrounds/NVIDIA_Login_Logo.png
+ [ -x /usr/bin/xsetbg ]
+ [ -r /usr/share/backgrounds/NVIDIA_Login_Logo.png ]
+ xsetbg -center /usr/share/backgrounds/NVIDIA_Login_Logo.png -border black
+ [ -x /usr/bin/xset ]
+ xset s blank s noexpose
/etc/X11/Xsession: 83: /home/nvidia/.xsessionrc: Syntax error: "(" unexpected (expecting "fi")

By default nvidia's .xsessionrc contains a string array: xsessionrc.txt remove_apps=("thunderbird" "rhythmbox" "libreoffice-writer") that fails, I guess, because it's run by sh instead of bash.

Without that section, vncserver starts correctly.

I also found a Nvidia user who had the same problem with Xrdp: https://forums.developer.nvidia.com/t/xrdp-fails-to-launch-due-to-nvidias-xsessionrc/222165

dcommander commented 1 year ago

@gorghino OK, that makes sense. You were initially seeing that issue when you used vncserver, but you were seeing the issue that I fixed in https://github.com/TurboVNC/turbovnc/commit/cb3aaace21d3a39e6cecfefe651b4d1a67cf95f9 when you tried to launch Xvnc directly.