beta-tester
Posts: 1445
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: Set VNC resolution?

Sun Nov 24, 2019 11:42 am

Chupo_cro wrote:
Sun Nov 24, 2019 9:14 am
So what is the display's size when the monitor isn't connected and from where those numbers arrive?
if nothing else is defined in the config.txt
i guess it is the old standard VGA resolution 640x480 (the most popular resolution all monitors could handle)
or the standard analog TV resolution, because the RPi falls back to analog TV composite output, in case there is no HDMI device connected.
{ I only give negative feedback }
RPi B (256MB), B (512MB), B+, ZeroW; 2B; 3B, 3B+; 4B (4GB)

User avatar
Chupo_cro
Posts: 53
Joined: Mon Dec 14, 2015 8:45 pm
Location: Hrvatska

Re: Set VNC resolution?

Sun Nov 24, 2019 1:46 pm

beta-tester wrote:
Sun Nov 24, 2019 11:42 am
if nothing else is defined in the config.txt
i guess it is the old standard VGA resolution 640x480 (the most popular resolution all monitors could handle)
or the standard analog TV resolution, because the RPi falls back to analog TV composite output, in case there is no HDMI device connected.

So that's how it works, meaning the behaviour is hardcoded in the kernel. Thank you for the reply!
Chupo_cro

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6443
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Set VNC resolution?

Sun Nov 24, 2019 4:16 pm

Chupo_cro wrote:
Sun Nov 24, 2019 1:46 pm
beta-tester wrote:
Sun Nov 24, 2019 11:42 am
if nothing else is defined in the config.txt
i guess it is the old standard VGA resolution 640x480 (the most popular resolution all monitors could handle)
or the standard analog TV resolution, because the RPi falls back to analog TV composite output, in case there is no HDMI device connected.

So that's how it works, meaning the behaviour is hardcoded in the kernel. Thank you for the reply!
Personally, for any Pi running headless, temporally or permanently (I normally boot to command line and only to desktop via startx when required) I would use the "virtual mode" discussed earlier in the thread (and probably improved since those posts). FWIW, a few examples can be seen here: https://www.cpmspectrepi.uk/raspberry_p ... uster.html
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
Chupo_cro
Posts: 53
Joined: Mon Dec 14, 2015 8:45 pm
Location: Hrvatska

Re: Set VNC resolution?

Wed Dec 18, 2019 10:10 pm

FTrevorGowen wrote:
Sun Nov 24, 2019 4:16 pm
Personally, for any Pi running headless, temporally or permanently (I normally boot to command line and only to desktop via startx when required) I would use the "virtual mode" discussed earlier in the thread (and probably improved since those posts). FWIW, a few examples can be seen here: https://www.cpmspectrepi.uk/raspberry_p ... uster.html
Trev.

I tried that but here is what happened:

After connecting to the Pi via PuTTY, creating a virtual display:

Code: Select all

vncserver

and then running UltraVNC Viewer and connecting to xxx:xxx:xxx:xxx:1 there is an error: "No supported authentication methods!"

On the other hand, when the Pi is connected to the display and the desktop environment has been started everything works well (UltraVNC viewer asks for the password). There is a thread about changing the authentication method from UNIX password authentication to VNC password authentication but that option is already selected.

And one other thing - here it says:

To create a virtual desktop tun the command

Code: Select all

vncserver

And then there is:

Operating VNC Server at the command line
To start VNC Server at next boot, and every subsequent boot:

Code: Select all

sudo systemctl enable vncserver-x11-serviced.service

Is there a way to start VNC Server in virtual mode at next boot, and every subsequent boot?
Chupo_cro

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6443
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Set VNC resolution?

Wed Dec 18, 2019 10:50 pm

Chupo_cro wrote:
Wed Dec 18, 2019 10:10 pm
FTrevorGowen wrote:
Sun Nov 24, 2019 4:16 pm
Personally, for any Pi running headless, temporally or permanently (I normally boot to command line and only to desktop via startx when required) I would use the "virtual mode" discussed earlier in the thread (and probably improved since those posts). FWIW, a few examples can be seen here: https://www.cpmspectrepi.uk/raspberry_p ... uster.html
Trev.
I tried that but here is what happened:

