I have compiled the tigervnc from source on raspbian stretch and then created a systemd unit $ nano /etc/systemd/system/x0vncserver.service as follows,

[Unit]
Description=Remote desktop service (VNC)
After=default.target

[Service]
Type=forking
User=pi
ExecStart=/bin/sh -c '/usr/bin/x0vncserver -display :0 -geometry 800x600 -rfbport 5900 -passwordfile /home/pi/.vnc/passwd &'

[Install]
WantedBy=multi-user.target

and added these lines to ~/.vnc/config file

geometry=800x600
alwaysshared
dpi=64

though it is already available in the repo but the tigervncserver from the repo or my compiled one, all of them is giving me tiny desktop window whereas in tightvncserver I got a pretty good desktop resolution I am trying to use the x0vncserver feature of tigervnc for my convenience but it would be great if I can configure it to load the desktop in some higher resolution.

  • and when I run /usr/bin/x0vncserver -display :0 -geometry 800x600+0+0 -rfbport 5900 -passwordfile /home/pi/.vnc/passwd the result is, Wed Oct 11 23:25:55 2017 Geometry: Desktop geometry is set to 656x416+0+0 Main: Using evdev codemap Main: XTest extension present - version 2.2 Main: Listening on port 5900 – Pavel Sayekat Oct 11 '17 at 17:28

In order to get VNC connection, you need to install a VNC server in RPi. You can install TightVNC but it creates a separate desktop for every connection. You can go with x11vnc, if you want single desktop to be shared among every VNC client and the RPi itself.

TightVNC Server

Install TightVNC Server

$ sudo apt-get install tightvncserver

Next run TightVNC Server which will prompt you for the password and an optional View Only password.

$ tightvncserver

Once that is done you can start a VNC server from shell prompt using below command:

$ vncserver :0 -geometry 1366x768 -depth 24

Run at Boot

Create a file in /etc/init.d with any name such as vncserver with following content:

#!/bin/sh
### BEGIN INIT INFO
# Provides: vncboot
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Server at boot time
# Description: Start VNC Server at boot time.
### END INIT INFO

USER=root
HOME=/root

export USER HOME

case "$1" in
 start)
   echo "Starting VNC Server"
   #Insert your favoured settings for a VNC session
   /usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565
   ;;

 stop)
   echo "Stopping VNC Server"
   /usr/bin/vncserver -kill :0
   ;;

 *)
   echo "Usage: /etc/init.d/vncboot {start|stop}"
   exit 1
   ;;
esac

exit 0

Make the file executable using this command

$ chmod 755 /etc/init.d/vncboot

Enable dependency based boot sequencing

$ update-rc.d /etc/init.d/vncboot defaults

If enabling dependency based boot sequencing was successful, it says

$ update-rc.d: using dependency based boot sequencing

But if it says

$ update-rc.d: error: unable to read /etc/init.d//etc/init.d/vncboot

then try the following command

$ update-rc.d vncboot defaults

X11VNC Server

Install x11vnc Server

$ sudo apt-get install x11vnc

Store Password

$ x11vnc -storepasswd

Run the server from shell prompt with password

$ x11vnc -usrpw -display :0

Run at Boot Make a directory if not already made

$ mkdir ~/.config/autostart

Create a file named x11vnc.desktop or any with the following content

[Desktop Entry]
Encoding=UTF-8
Type=Application
Name=X11VNC
Exec=x11vnc -forever -usepw -display :0
StartupNotify=false
Terminal=false
Hidden=false

Now reboot your RPi, and you will have a VNC Server ready.

View full document here

up vote 0 down vote accepted

The answer lies somewhere else. As I am trying to load the 0 desktop and as it by default loads as 656x416, so it is not possible to get any higher resolution than that. To change that I had to edit the sudo nano /boot/config.txt and uncomment theses lines

framebuffer_width=1280
framebuffer_height=720

and then rebooted and this time I got a 1280x720 desktop window using x0vncserver by default :)

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.