RealVNC service fails to start Topic is solved

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
kitten-mittons
Posts: 3
Joined: Fri Sep 10, 2021 10:21 pm

RealVNC service fails to start

Post by kitten-mittons »

trying to use realvnc in a headless setup. It was working at one point, but now the vncserver service is failed. tried reinstalling, rebooting, etc but no luck. any ideas?
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: VNC service fails to start

Post by Joulinar »

pls share following

Code: Select all

systemctl status vncserver
journalctl -u vncserver
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
kitten-mittons
Posts: 3
Joined: Fri Sep 10, 2021 10:21 pm

Re: VNC service fails to start

Post by kitten-mittons »

I was able to get the service to start by setting a password for VNC, but now when I attempt to connect from VNC viewer, I get an immediate "connection was refused by the computer"

Code: Select all

dietpi@DietPi:~$ dietpi@DietPi:~$ systemctl status vncserver
● vncserver.service - VNC Server (DietPi)
     Loaded: loaded (/etc/systemd/system/vncserver.service; enabled; vendor preset: enabled)
     Active: active (exited) since Thu 2021-11-04 18:20:36 GMT; 7h ago
    Process: 429 ExecStart=/usr/local/bin/vncserver start (code=exited, status=0/SUCCESS)
   Main PID: 429 (code=exited, status=0/SUCCESS)
        CPU: 23ms

Code: Select all

root@DietPi:~# journalctl -u vncserver
-- Journal begins at Thu 2021-11-04 18:20:35 GMT, ends at Fri 2021-11-05 01:51:54 GMT. --
Nov 04 18:20:36 DietPi systemd[1]: Started VNC Server (DietPi).
Nov 04 18:20:36 DietPi systemd[429]: pam_unix(login:session): session opened for user root(uid=0) by (uid=0)
Nov 04 18:20:37 DietPi vncserver[429]: [  OK  ] RealVNC detected
Nov 04 18:20:37 DietPi vncserver[429]: [ INFO ] Starting virtual desktop at display :1 in 1280x720x16

Code: Select all

root@DietPi:~# journalctl -u vncserver
-- Journal begins at Thu 2021-11-04 18:20:35 GMT, ends at Fri 2021-11-05 01:51:54 GMT. --
Nov 04 18:20:36 DietPi systemd[1]: Started VNC Server (DietPi).
Nov 04 18:20:36 DietPi systemd[429]: pam_unix(login:session): session opened for user root(uid=0) by (uid=0)
Nov 04 18:20:37 DietPi vncserver[429]: [  OK  ] RealVNC detected
Nov 04 18:20:37 DietPi vncserver[429]: [ INFO ] Starting virtual desktop at display :1 in 1280x720x16

Code: Select all

root@DietPi:~# ss -tulpn | grep LISTEN
tcp   LISTEN 0      5          127.0.0.1:4711       0.0.0.0:*    users:(("pihole-FTL",pid=516,fd=10))                    
tcp   LISTEN 0      5            0.0.0.0:5901       0.0.0.0:*    users:(("Xvnc-core",pid=547,fd=7))                      
tcp   LISTEN 0      4096         0.0.0.0:111        0.0.0.0:*    users:(("rpcbind",pid=293,fd=4),("systemd",pid=1,fd=33))
tcp   LISTEN 0      1024         0.0.0.0:80         0.0.0.0:*    users:(("lighttpd",pid=765,fd=4))                       
tcp   LISTEN 0      64           0.0.0.0:43057      0.0.0.0:*                                                            
tcp   LISTEN 0      128          0.0.0.0:6001       0.0.0.0:*    users:(("Xvnc-core",pid=547,fd=1))                      
tcp   LISTEN 0      32           0.0.0.0:53         0.0.0.0:*    users:(("pihole-FTL",pid=516,fd=5))                     
tcp   LISTEN 0      1000         0.0.0.0:22         0.0.0.0:*    users:(("dropbear",pid=328,fd=4))                       
tcp   LISTEN 0      256        127.0.0.1:5335       0.0.0.0:*    users:(("unbound",pid=457,fd=4))                        
tcp   LISTEN 0      256        127.0.0.1:8953       0.0.0.0:*    users:(("unbound",pid=457,fd=6))                        
tcp   LISTEN 0      64              [::]:45981         [::]:*                                                            
tcp   LISTEN 0      512                *:7878             *:*    users:(("Radarr",pid=770,fd=146))                       
tcp   LISTEN 0      5              [::1]:4711          [::]:*    users:(("pihole-FTL",pid=516,fd=15))                    
tcp   LISTEN 0      5               [::]:5901          [::]:*    users:(("Xvnc-core",pid=547,fd=6))                      
tcp   LISTEN 0      4096            [::]:111           [::]:*    users:(("rpcbind",pid=293,fd=6),("systemd",pid=1,fd=35))
tcp   LISTEN 0      1024            [::]:80            [::]:*    users:(("lighttpd",pid=765,fd=5))                       
tcp   LISTEN 0      128             [::]:6001          [::]:*    users:(("Xvnc-core",pid=547,fd=0))                      
tcp   LISTEN 0      128                *:21               *:*    users:(("proftpd",pid=735,fd=0))                        
tcp   LISTEN 0      32              [::]:53            [::]:*    users:(("pihole-FTL",pid=516,fd=7))                     
tcp   LISTEN 0      1000            [::]:22            [::]:*    users:(("dropbear",pid=328,fd=5))                       
tcp   LISTEN 0      256            [::1]:8953          [::]:*    users:(("unbound",pid=457,fd=5))
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: VNC service fails to start

Post by Joulinar »

looks all fine and VNC seems to be running using desktop ID 1
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
kitten-mittons
Posts: 3
Joined: Fri Sep 10, 2021 10:21 pm

Re: VNC service fails to start

Post by kitten-mittons »

Joulinar wrote: Fri Nov 05, 2021 12:48 pm looks all fine and VNC seems to be running using desktop ID 1
Yup that was the problem, wasn't putting the :1 at the end of the IP address. Thanks!
User avatar
MichaIng
Site Admin
Posts: 3514
Joined: Sat Nov 18, 2017 6:21 pm

Re: RealVNC service fails to start

Post by MichaIng »

Try the following workaround:

Code: Select all

cd /usr/lib/arm-linux-gnueabihf
dpkg -L libraspberrypi0 | grep '/usr/lib/arm-linux-gnueabihf/.*\.so.0' | while read -r line
do
line=${line#/usr/lib/arm-linux-gnueabihf/}
ln -s "$line" "${line%.0}"
done
systemctl restart vncserver
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: RealVNC service fails to start

Post by Joulinar »

It's already fixed @MichaIng
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3514
Joined: Sat Nov 18, 2017 6:21 pm

Re: RealVNC service fails to start

Post by MichaIng »

Ah right, probably not an RPi or ARMv8 image.
Post Reply