Problem while attempting use GUI in headless mode

Did I execute the command wrong?

 x11vnc -usepw -auth /var/run/lightdm/root:0 -display :0
09/02/2021 22:20:30 -usepw: found /home/prithviraj/.vnc/passwd
09/02/2021 22:20:30 x11vnc version: 0.9.13 lastmod: 2011-08-10  pid: 7523
No protocol specified
09/02/2021 22:20:30 XOpenDisplay(":0") failed.
09/02/2021 22:20:30 Trying again with XAUTHLOCALHOSTNAME=localhost ...
No protocol specified

09/02/2021 22:20:30 ***************************************
09/02/2021 22:20:30 *** XOpenDisplay failed (:0)

*** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.
*** There may be "Xlib:" error messages above with details about the failure.

Some tips and guidelines:

** An X server (the one you wish to view) must be running before x11vnc is
   started: x11vnc does not start the X server.  (however, see the -create
   option if that is what you really want).

** You must use -display <disp>, -OR- set and export your $DISPLAY
   environment variable to refer to the display of the desired X server.
 - Usually the display is simply ":0" (in fact x11vnc uses this if you forget
   to specify it), but in some multi-user situations it could be ":1", ":2",
   or even ":137".  Ask your administrator or a guru if you are having
   difficulty determining what your X DISPLAY is.

** Next, you need to have sufficient permissions (Xauthority)
   to connect to the X DISPLAY.   Here are some Tips:

 - Often, you just need to run x11vnc as the user logged into the X session.
   So make sure to be that user when you type x11vnc.
 - Being root is usually not enough because the incorrect MIT-MAGIC-COOKIE
   file may be accessed.  The cookie file contains the secret key that
   allows x11vnc to connect to the desired X DISPLAY.
 - You can explicitly indicate which MIT-MAGIC-COOKIE file should be used
   by the -auth option, e.g.:
       x11vnc -auth /home/someuser/.Xauthority -display :0
       x11vnc -auth /tmp/.gdmzndVlR -display :0
   you must have read permission for the auth file.
   See also '-auth guess' and '-findauth' discussed below.

** If NO ONE is logged into an X session yet, but there is a greeter login
   program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need
   to find and use the raw display manager MIT-MAGIC-COOKIE file.
   Some examples for various display managers:

     gdm:     -auth /var/gdm/:0.Xauth
              -auth /var/lib/gdm/:0.Xauth
     kdm:     -auth /var/lib/kdm/A:0-crWk72
              -auth /var/run/xauth/A:0-crWk72
     xdm:     -auth /var/lib/xdm/authdir/authfiles/A:0-XQvaJk
     dtlogin: -auth /var/dt/A:0-UgaaXa

   Sometimes the command "ps wwwwaux | grep auth" can reveal the file location.

   Starting with x11vnc 0.9.9 you can have it try to guess by using:

              -auth guess

   (see also the x11vnc -findauth option.)

   Only root will have read permission for the file, and so x11vnc must be run
   as root (or copy it).  The random characters in the filenames will of course
   change and the directory the cookie file resides in is system dependent.

See also: http://www.karlrunge.com/x11vnc/faq.html
prithviraj@jetson:~$ x11vnc -usepw -auth /var/run/lightdm/root:0 -display :1
09/02/2021 22:21:06 -usepw: found /home/prithviraj/.vnc/passwd
09/02/2021 22:21:06 x11vnc version: 0.9.13 lastmod: 2011-08-10  pid: 7527
Client is not authorized to connect to Server09/02/2021 22:21:06 XOpenDisplay(":1") failed.
09/02/2021 22:21:06 Trying again with XAUTHLOCALHOSTNAME=localhost ...
Client is not authorized to connect to Server
09/02/2021 22:21:06 ***************************************
09/02/2021 22:21:06 *** XOpenDisplay failed (:1)

*** x11vnc was unable to open the X DISPLAY: ":1", it cannot continue.
*** There may be "Xlib:" error messages above with details about the failure.

Some tips and guidelines:

** An X server (the one you wish to view) must be running before x11vnc is
   started: x11vnc does not start the X server.  (however, see the -create
   option if that is what you really want).

** You must use -display <disp>, -OR- set and export your $DISPLAY
   environment variable to refer to the display of the desired X server.
 - Usually the display is simply ":0" (in fact x11vnc uses this if you forget
   to specify it), but in some multi-user situations it could be ":1", ":2",
   or even ":137".  Ask your administrator or a guru if you are having
   difficulty determining what your X DISPLAY is.

