DietPi VNC Server Headless....head wrecked! Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
feardamhan
Posts: 21
Joined: Tue Apr 28, 2020 12:51 pm

DietPi VNC Server Headless....head wrecked!

Post by feardamhan »

Hi Folks

Seen a couple of threads on this but none are getting me over the line.

Basically, I have a RPi4, with no keyboard/mouse/monitor (either during setup or continued use). I flash the SD card, drop the pre-edited dietpi.txt file on it and let it self install (for the most part)

I want to be able to connect to a desktop environment on the Rpi via VNC. Have no need for the desktop to actually run on the Pi, unless its required to do what I need.

I've tried connecting with both RoyalTSX and Real VNC Viewer. No dice. Ive tried every solution I have seen re autologin, desktop resolution, hdmi-safe, shared-desktop=0 or 1, connecting to 5901, connecting to IP only, connecting to IP with :1 at the end.

Real VNC viewer consistently gives me 'Cannot currently show the desktop' tho it is making a connection.

This is my initial dietpi.txt. Any one got suggestions?

Appreciate any insight.

Code: Select all

# IMPORTANT:
# - This is intended for advanced users, unless you know what you are doing, do not edit this file. Please use the DietPi programs instead.
# - Modifications to /boot/dietpi.txt will not be preserved on reboot.
# - Please ensure you edit from the DietPi-RAMdisk location: /DietPi/dietpi.txt
# - Do not remove uncommented lines, as the items are scraped by DietPi programs, on demand.

#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Automation settings, applied on first boot of DietPi only, ONCE!
#------------------------------------------------------------------------------------------------------
##### Language/Regional Options #####
# Locale: eg: "en_GB.UTF-8" / "de_DE.UTF-8" | One entry and UTF-8 ONLY!
AUTO_SETUP_LOCALE=en_GB.UTF-8

# Keyboard Layout eg: "gb" / "us" / "de" / "fr"
AUTO_SETUP_KEYBOARD_LAYOUT=gb

# Timezone eg: "Europe/London" / "America/New_York" | Full list (TZ*): https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
AUTO_SETUP_TIMEZONE=Europe/London

##### Networking Options #####
# Enable Ethernet or WiFi adapter: 1=enable | 0=disable
# - If both Ethernet and WiFi are enabled, WiFi will take priority and Ethernet will be disabled.
# - If using WiFi, please edit dietpi-wifi.txt to pre-enter credentials.
AUTO_SETUP_NET_ETHERNET_ENABLED=1
AUTO_SETUP_NET_WIFI_ENABLED=0

# Force ethernet speeds: 0=automatic speed | 10 = 10Mbit | 100 = 100Mbit etc
# - This is mainly aimed at Pine A64 which may have an HW issue that causes unstable 1Gbit link.
AUTO_SETUP_NET_ETH_FORCE_SPEED=0

# Enter your Static Network details below, if applicable.
AUTO_SETUP_NET_USESTATIC=1
AUTO_SETUP_NET_STATIC_IP=192.168.15.30
AUTO_SETUP_NET_STATIC_MASK=255.255.255.0
AUTO_SETUP_NET_STATIC_GATEWAY=192.168.15.1
AUTO_SETUP_NET_STATIC_DNS=1.1.1.1 8.8.8.8

# Hostname
AUTO_SETUP_NET_HOSTNAME=raspberrypi-emby

##### Misc Options #####
# Swapfile size to generate: 0=disable | 1=auto (2GB-RAM = size) | 2+=manual (MB)
AUTO_SETUP_SWAPFILE_SIZE=1
# Swapfile location
AUTO_SETUP_SWAPFILE_LOCATION=/var/swap

# Disable HDMI output (and GPU/VPU where supported) for supported devices: RPi, Odroid C1, Odroid C2
AUTO_SETUP_HEADLESS=1

# Unmask (enable) systemd-logind service, which is masked by default on DietPi
AUTO_UNMASK_LOGIND=0

# Custom Script (pre-networking and pre-DietPi install)
# - Allows you to automatically execute a custom script before network is up on first boot.
# - Copy your script to /boot/Automation_Custom_PreScript.sh and it will be executed automatically.
# - Executed script log: /var/tmp/dietpi/logs/dietpi-automation_custom_prescript.log

