Realvnc-server not working on fresh install

Creating a bug report/issue

Required Information

  • DietPi version | cat /boot/dietpi/.version
  • Distro version | Bullseye 0
  • Kernel version | 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
  • Architecture | arm64
  • SBC model | RPI 3B+
  • Power supply used |cannakit 5.1v 2.5a
  • SD card used | none - boot from ssd

Additional Information (if applicable)

  • Software title | RealVNC-Server
  • Was the software title installed freshly or updated/migrated? fresh install
  • Can this issue be replicated on a fresh installation of DietPi? Yes
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

  1. …Fresh install of Dietpi
  2. …as root using dietpi-software installed lxde desktop
  3. added a new user
  4. Rebooted machine
  5. Logged in as the new user and using dietpi-software installed RealVNC-server

Behaviour after install was completed

note: no errors listed during install of RealVNC-server

  • …From a different machine using RealVNC-Client should have accessed the desktop of the machine “running” RealVNC-server.

Actual behaviour

-Atter reboot of system logged in as the new user.
Tried to access the machine from another machine using RealVNC-Viewer.
Received an error message of “The connection was refused by the computer”.
On the install machine:
Checked with systemctl --type=service --state=running, but no sign orf RealVNC services of any type…

Extra details

just tested RealVNC without issues (as user root)

Service on DietPi is called vncserver and can be checked as follow

systemctl status vncserver
journalctl -u vncserver

Can you check if there is a LISTEN port for your VNC server?

ss -tulpn | grep LISTEN

Btw: do you specify a desktop ID within RealVNC client app? If it is a virtual desktop, it should be your.ip.address:1 for example.

Here are the results from the commands you suggested:

gale@Testing~$ systemctl status vncserver
● vncserver.service - VNC Server (DietPi)
     Loaded: loaded (/etc/systemd/system/vncserver.service; enabled; vendor preset: enabled)
     Active: active (exited) since Mon 2023-07-03 17:04:28 EDT; 1h 41min ago
    Process: 446 ExecStart=/usr/local/bin/vncserver start (code=exited, status=0/SUCCESS)
   Main PID: 446 (code=exited, status=0/SUCCESS)
        CPU: 44ms
gale@Testing:~$ journalctl -u vncserver
-- Journal begins at Mon 2023-07-03 17:04:25 EDT, ends at Mon 2023-07-03 18:49:20 EDT. --
Jul 03 17:04:28 Testing systemd[1]: Started VNC Server (DietPi).
Jul 03 17:04:28 Testing systemd[446]: pam_unix(login:session): session opened for user root(uid=0) by (uid=0)
gale@Testing:~$ ss -tulpn | grep LISTEN
tcp   LISTEN 0      128          0.0.0.0:6001      0.0.0.0:*          
tcp   LISTEN 0      5            0.0.0.0:5901      0.0.0.0:*          
tcp   LISTEN 0      128          0.0.0.0:22        0.0.0.0:*          
tcp   LISTEN 0      128             [::]:6001         [::]:*          
tcp   LISTEN 0      5               [::]:5901         [::]:*          
tcp   LISTEN 0      128             [::]:22           [::]:*