After connecting to the Pi via PuTTY, creating a virtual display:

Code: Select all

vncserver
and then running UltraVNC Viewer and connecting to xxx:xxx:xxx:xxx:1 there is an error: "No supported authentication methods!"

On the other hand, when the Pi is connected to the display and the desktop environment has been started everything works well (UltraVNC viewer asks for the password). There is a thread about changing the authentication method from UNIX password authentication to VNC password authentication but that option is already selected.

...
I don't use "UltraVNC Viewer" but a version of "RealVNC Viewer" for the remote m/c in use:
http://www.cpmspectrepi.uk/raspberry_pi ... Pixel.html
http://www.cpmspectrepi.uk/raspberry_pi ... uster.html
and that works for both with the desktop + display and for the virtual mode (as shown in the linked pages above) so maybe what you're seeing is a UltraVNC/RealVNC compatibility issue.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
Chupo_cro
Posts: 53
Joined: Mon Dec 14, 2015 8:45 pm
Location: Hrvatska

Re: Set VNC resolution?

Wed Dec 18, 2019 11:42 pm

FTrevorGowen wrote:
Wed Dec 18, 2019 10:50 pm
I don't use "UltraVNC Viewer" but a version of "RealVNC Viewer" for the remote m/c in use:
http://www.cpmspectrepi.uk/raspberry_pi ... Pixel.html
http://www.cpmspectrepi.uk/raspberry_pi ... uster.html
and that works for both with the desktop + display and for the virtual mode (as shown in the linked pages above) so maybe what you're seeing is a UltraVNC/RealVNC compatibility issue.
Trev.

As I said, UltraVNC Viewer does work when I am not using virtual mode. According to this post:
By default, the RealVNC Server uses "UNIX Password" authentication, which allows you to login using system account credentials (e.g. pi/raspberry). However, this security type is only supported by the RealVNC Viewer. If you wish to use other viewers, then you will need to configure the server to use "VNC Password" authentication (you can select this on the Security page of the VNC Server Options dialog), and specify a separate password for use with VNC.

it seems to me the authentication type (UNIX password authentication vs VNC password authentication) specified in the Raspberry Pi's VNC's GUI affects only the VNC instance which starts with the OS but not the virtual display started via vncserver command typed in the command line.

Maybe I am wrong but it seems to me as the authentication type for the virtual display started via vncserver defaults to UNIX password authentication which doesn't work with UltraVNC Viewer. There must be a way to specify the authentication type when runing vncserver from the command line.

Here is another similar case:
But I run in another problem. On my window pc I installed UltraVNC Viewer and tried to connect to my raspberry but I get the error "No supported authentication methods". So any advice on how to solve this? Do I really have to use RealVNC Viewer?

And later someone said:
In order to connect from another VNC viewer, you need to set the authentication type to vnc authentication, and set a vnc password, since other viewers don't support vnc system authentication.

and the reply was:
Thx for this advice as well. Switching to vnc system authentication did it.

UltraVNC Viewer apparently works with RealVNC (I've been using it for a long time) but some setting is obviously different when using virtual mode compared to service mode server.
Chupo_cro

User avatar
Chupo_cro
Posts: 53
Joined: Mon Dec 14, 2015 8:45 pm
Location: Hrvatska

Re: Set VNC resolution?

Mon Dec 23, 2019 12:18 am

FTrevorGowen wrote:
Wed Dec 18, 2019 10:50 pm
I don't use "UltraVNC Viewer" but a version of "RealVNC Viewer" for the remote m/c in use:
http://www.cpmspectrepi.uk/raspberry_pi ... Pixel.html
http://www.cpmspectrepi.uk/raspberry_pi ... uster.html
and that works for both with the desktop + display and for the virtual mode (as shown in the linked pages above) so maybe what you're seeing is a UltraVNC/RealVNC compatibility issue.
Trev.

I tried to connect from Windows computer via RealVNC viewer (standalone .exe VNC-Viewer-6.19.1115-Windows-64bit.exe) and that worked. The reason why it doesn't work with UltraVNC is because starting the VNC server in virtual mode:

Code: Select all

vncserver-virtual -randr=1920x1080

does not take into an account the authentication settings set in the VNC's GUI. In other words, when starting the server in virtual mode the authentication type is still "UNIX password" regardless of the option (VNC password) set in the VNC's GUI.

I didn't find a way to specify the authentication type when starting vncserver-virtual from the command line but I saw there is an user here on the forum who works for RealVNC and maybe he would know how/if it could be done.
Chupo_cro

jasiu
Posts: 1
Joined: Fri Aug 25, 2017 9:00 am

Re: Set VNC resolution?

Mon Jan 20, 2020 10:04 am

Hello
If You are running vnc (Xvnc, RealVNC) as user pi, create file config in ~/.vnc

Code: Select all

pi@raspberrypi:~/.vnc $ pwd
/home/pi/.vnc
pi@raspberrypi:~/.vnc $ cat config
-geometry 1280x720
pi@raspberrypi:~/.vnc $
test it

Code: Select all

$ vncserver -test
VNC(R) Server 6.6.0 (r41949) ARMv6 (Sep 20 2019 16:34:47)
Copyright (C) 2002-2019 RealVNC Ltd.
RealVNC and VNC are trademarks of RealVNC Ltd and are protected by trademark
registrations and/or pending trademark applications in the European Union,
United States of America and other jurisdictions.
Protected by UK patent 2481870; US patent 8760366; EU patent 2652951.
See https://www.realvnc.com for information on VNC.
For third party acknowledgements see:
https://www.realvnc.com/docs/6/foss.html
OS: Raspbian GNU/Linux 9, Linux 4.19.49v6v7, armv7l

On some distributions (in particular Red Hat), you may get a better experience
by running vncserver-virtual in conjunction with the system Xorg server, rather
than the old version built-in to Xvnc. More desktop environments and
applications will likely be compatible. For more information on this alternative
implementation, please see: https://www.realvnc.com/doclink/kb-546

Running applications in /home/pi/.vnc/xstartup

/usr/bin/Xvnc :1 -auth /home/pi/.Xauthority -pn -fp built-ins -geometry 1280x720

Run vncserver from command line (under tmux etc...) and check if there is expected resolution.
Afrer that try do run vncserver at boot.

check options

Code: Select all

vncserver -list |less
see more https://stackoverflow.com/questions/158 ... n-in-linux

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6443
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Set VNC resolution?

Mon Jan 20, 2020 11:52 am

Chupo_cro wrote:
Mon Dec 23, 2019 12:18 am

I tried to connect from Windows computer via RealVNC viewer (standalone .exe VNC-Viewer-6.19.1115-Windows-64bit.exe) and that worked. The reason why it doesn't work with UltraVNC is because starting the VNC server in virtual mode:

Code: Select all

vncserver-virtual -randr=1920x1080
does not take into an account the authentication settings set in the VNC's GUI. In other words, when starting the server in virtual mode the authentication type is still "UNIX password" regardless of the option (VNC password) set in the VNC's GUI.

I didn't find a way to specify the authentication type when starting vncserver-virtual from the command line but I saw there is an user here on the forum who works for RealVNC and maybe he would know how/if it could be done.
Hmm ... I don't use the vncserver command as you've stated above but the recommended form from the RPF documentation ie. simply something like

Code: Select all

vncserver -geometry 1200x675
for a reduced size 16:9 display but that's with RealVNC's viewer. Do you have any specific reason for not using the viewer that is directly associated with the default server provided in Raspbian?
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
sconemad
Posts: 234
Joined: Thu Apr 28, 2016 1:47 pm
Location: Cambridge, UK
Contact: Website

Re: Set VNC resolution?

Mon Jan 20, 2020 4:46 pm

Hi, Andy from RealVNC here. I'll try to clear up some of the confusion if I can:

"vncserver" is an alias for "vncserver-virtual" (it's actually a symbolic link), so both should be equivalent (we changed it to vncserver-virtual a while back in an attempt to make it clearer that the command is creating a virtual mode session).

The "-randr" argument specifies a comma-separated list of screen geometries that can be used by the session. The first one will be used by default unless something different is specified using the "-geometry" argument. If you only specify one argument, "-randr" and "-geometry" are effectively equivalent.

Configuring a virtual mode session can be done graphically via the systray icon within the session, however you obviously need to be able to connect to the session in order to do this! I'd recommend using the RealVNC viewer since that will allow you to connect by default and will give you a secure connection. To connect with an alternative viewer, you'd need to configure it manually by editing ~/.vnc/config.d/Xvnc. There's also a command line utility "vncpasswd" which will let you set a VNC password.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6443
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Set VNC resolution?

Mon Jan 20, 2020 5:34 pm

sconemad wrote:
Mon Jan 20, 2020 4:46 pm
Hi, Andy from RealVNC here. I'll try to clear up some of the confusion if I can:

"vncserver" is an alias for "vncserver-virtual" (it's actually a symbolic link), so both should be equivalent (we changed it to vncserver-virtual a while back in an attempt to make it clearer that the command is creating a virtual mode session).

The "-randr" argument specifies a comma-separated list of screen geometries that can be used by the session. The first one will be used by default unless something different is specified using the "-geometry" argument. If you only specify one argument, "-randr" and "-geometry" are effectively equivalent.

Configuring a virtual mode session can be done graphically via the systray icon within the session, however you obviously need to be able to connect to the session in order to do this! I'd recommend using the RealVNC viewer since that will allow you to connect by default and will give you a secure connection. To connect with an alternative viewer, you'd need to configure it manually by editing ~/.vnc/config.d/Xvnc. There's also a command line utility "vncpasswd" which will let you set a VNC password.
Thanks for the clarification - I'll update my own notes (linked to in an earlier post) to include that info. At the moment I can't find where I picked up the info. w.r.t. the -geometry parameter (ie. it's not in here: https://www.raspberrypi.org/documentati ... /README.md but probably in an example elsewhere within the RPF docs). However I've just checked and discovered that man vncserver-virtual does bring up the man pages ( :D ), whereas man vncserver is no help at all - not surprising with hindsight.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) but Buster on the P3B+, P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

JimInWoodstock
Posts: 2
Joined: Sun May 31, 2020 8:48 pm

Re: Set VNC resolution?

Sun May 31, 2020 8:57 pm

After reading this post and trying most of the suggestions, I stumbled onto the following. I am using the latest version of Buster on a Pi 4.

I uncommented the console size and set the defaults

# uncomment to force a console size. By default it will be display's size minus
# overscan.
framebuffer_width=1920
framebuffer_height=1080

I then commented out the "enable" line in the pi4 section

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
#dtoverlay=vc4-fkms-v3d
max_framebuffers=2

Both changes were needed. After making both edits, the display is perfect.

pxh
Posts: 5
Joined: Wed Dec 04, 2019 4:32 pm

Re: Set VNC resolution?

Sat Feb 27, 2021 12:51 am

JimInWoodstock wrote: After reading this post and trying most of the suggestions, I stumbled onto the following. I am using the latest version of Buster on a Pi 4.

I uncommented the console size and set the defaults

# uncomment to force a console size. By default it will be display's size minus
# overscan.
framebuffer_width=1920
framebuffer_height=1080

I then commented out the "enable" line in the pi4 section

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
#dtoverlay=vc4-fkms-v3d
max_framebuffers=2

Both changes were needed. After making both edits, the display is perfect.
Thank you! Lifesaver!! :D

Return to “Raspberry Pi OS”