# Custom Script (post-networking and post-DietPi install)
# - Allows you to automatically execute a custom script at the end of DietPi install.
# - Option 0 = Copy your script to /boot/Automation_Custom_Script.sh and it will be executed automatically.
# - Option 1 = Host your script online, then use e.g. AUTO_SETUP_CUSTOM_SCRIPT_EXEC=https://myweb.com/myscript.sh and it will be downloaded and executed automatically.
# - Executed script log: /var/tmp/dietpi/logs/dietpi-automation_custom_script.log
AUTO_SETUP_CUSTOM_SCRIPT_EXEC=0

##### Software Options #####
# SSH Server Selection: 0=none/custom | -1=Dropbear | -2=OpenSSH
AUTO_SETUP_SSH_SERVER_INDEX=-1

# File Server Selection: 0=none/custom | -1=ProFTP | -2=Samba
AUTO_SETUP_FILE_SERVER_INDEX=0

# Logging Mode Selection: 0=none/custom | -1=RAMlog 1h clear | -2=RAMlog 1h save clear | -3=rsyslog + logrotate
AUTO_SETUP_LOGGING_INDEX=-1
# RAMlog max tmpfs size (MB). 50MB should be fine for single use. 200MB+ for heavy webserver and access log etc.
AUTO_SETUP_RAMLOG_MAXSIZE=50

# Webserver Preference Selection: 0=Apache2 | -1=Nginx | -2=Lighttpd
# - This will be ignored if you have manually selected any webserver stack.
AUTO_SETUP_WEB_SERVER_INDEX=-2

# DietPi-Autostart: 0=Console | 7=Console autologin | 1=Kodi | 2=Desktop autologin | 16=Desktop | 3=RetroPie | 4=OpenTyrian | 5=DietPi-Cloudshell | 6=Amiberry fast boot | 8=Amiberry standard boot | 9=DDX-Rebirth | 10=CAVA Spectrum | 11=Chromium kiosk | 14=Custom autostart service
# - This will be effective on 2nd boot, after firstrun update and installs have been done.
# - Related software titles must be installed either on firstrun installs or via AUTO_SETUP_AUTOMATED=1 + AUTO_SETUP_INSTALL_SOFTWARE_ID (see below).
AUTO_SETUP_AUTOSTART_TARGET_INDEX=7
# Autologin user name
# - This user must exist before firstrun installs, otherwise it will be reverted to root.
# - Applies to all autostart options but: 0, 6, 14 and 16
AUTO_SETUP_AUTOSTART_LOGIN_USER=root

##### Non-interactive Firstrun Setup #####
# On first login, run update, initial setup and software installs without any user input
# - Setting this to "1" is required for below settings to take effect
# - It is HIGHLY recommended to also set CONFIG_BOOT_WAIT_FOR_NETWORK=2, to force infinite wait for network connection during boot and prevent connection timeout errors.
AUTO_SETUP_AUTOMATED=1

# Global Password to be applied for the system
# - Affects user "root" and "dietpi" login passwords, and, all software installed by dietpi-software, that requires a login password
# - WARN: Passwords with any of the following characters are not supported: \"$
AUTO_SETUP_GLOBAL_PASSWORD=dietpi

# Software to automatically install
# - List of available software IDs: https://github.com/MichaIng/DietPi/wiki/DietPi-Software-list
# - Add as many entries as you wish, one each line.
# - DietPi will automatically install all pre-reqs (e.g. ALSA/X11 for desktops etc)
# - E.g. the following (without the leading "#") will install the LXDE desktop automatically on first boot:
#AUTO_SETUP_INSTALL_SOFTWARE_ID=23

#SAMBA CLIENT
AUTO_SETUP_INSTALL_SOFTWARE_ID=1

#VIM
AUTO_SETUP_INSTALL_SOFTWARE_ID=20

#RealVNC
AUTO_SETUP_INSTALL_SOFTWARE_ID=120

#EMBY SERVER
AUTO_SETUP_INSTALL_SOFTWARE_ID=41

#SyncThing
AUTO_SETUP_INSTALL_SOFTWARE_ID=50

#MARIADB
AUTO_SETUP_INSTALL_SOFTWARE_ID=88

#------------------------------------------------------------------------------------------------------
# D I E T - P I
# Misc DietPi program settings
#------------------------------------------------------------------------------------------------------
# DietPi-Survey: 1=opt in | 0=opt out | -1=ask on first call
# - https://dietpi.com/phpbb/viewtopic.php?p=34#p34
SURVEY_OPTED_IN=-0

#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Config settings
#------------------------------------------------------------------------------------------------------
# CPU Governor: powersave | conservative | ondemand | performance
CONFIG_CPU_GOVERNOR=ondemand
# Ondemand Sampling Rate | Min value: 10000 microseconds (10ms)
CONFIG_CPU_ONDEMAND_SAMPLE_RATE=25000
# Ondemand Sampling Down Factor: Samling Rate * Down Factor / 1000 = ms (40 = 1000ms when sampling rate is 25000)
CONFIG_CPU_ONDEMAND_SAMPLE_DOWNFACTOR=40
# Throttle Up Percentage: Percentage of average CPU usage during samling rate at which CPU will be throttled up/down
CONFIG_CPU_USAGE_THROTTLE_UP=50

# CPU Frequency Limits: Disabled=disabled
# - Intel CPUs use a percentage value (%) from 0-100, eg: 55
# - All other devices must use a specific MHz value, eg: 1600
# - Has no effect on RPi, please set "arm_freq" and "arm_freq_min" in config.txt instead.
CONFIG_CPU_MAX_FREQ=Disabled
CONFIG_CPU_MIN_FREQ=Disabled

# Disable Intel-based turbo/boost stepping. This flag should not be required, setting <100% MAX frequency should disable Turbo on Intel CPUs.
CONFIG_CPU_DISABLE_TURBO=0

# System-wide proxy settings
# - Do not modify, you must use dietpi-config > "Network Options: Adapters" to apply
CONFIG_PROXY_ADDRESS=MyProxyServer.com
CONFIG_PROXY_PORT=8080
CONFIG_PROXY_USERNAME=
CONFIG_PROXY_PASSWORD=

# Delay boot until network is established: 0=disabled | 1=10 second wait max (default) | 2=infinite wait
CONFIG_BOOT_WAIT_FOR_NETWORK=2

# Connection timeout, before DietPi G_CHECK_URL assumes the URL is dead. Increase if you have a "flaky" connection or slow DNS resolver.
# - Set this to "0" to allow unlimited time, however this is not recommended to avoid unlimited hanging background scripts, e.g. daily DietPi update check.
CONFIG_G_CHECK_URL_TIMEOUT=5
# Connection attempts with above timeout each, before DietPi G_CHECK_URL is giving up and prompts an error.
# - Set this to "0" to disable URL checking completely, however this is not recommended to avoid harder to debug follow-up errors during APT and download attempts.
CONFIG_G_CHECK_URL_ATTEMPTS=3
# General connection and DNS testing
# - IP to ping when checking network connectivity. Default: 1.1.1.1 (Cloudflare DNS, should be very fast world-wide)
CONFIG_CHECK_CONNECTION_IP=1.1.1.1
# - Domain to ping when checking DNS resolver. Default: one.one.one.one (Cloudflare DNS domain, see above)
CONFIG_CHECK_DNS_DOMAIN=one.one.one.one

# DietPi checks for updates: Allows DietPi to check for updates on a daily basis and boot using a <1kb file download.
CONFIG_CHECK_DIETPI_UPDATES=1
# Optional: Automatically update DietPi when updates are available. Requires: CONFIG_CHECK_DIETPI_UPDATES=1
CONFIG_AUTO_DIETPI_UPDATES=0

# Network time sync: 0=disabled | 1=boot only | 2=boot + daily | 3=boot + hourly | 4=Daemon + Drift
CONFIG_NTP_MODE=2

# WiFi country code: 2 character value (eg GB US DE JP): https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
CONFIG_WIFI_COUNTRY_CODE=GB

# Serial Console: Set to 0 if you do not require serial console.
CONFIG_SERIAL_CONSOLE_ENABLE=1

# Soundcard
CONFIG_SOUNDCARD=none

# LCD Panel addon
# - Do not modify, you must use dietpi-config to configure/set options
CONFIG_LCDPANEL=none

# IPv6
CONFIG_ENABLE_IPV6=0

