[Solved] unable to connect through VNC Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
ghezzia
Posts: 15
Joined: Fri Nov 19, 2021 4:30 pm

[Solved] unable to connect through VNC

Post by ghezzia »

HI again,
here I am with another Newby question :)
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 192.168.1.15 and 192.168.1.15:1 as suggested here https://dietpi.com/docs/software/remote ... vnc-server
But neither with the first nor with the second I can connect.
Meanwhile, I'm still able to connect through the terminal :)
Thanks again for the suggestions
Last edited by ghezzia on Fri Nov 26, 2021 7:14 pm, edited 1 time in total.
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: unable to connect through VNC

Post by Joulinar »

Can you check on which port VNC server is LISTEN

Code: Select all

ss -tulpn | grep LISTEN
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
ghezzia
Posts: 15
Joined: Fri Nov 19, 2021 4:30 pm

Re: unable to connect through VNC

Post by ghezzia »

how can I check it?
Sorry but I'm really new in this world :)
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: unable to connect through VNC

Post by Joulinar »

I posted a command above to show all LISTEN port's
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
ghezzia
Posts: 15
Joined: Fri Nov 19, 2021 4:30 pm

Re: unable to connect through VNC

Post by ghezzia »

I'm really sorry. Didn't see it :o
this is the output:

Code: Select all

tcp   LISTEN 0      1000         0.0.0.0:22        0.0.0.0:*    users:(("dropbear",pid=198,fd=4))                                                 
tcp   LISTEN 0      511          0.0.0.0:1880      0.0.0.0:*    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?
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: unable to connect through VNC

Post by Joulinar »

yes VNC is not running. Can you check following

Code: Select all

systemctl status vncserver
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
ghezzia
Posts: 15
Joined: Fri Nov 19, 2021 4:30 pm

Re: unable to connect through VNC

Post by ghezzia »

This is the output:

Code: Select all

● 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?
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: unable to connect through VNC

Post by Joulinar »

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

Code: Select all

systemctl restart vncserver
journalctl -u vncserver
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
ghezzia
Posts: 15
Joined: Fri Nov 19, 2021 4:30 pm

Re: unable to connect through VNC

Post by ghezzia »

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

Code: Select all

-- 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?
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: unable to connect through VNC

Post by Joulinar »

ok let's try following

Code: Select all

/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.

Code: Select all

journalctl -u vncserver.service
systemctl status vncserver
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply