You are not logged in.

#1 2022-07-22 18:18:21

Jphillips
Member
Registered: 2019-08-23
Posts: 68

How to VNC into a computer with the monitor switched off?

I had to remotely restart a computer which has a monitor attached, but switched off. The problem now is that there is no display running, and so when I VNC in I just get a black screen. I've tried forcing the monitor on using xset commands and vbetools, via ssh, but no luck. There are some various approaches I've com across for running VNC on a headless machine, but that's not quite my situation.

Any thoughts on how to get an X session up and running? I'm using gnome as my desktop environment. Thanks!

Last edited by Jphillips (2022-07-22 18:19:06)

Offline

#2 2022-07-22 18:37:50

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,692

Re: How to VNC into a computer with the monitor switched off?

I think the remote system is the issue.  It sounds like its VNC server is set up in a screen sharing mode; I am not sure what to do in that case if you cannot get an Xorg session to run on that machine.   Is that machine, per chance, running Raspian?
My preference is to set up the VNC such that it spawns an new Xorg session that is dedicated to the specific connection that is independent of whatever is on the console. https://wiki.archlinux.org/title/TigerV … )_sessions

It sounds as if you can ssh into the box.  Is that the case?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2022-07-22 19:13:06

Jphillips
Member
Registered: 2019-08-23
Posts: 68

Re: How to VNC into a computer with the monitor switched off?

Yeah, I can ssh in still. I had followed the TigerVNC instructions for running a headless session. The server is up and running, and I can connect, but I just get a black screen.

My ~/.vnc/config is:

session=gnome
geometry=1920x1200

My /etc/tigervnc/vncserver.users file is just:

2:zm

And everything seems to be runnning fine:

$ sudo systemctl status vncserver@:2.service
● vncserver@:2.service - Remote desktop service (VNC)
     Loaded: loaded (/usr/lib/systemd/system/vncserver@.service; enabled; vendor preset: disabl>
     Active: active (running) since Fri 2022-07-22 21:01:01 CEST; 1min 28s ago
   Main PID: 4057 (vncsession)
      Tasks: 0 (limit: 154462)
     Memory: 668.0K
        CPU: 9ms
     CGroup: /system.slice/system-vncserver.slice/vncserver@:2.service
             ‣ 4057 /usr/bin/vncsession zm :2

Any thoughts? It it possible it's not reading the config file and using defaults or something similar?

Offline

#4 2022-07-22 19:29:24

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,692

Re: How to VNC into a computer with the monitor switched off?

Have you nmap installed?  Let's see what is listening over there

nmap labbench -p1-32767

Replace labbench with your target's host name or IP address.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2022-07-22 19:48:20

Jphillips
Member
Registered: 2019-08-23
Posts: 68

Re: How to VNC into a computer with the monitor switched off?

pmap is running, but in the meantime it's definitely connecting -- it prompts for a password and supposedly logs me in.

Here's the connection log:

Starting desktop session gnome-classic


Xvnc TigerVNC 1.12.0 - built Mar 14 2022 12:48:11
Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12009000, The X.Org Foundation


Fri Jul 22 21:39:16 2022
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5907
 vncext:      created VNC server for screen 0
xinit: XFree86_VT property unexpectedly has 0 items instead of 1
/etc/gdm/Xsession: Beginning session setup...
localuser:vm being added to access control list
/etc/gdm/Xsession: Setup done, will execute: env GNOME_SHELL_SESSION_MODE=classic >

Fri Jul 22 21:39:40 2022
 Connections: accepted: 10.6.206.129::41508
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type VeNCrypt(19)

Fri Jul 22 21:39:41 2022
 SVeNCrypt:   Client requests security type TLSVnc (258)

Fri Jul 22 21:39:45 2022
 VNCSConnST:  Server default pixel format depth 24 (32bpp) little-endian rgb888

Fri Jul 22 21:39:46 2022
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)

Fri Jul 22 21:39:55 2022
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)