# Prefer IPv4 with APT and wget, NB: This has no effect if IPv6 is disabled anyway!
CONFIG_PREFER_IPV4=1

# APT mirrors which are applied to /etc/apt/sources.list | Values here will also be applied during 1st run setup
# - Raspbian: https://www.raspbian.org/RaspbianMirrors
CONFIG_APT_RASPBIAN_MIRROR=http://raspbian.raspberrypi.org/raspbian
# - Debian: https://www.debian.org/mirror/official#list
CONFIG_APT_DEBIAN_MIRROR=https://deb.debian.org/debian/

# NTP mirror, applied to /etc/ntp.conf
# - For a full list, please see: https://www.ntppool.org/zone/@
# - Please remove the initial integer and full stop from the value (removing "0."), eg: debian.pool.ntp.org
CONFIG_NTP_MIRROR=time.cloudflare.com

#------------------------------------------------------------------------------------------------------
# D I E T - P I
# DietPi-Software settings
#------------------------------------------------------------------------------------------------------
# Enter your EmonCMS.org write API key here. It will be applied automatically during EmonPi/Hub install.
# - Eg: SOFTWARE_EMONHUB_APIKEY=b4dfmk2o203mmxx93a
SOFTWARE_EMONHUB_APIKEY=

# VNC Server
SOFTWARE_VNCSERVER_WIDTH=1280
SOFTWARE_VNCSERVER_HEIGHT=720
SOFTWARE_VNCSERVER_DEPTH=16
SOFTWARE_VNCSERVER_DISPLAY_INDEX=1
SOFTWARE_VNCSERVER_SHARE_DESKTOP=1

# ownCloud/Nextcloud
# - Optional username for admin account, the default is 'admin', applied during install
SOFTWARE_OWNCLOUD_NEXTCLOUD_USERNAME=admin
# - Optional data directory, default is "/mnt/dietpi_userdata/owncloud_data" respectively "/mnt/dietpi_userdata/nextcloud_data", applied during install
#	NB: This option is for advanced users. For full compatibility, please keep this options defaults, and, use dietpi-drive_manager to move the DietPi user data location.
SOFTWARE_OWNCLOUD_DATADIR=/mnt/dietpi_userdata/owncloud_data
SOFTWARE_NEXTCLOUD_DATADIR=/mnt/dietpi_userdata/nextcloud_data

# WiFi Hotspot
SOFTWARE_WIFI_HOTSPOT_SSID=DietPi-HotSpot
# - Key requires a minimum of 8 characters
SOFTWARE_WIFI_HOTSPOT_KEY=dietpihotspot
SOFTWARE_WIFI_HOTSPOT_CHANNEL=3

# X.org
# - DPI 96(default) 120(+25%) 144(+50%) 168(+75%) 192(+100%)
SOFTWARE_XORG_DPI=96

# Chromium
SOFTWARE_CHROMIUM_RES_X=1280
SOFTWARE_CHROMIUM_RES_Y=720
SOFTWARE_CHROMIUM_AUTOSTART_URL=https://dietpi.com

# Home Assistant
# - Optional Python build dependencies and modules, possibly required for certain HA components
#	Space separated list (no quotation!), will be installed together with Home Assistant automatically, if present
SOFTWARE_HOMEASSISTANT_APT_DEPS=
#	Add Python modules with version string at best, e.g.: firstModule==1.2.3 secondModule==4.5.6
SOFTWARE_HOMEASSISTANT_PIP_DEPS=

#------------------------------------------------------------------------------------------------------
# D I E T - P I
# Dev settings
#------------------------------------------------------------------------------------------------------
DEV_GITBRANCH=master
DEV_GITOWNER=MichaIng

#------------------------------------------------------------------------------------------------------
# D I E T - P I
# Settings, automatically added by dietpi-update
#------------------------------------------------------------------------------------------------------
User avatar
Joulinar
Posts: 2076
Joined: Sat Nov 16, 2019 12:49 am

Re: DietPi VNC Server Headless....head wrecked!

Post by Joulinar »

Hi,

usually RealVNC is working quite nice on a RPi. You installed RealVNC from dietpi-software catalogue? What IP syntax you are using on your RealVNC client?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
feardamhan
Posts: 21
Joined: Tue Apr 28, 2020 12:51 pm

Re: DietPi VNC Server Headless....head wrecked!