It is a normal desktop install on dietpi there is no need to specify a desktop id.
I have used Realvnc-Server on a normal Raspian install and have not had any problems with getting RealVNC-client to connect from anothe machine (both a RPI and and X64 machine running Mint Linux).
And as this was an Install using Diepi-Software (item #120) and is supposed to be preconfigured for dietpi I am trying to figure out why it nis not working.

Try to specify desktop ID 1. Your system is running in virtual desktop mode and not using the shared desktop of the physical machine.

Interesting. The :1 did get a connect, but is asking for a password. I have not been asked to set a password for vnc server so have no idea what it is asking for. Tried both my user password and even the root password. Niether one worked. Begining to look look a dietpi configuration problem with its “ready to run” and optimized software.
In fact there is no way to access the vnc server from the desktop or the command line.
Well as this is a testing setup I will just call it a dietpi bug and go with another os that actually works as it claims to do.

This is not a bug, it’s you not understanding how it’s working. Within RealVNC client, you can specify a user to be user. The password is the same as on operating system level and it need to match the user specified within the client. The server is started as root user.

I guess you missed to RTFM, before calling it a bug. Remote Desktop Access Software Options - DietPi.com Docs

The the desktop configuration shared or virtual is described, as well as the information about the user that needs to be used to connect.

Btw, there was no need to install a desktop software first, as this is part of end-to-end automation setup. You complicated it way more than it was needed just because you did not checked our docs.

I looked over the “docs” for realvcnc information and did not it did not say anything about not requiring a desktop for RealVNV-Server to work.
OK I just did a wipe and reload of a fresh dietpi -install. When I tried to do a dietpi-Software install of RealVNC-server it asked which desktop I wanted to install. I picked LXDE and it appeared to install correctly.
Tried to acces the test box using RealVNC viewer and ended up with the exact problem. RealVNC Server pops up a screen aking for a password (user name field is greyed out). Would not accept any password I tried (my user account password or root password). Once again,
"there is absolutely no way to access RealVNC-Server on the test box to set or change a login password.
If you could point me to where there is such a means to do I could probably fix the problem. I am NOT unfamilier with RealVNV-Server as I have used it in the past on several Raspberry Pi 3B+ running Raspian Desktop and was able to set a password,etc using rhe RealVNC Icon on the taskbar. Admittedly I was not expection the virtual desktop thing, but that is a minor propbem. So it keeps coming back to the fact that there is no easy way to access the RealVNC-Server setting when trying to use Dietpi.

Did a test again on 2 different RPi

  • RPi3B+ 32bit
  • RPi4B 64bit

Both running latest version of DietPi v8.19.1

To install RealVNC

dietpi-software install 120

I selected LXDE without a browser. Once completed I rebooted my systems and was able to connect from Windows as well as Android App.

I simply created a new client connected, specified IP address like 192.168.0.17:1, hit connect, accepted the new fingerprint und entered root user password. Done. Nothing more to-do.

Hm really weird, when I look into the install script is has to be the global pw :thinking:
Is it possible that on the desktop environment another keyboard layout is present, which is used when trying to connect?

You could set a new one with vncpasswd and try again.

This is the line for tigervnc. RealVNC looks similar https://github.com/MichaIng/DietPi/blob/d84586b8afa5404d2b309ed71647926fd960da83/dietpi/dietpi-software#L7301

OK maybe I was wrong with the root user password, should be global software pw. I guess docs needs to be updated as well because by default RealVNC is using a standard user and did not allow other users on Home subscriptions. Best to my knowledge, this is used on RPI device.

A couple of observations:

  1. I did another total wipe and reload of dietpi. Added a new user (also removed the dietpi user). After la reboot logged in as the new user. using dietpi-software installed lxde desktop. rebooted and loged nin again as the new user. Then did a sudo dietpi-software install 120. When it completed I now had a vnc icon on the taskbar (first time ever). rebooted an logged in again to make sure everything was working.
    Tried to access the testing machine from another box (another RPI 3B+ running dietpi and Cinnamon desktop) with RealVNC-Client. Got the screen asking for a password (user field blank and greyed out). No password worked.

  2. Tried the vncpasswd program and after setting it up for my user/user password was able to login from the client after entering my user password. User name field had my user name in it but was still greyed out.

Did not know the vncpasswd program existed. Did not notice any mention of it in the “docs”.

Password should be your global application password you specified during first run. Furthermore, realVNC server should be started as root user. The user who starts dietpi-software should not matter, as we use root user during installation. This as well should not have any effect on the user who execute RealVNC server application.

Don’t think I tried that password. Guess using realvnc-server before on Raspian got me used to using the full interactive unix login that was standard on Raspian. Oh well at least I learned a few new things and did manage to get it working on dietpi. My brain isn’t what it used to be after being retired for the last 15 years. Thank youn for your help!
I personally think that using the interactive unix login option would be a good default as unless you arre normally using a global password in other programs it might not be the first thing you would think of using for a vnc login. Or maybe putting a note in about using vncpasswd to configure it to automaticlly use the user password.

1 Like

ok we will update our online docs to reflect current situation to use the global software password. as well we could give a hint on how to change password. RealVNC | update user + password information · Issue #903 · MichaIng/DietPi-Docs · GitHub