Fri Jul 22 21:40:03 2022
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)

Fri Jul 22 21:40:08 2022
 VNCSConnST:  closing 10.6.206.129::41508: Clean disconnection
 EncodeManager: Framebuffer updates: 5
 EncodeManager:   Tight:
 EncodeManager:     Solid: 5 rects, 6.53846 Mpixels
 EncodeManager:            80 B (1:326924 ratio)
 EncodeManager:   Total: 5 rects, 6.53846 Mpixels
 EncodeManager:          80 B (1:326924 ratio)
 Connections: closed: 10.6.206.129::41508
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)

Offline

#6 2022-07-22 21:20:39

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,692

Re: How to VNC into a computer with the monitor switched off?

That is good, but not what I was chasing. What I am wondering is whether there are more than one port open?  5900 might be open to permit connections to the console (and are you trying to connect to that?).  Are others open like 5901 or 5902?  If so, connecting to those might give you a dedicated session.  nmap will tell us, but it should have only taken a few seconds for a single target.

ewaller@odin/home/ewaller % nmap labbench -p1-32767
Starting Nmap 7.92 ( https://nmap.org ) at 2022-07-22 14:13 PDT
Nmap scan report for labbench (192.168.1.5)
Host is up (0.0068s latency).
rDNS record for 192.168.1.5: labbench.lan
Not shown: 32761 closed tcp ports (conn-refused)
PORT     STATE SERVICE
22/tcp   open  ssh
5000/tcp open  upnp
5355/tcp open  llmnr
5902/tcp open  vnc-2
5930/tcp open  unknown
6600/tcp open  mshvlm

Nmap done: 1 IP address (1 host up) scanned in 3.80 seconds
ewaller@odin/home/ewaller % 

Here I have 5902 open which is a dedicated VNC to a dedicated i3 session and 5930 which is a spicy connection to my sacrificial Windows installation I keep in a sandbox.  5000 isa webserver for my 3D printer, 22 is ssh. 6600 is mpd
Don't know off hand why  5355 is open.  I'll be looking into that in a moment.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#7 2022-07-22 23:06:07

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 736

Re: How to VNC into a computer with the monitor switched off?

Is monitor physically unplugged, powered off or just in sleep mode? I wake up monitor with

DISPLAY=:0 xset dpms force on

over ssh and VNC start to display.
Also i guess there may be different VNC behaviour on xorg and wayland.

Offline

#8 2022-07-29 12:29:43

VirusABC
Member
Registered: 2022-07-29
Posts: 1

Re: How to VNC into a computer with the monitor switched off?

Hi

I've used VNC in the past and despite the fact that it worked fine, I felt a little bit confusing to set it up for giving me a dedicated session instead of mirroring the local desktop screen.

At the start of covid lockdown, I had to once again setup a remote desktop session for me, but this time VNC was not good enough because my connection latency was very bad. Then I found a software named ThinLinc, which is based on VNC protocol but has some improvements, such as encryption by default, sound redirection, independent desktop sessions for multiple users (not a mirrored local screen), connection tunneled through the ssh port (no need to open a lot of ports for each new user session like VNC) and also has a great picture quality and responsiveness even on higher latency/narrow bandwidth connections. It saved me a lot of trouble during the lockdown and I still use it for different reasons

It is based on FOSS (the company behind it is the maintainer of TigerVNC and noVNC), but ThinLinc itself is not FOSS. It is fully free for up to 10 simultaneously connected users, so, if you already can connect to your remote machine through SSH, maybe ThinLinc will help you because it does by default exactly what you want with minimum configuration problems.

The only "problem" that I had in my case was that my computer at work is behind NAT and to access it from home I had to create a tunnel using a "jumphost" and so I needed to configure a parameter under the ThinLinc client configuration file (HOST_ALIASES) to tell my client that the remote IP had to go through the tunnel. But it was easy to do.

Offline

Board footer

Powered by FluxBB