Post by feardamhan »

So I installed it both ways (via the dietpi.txt dropped onto the SD card before first boot) and also to via dietpi-software after initial boot/config. I also tried TigerVNC with no success

For IP connection I tried:

192.168.15.30 (connects but gives 'Cannot currently show the desktop')
192.168.15.30:1 (Connection refused by computer)
192.168.15.30:5901(Connection refused by computer)

Details on initial settings used are all in the DietPi.txt in OP.

Appreciate you taking the time to respond!
User avatar
Joulinar
Posts: 2076
Joined: Sat Nov 16, 2019 12:49 am

Re: DietPi VNC Server Headless....head wrecked!

Post by Joulinar »

Do you use any other desktop software or auto start feature? Usually IP:1 should be working.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
feardamhan
Posts: 21
Joined: Tue Apr 28, 2020 12:51 pm

Re: DietPi VNC Server Headless....head wrecked!

Post by feardamhan »

I have literally nothing other than the items listed in the attached dietpi.txt installed or configured.
User avatar
Joulinar
Posts: 2076
Joined: Sat Nov 16, 2019 12:49 am

Re: DietPi VNC Server Headless....head wrecked!

Post by Joulinar »

can you recheck VNC server settings?

Code: Select all

cat /DietPi/dietpi.txt|grep SOFTWARE_VNCSERVER
Usually DISPLAY_INDEX should be set to 1. As well you could have a look to the port that is used ss -alnp | grep Xvnc-core
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
feardamhan
Posts: 21
Joined: Tue Apr 28, 2020 12:51 pm

Re: DietPi VNC Server Headless....head wrecked!

Post by feardamhan »

So I just flashed the card and did a fresh install, so literally no settings have been tweaked since the install from the first boot dietpi.txt installation quoted above

cat /DietPi/dietpi.txt|grep SOFTWARE_VNCSERVER returns

Code: Select all

	SOFTWARE_VNCSERVER_WIDTH=1280
	SOFTWARE_VNCSERVER_HEIGHT=720
	SOFTWARE_VNCSERVER_DEPTH=16
	SOFTWARE_VNCSERVER_DISPLAY_INDEX=1
	SOFTWARE_VNCSERVER_SHARE_DESKTOP=1
ss -alnp | grep Xvnc-core returns nothing

Connection to 192.168.15.30 with no port/display as root/dietpi establishes connection but gives message 'Cannot currently display the desktop'
User avatar
Joulinar
Posts: 2076
Joined: Sat Nov 16, 2019 12:49 am

Re: DietPi VNC Server Headless....head wrecked!

Post by Joulinar »

well if ss -alnp | grep Xvnc-core doesn't give anything back, could indicate the VNC Server is not running. Can you have a look the VNC services, if they are up and running?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
feardamhan
Posts: 21
Joined: Tue Apr 28, 2020 12:51 pm

Re: DietPi VNC Server Headless....head wrecked!

Post by feardamhan »

Output of systemctl status vncserver.service

Code: Select all

● vncserver.service - Manage VNC Server (DietPi)
   Loaded: loaded (/etc/systemd/system/vncserver.service; enabled; vendor preset: enabled)
   Active: active (exited) since Tue 2020-04-28 15:56:11 BST; 22min ago
  Process: 777 ExecStart=/usr/local/bin/vncserver start (code=exited, status=0/SUCCESS)
 Main PID: 777 (code=exited, status=0/SUCCESS)

Apr 28 15:56:11 raspberrypi-emby systemd[1]: Started Manage VNC Server (DietPi).
Apr 28 15:56:11 raspberrypi-emby systemd[777]: pam_unix(login:session): session opened for user root by (uid=0)
Wouldnt the attempted connection via VNC viewer fail if the service was stopped? Rather than establishing connection but not being able to show the desktop?
User avatar
Joulinar
Posts: 2076
Joined: Sat Nov 16, 2019 12:49 am

Re: DietPi VNC Server Headless....head wrecked!

Post by Joulinar »

strange Xvnc-core would need to be active and it's started by vncserver.service. for testing purposes, can you stop vncserver.service and try to start vnc server manual

Code: Select all

root@DietPi3:~# systemctl stop vncserver.service
root@DietPi3:~# /usr/local/bin/vncserver start
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Post Reply