First of all, you can enable ssh by creating a file named ssh
without any extension on your SD card and rebooting your Pi. Then you can connect to your Pi through ssh from another machine by using ssh pi@yourPiName.local
(where yourPiName is raspberry or whatever you set) or ssh pi@yourPiIpAddress
)where yourPiIpAddress is the IP address of your Pi) and using sudo raspi-config
to change settings to enable VNC.
Secondly, according to here:
The RPi must be set to boot to desktop (service mode).
If a HDMI monitor is not attached then you need to specify a screen resolution in config.txt
Use GUI config tool or sudo raspi-config to do that.
If not booting to desktop then you need to use virtual mode. (Run vncserver from the command line).
You can set the resolution from ssh
:
- by using the
sudo raspi-config
command and then selecting 7 Advanced Operations
followed by 5 Resolution
- by using the
sudo nano /boot/config.txt
(or another text editor, I prefer nano) and uncommenting several lines and setting the mode like below (hdmi_mode=16 is 1024x768):
# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
hdmi_group=2
hdmi_mode=16
More info here: Troubleshooting VNC Server / Changing the Raspberry Pi’s screen resolution
If you continue to get the error still then try:
After changing the resolution to the highest it was solved (sudo raspi-config)