** Next, you need to have sufficient permissions (Xauthority)
   to connect to the X DISPLAY.   Here are some Tips:

 - Often, you just need to run x11vnc as the user logged into the X session.
   So make sure to be that user when you type x11vnc.
 - Being root is usually not enough because the incorrect MIT-MAGIC-COOKIE
   file may be accessed.  The cookie file contains the secret key that
   allows x11vnc to connect to the desired X DISPLAY.
 - You can explicitly indicate which MIT-MAGIC-COOKIE file should be used
   by the -auth option, e.g.:
       x11vnc -auth /home/someuser/.Xauthority -display :0
       x11vnc -auth /tmp/.gdmzndVlR -display :0
   you must have read permission for the auth file.
   See also '-auth guess' and '-findauth' discussed below.

** If NO ONE is logged into an X session yet, but there is a greeter login
   program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need
   to find and use the raw display manager MIT-MAGIC-COOKIE file.
   Some examples for various display managers:

     gdm:     -auth /var/gdm/:0.Xauth
              -auth /var/lib/gdm/:0.Xauth
     kdm:     -auth /var/lib/kdm/A:0-crWk72
              -auth /var/run/xauth/A:0-crWk72
     xdm:     -auth /var/lib/xdm/authdir/authfiles/A:0-XQvaJk
     dtlogin: -auth /var/dt/A:0-UgaaXa

   Sometimes the command "ps wwwwaux | grep auth" can reveal the file location.

   Starting with x11vnc 0.9.9 you can have it try to guess by using:

              -auth guess

   (see also the x11vnc -findauth option.)

   Only root will have read permission for the file, and so x11vnc must be run
   as root (or copy it).  The random characters in the filenames will of course
   change and the directory the cookie file resides in is system dependent.

See also: http://www.karlrunge.com/x11vnc/faq.html

/var/run/lightdm/root/:0

Also, if it still fails then you will have to either set DISPLAY=:0 (export DISPLAY=:0) or run the command as a root user or both.

@Prithviraj probably you do not have a connected display at all?
@AnishAney probably the method requires a physically connected display?
Typically it is also required to enable autologin/ disable screen lock etc in order to use VNC, as per my experience

yes…I dont have a connected display…

I think a physical display may not necessarily be required but I am not 100% sure about it, I will have to do some experiments w/ and w/o a display connected. Enabling autologin/disabling screen lock is not necessary as this offers the lock-screen page once connected through vncviewer.

with situation with disconnected display, what works, as per my experience is

However, as it creates a virtual lxde session - it has hard times running anything GL

hey @Andrey1984 …I did try that method but for some reason after installing tightvncserver and xtightvncviewer, i ran vncserver on nano…it said this…

$ vncserver

New 'X' desktop is jetson:1

Starting applications specified in /home/prithviraj/.vnc/xstartup
Log file is /home/prithviraj/.vnc/jetson:1.log

it indicates start of the server

This comes after doing all those steps…

$ xtightvncviewer
Error: Can't open display:

it indicates the argument after : is missed in the command above

how should I correct that?
like this:

xtightvncviewer 0 <password>

xtightvncviewer:1

this was displayed

$ xtightvncviewer:1
-bash: xtightvncviewer:1: command not found

putting a space still doesn’t help

 xtightvncviewer :1
Error: Can't open display:

ip address value is missed in the command above
it should be

xtightvncviewer ipaddress:1

it still says this error

I have connected the ethernet cable with the jetson and my laptop. I i run vncserver and then when i try xtightvncserver…it says this error…what am i doing wrong?

the steps should be followed in full as quoted from the original author’s post [hxn130599]

Connect JN to laptop using ethernet cable and use putty to enter SSH
in SSH, install vncserver as well as viewer:
sudo apt install tightvncserver && sudo apt instsall xtightvncviewer
then run cmd “vncserver” to enter password
edit file xstartup:
sudo nano ~/.vnc/xstartup
then add 3 lines and save:
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startlxde &
reboot JN and enter SSH again, then start vncserver and viewer:
vncserver
xtightvncviewer (enter hostname:x and pwd)
Then enjoy using remote desktop of JN with only ethernet cable :))

the display number [:x] is to be taken from output of execution of the vncserver
the hostname is the ip address of the jetson
they are variables that needt o be taken from environment then put as arguments at client that gets connected to the vncserver
your previous posts did show that you are omitting parameters that results in obvious error

Hello @Andrey1984 , first of all thanks for helping me out so much and sorry for the late response…
Secondly, can you give more light on this…

And to be clear…client here means my laptop right?

client typically refers to a computer [accessor] from that an acccessible device[server] is accessed
if yor laptop gets conencted to Jetson AGX[server] it will need to get the ip address of the server specified[ jetson ip], also the display parameter of the jetson vncserver [:x] where x will be a number

Thank you @Andrey1984 for your help…Well I was able to achieve, my task without GUI at the end but there is still some problem in the way I’m trying to set up for GUI…anyways…thanks for your contribution… I hope somebody else does benefits from this…