[Solved] unable to connect through VNC

HI again,
here I am with another Newby question :slight_smile:
I installed LXDE and realVNC server using the terminal.
Then, from the dietpi-config/Autostart option, I selected option: 16 : LightDM login mask.
After rebooting, I’m not able to connect through the VNC viewer from my mac. I tried and as suggested here https://dietpi.com/docs/software/remote_desktop/#realvnc-server
But neither with the first nor with the second I can connect.
Meanwhile, I’m still able to connect through the terminal :slight_smile:
Thanks again for the suggestions

Can you check on which port VNC server is LISTEN

ss -tulpn | grep LISTEN

how can I check it?
Sorry but I’m really new in this world :slight_smile:

I posted a command above to show all LISTEN port’s

I’m really sorry. Didn’t see it :open_mouth:
this is the output:

tcp   LISTEN 0      1000*    users:(("dropbear",pid=198,fd=4))                                                 
tcp   LISTEN 0      511*    users:(("node-red",pid=547,fd=18))                                                
tcp   LISTEN 0      511                *:80              *:*    users:(("apache2",pid=423,fd=4),("apache2",pid=422,fd=4),("apache2",pid=420,fd=4))
tcp   LISTEN 0      1000            [::]:22           [::]:*    users:(("dropbear",pid=198,fd=5))                                                 
tcp   LISTEN 0      4096               *:3001            *:*    users:(("grafana-server",pid=552,fd=10))

It looks like, VNC is not here… isn’t it?

yes VNC is not running. Can you check following

systemctl status vncserver

This is the output:

● vncserver.service - VNC Server (DietPi)
     Loaded: loaded (/etc/systemd/system/vncserver.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-11-23 21:33:26 GMT; 1 day 12h ago
    Process: 893 ExecStart=/usr/local/bin/vncserver start (code=exited, status=1/FAILURE)
   Main PID: 893 (code=exited, status=1/FAILURE)
        CPU: 96ms

Warning: journal has been rotated since unit was started, output may be incomplete.

Let me guess…
Shoud I start vnc server? If yes, How?

ok let’s try to restart, which probably will fail. Let’s check logs as well

systemctl restart vncserver
journalctl -u vncserver

Restarted and, I assume looking at the output, failed as predicted:

-- Journal begins at Thu 2021-11-25 08:52:18 GMT, ends at Thu 2021-11-25 10:34:01 GMT. --
Nov 25 10:33:51 DietPi systemd[1]: Started VNC Server (DietPi).
Nov 25 10:33:51 DietPi systemd[24430]: pam_unix(login:session): session opened for user root(uid=0) by (uid=0)
Nov 25 10:33:56 DietPi systemd[1]: vncserver.service: Main process exited, code=exited, status=1/FAILURE
Nov 25 10:33:56 DietPi systemd[1]: vncserver.service: Failed with result 'exit-code'.

What shall I do now?

ok let’s try following

/usr/local/bin/vncserver start

This will most probably ask to set password. If yes, do that. Once done reboot your system and check the service after your system is back online.

journalctl -u vncserver.service
systemctl status vncserver

Thanks a lot (again) for the support.
Now everything works great :wink: .
Just a question: Does VNC start alone every time I reboot the system? Or should I manually restart it?

it should start automatically on reboot.