You are not logged in.

#1 2016-06-16 22:50:28

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

[SOLVED] Vnc into a headless machine?

Hi folks,

I have a machine (running Arch with Gnome desktop) which i used to have connected to my TV.  I used to remotely vnc into it a lot.  I've now moved it and it no longer has a monitor.  I can no longer vnc into it because X won't start without a detectable monitor attached.  A little while ago i managed to resolve this by writing my own Xorg.conf file which fooled X into thinking there was a monitor attached.  Unfortunately since then i had a hard drive failure and had to reinstall the system from scratch ... I lost the Xorg.conf file and now i can't for the life of me reconstruct the conf file again and get it all work as it was.

Has anybody else done this before?  Any body got any suggestions on how else i might enable vnc connection to a headless machine?

I've read the wiki on tigerVNC and this isn't working for me either.

Thanks.

Last edited by jjb2016 (2016-12-21 16:07:30)

Offline

#2 2016-06-16 23:28:56

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: [SOLVED] Vnc into a headless machine?

Try installing/using xf86-video-dummy on the headless machine.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2016-11-26 14:47:28

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

Re: [SOLVED] Vnc into a headless machine?

This worked while using the nvidia driver.  Just had a write a custom xorg.conf file ...

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 367.35  (builduser@rw)  Fri Jul 15 21:07:27 CEST 2016

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "ViewSonic VA2226w"
    HorizSync       30.0 - 82.0
    VertRefresh     50.0 - 75.0
    Option         "DPMS"
    Modeline "1600x900_60.00" 119.00 1600 1696 1864 2128 900 901 904 932 -HSync +Vsync
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GT 620"
    BusID	   "PCI:1:0:0"
    Option	   "ConnectedMonitor"	"DFP-1"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-1"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
	Modes	   "1600x900_60.00"
    EndSubSection
EndSection

Last edited by jjb2016 (2016-11-26 14:49:15)

Offline

#4 2016-11-26 14:48:56

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Vnc into a headless machine?

jjb2016 wrote:

I've read the wiki on tigerVNC and this isn't working for me either.

What exactly doesn't work?  The systemd implementation of that is bullet proof.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2016-11-26 14:51:39

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

Re: [SOLVED] Vnc into a headless machine?

Well I have a solution now using this custom xorg.conf file (basically forces xorg serve to think there is a monitor attached).  When I've got some time I'll try and retrace my steps with tigerVNC and post the issues I had.

Offline

#6 2016-11-26 15:08:53

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Vnc into a headless machine?

Tigervnc is the solution for your use case.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#7 2016-12-20 17:09:25

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

Re: [SOLVED] Vnc into a headless machine?

I've had a chance to attempt to get tigervnc server working on my server again.  My house had a power cut while i was away over the weekend and when i returned i started the machine up and tried to vnc into it.  Although the vnc connection was made ok, i was presented with a blank screen and a lonely mouse cursor scuttling around in the darkness.  My machine was previously used with a monitor and so had a standard gnome, x, gdm installation with vino server for vnc connection.  A while back i moved the machine to a location where it would have no monitor and found i could not vnc into it.  I discovered that this was down to the fact that x server wouldn't start because it could not detect a display device.  After a while a figured out you could get x server up by writing a custom xorg.conf file, with display device details defined in it, to get x to start with no physical display attached (see previous posts).

So now this isn't working for me either ... I thought i'd have a go at getting tigerVNC running.  What i've done so far ...

1.  Stopped and disabled gdm.service
2.  Rebooted and ssh into machine
3.  Installed tigervnc
4.  Started vncserver to generate new .vnc/xstartup and .vnc/config files.
5.  Stopped the vnc server.
6.  Edited xstartup and removed all default script, then added

#!/bin/bash
gnome-session &

7.  Restarted vncserver
8.  Attempted to vnc into machine and just got a blank screen with mouse cursor.

I've trawelled the internet for examples of xstartup scripts for starting gnome sessions and all have resulted in the same blank screen with mouse cursor.  So here i am asking for advice as i'm out of ideas.  I was thinking - could there be existing packages / services which could be interfering here?  The existing vino server?  The existing custom xorg.conf file?

Any help would be much appreciated.

Offline

#8 2016-12-20 17:18:25

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Vnc into a headless machine?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#9 2016-12-20 18:58:24

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

Re: [SOLVED] Vnc into a headless machine?

RIght - my previous message was tapped out on my phone so I couldn't add enough detail.  I've just done the following:

1.  Stopped and disabled gdm.service
2.  Rebooted
3.  deleted ~/.vnc to reset any previous changes
4.  run

vncserver

and got this output ...

[justin@IXTREME ~]$ vncserver

New 'IXTREME:1 (justin)' desktop is IXTREME:1

Starting applications specified in /home/justin/.vnc/xstartup
Log file is /home/justin/.vnc/IXTREME:1.log

5.  stopped the vnc server

vncserver -kill :1

6.  edited ~/.vnc/xstartup to the following ...

#!/bin/bash

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
OS=`uname -s`
if [ $OS = 'Linux' ]; then
  case "$WINDOWMANAGER" in
    *gnome*)
      if [ -e /etc/SuSE-release ]; then
        PATH=$PATH:/opt/gnome/bin
        export PATH
      fi
      ;;
  esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
  exec /etc/X11/xinit/xinitrc
fi
if [ -f /etc/X11/xinit/xinitrc ]; then
  exec sh /etc/X11/xinit/xinitrc
fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session &

NOTE:   I made two changes from the original default file:
     a. changed was the first line which was "#!/bin/sh" to #!/bin/bash"
     b.  commented out "twm &" and added "gnome-session &"
7.  editied ~/.vnc/config to the following ...

## Supported server options to pass to vncserver upon invocation can be listed
## in this file. See the following manpages for more: vncserver(1) Xvnc(1).
## Several common ones are shown below. Uncomment and modify to your liking.
##
# securitytypes=vncauth,tlsvnc
# desktop=sandbox
geometry=1600x900
dpi=96
# localhost
# alwaysshared

NOTE:  the changes i made were:
    a.  uncommented geometry line and set to 1600x900
    b.  added line "dpi=96"
8.  started vnc server

vncserver

9.  stopped the vncserver

vncserver -kill :1

10.  log file shows the following

Xvnc TigerVNC 1.7.0 - built Sep  8 2016 19:36:24
Copyright (C) 1999-2016 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11804000, The X.Org Foundation


Tue Dec 20 18:56:32 2016
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0
/home/justin/.vnc/xstartup: line 24: xterm: command not found

** (process:5857): WARNING **: Could not make bus activated clients aware of XDG_CURRENT_DESKTOP=GNOME environment variable: Could not connect: Connection refused
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":1"
      after 137 requests (137 known processed) with 0 events remaining.

if I start the server, then attempt to connect from another machine I just get a blank gray screen.

any ideas?

Offline

#10 2016-12-20 19:45:34

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Vnc into a headless machine?

I can't speak for gnome but for lxqt you need to prefix the start command with exec as the wiki states and as you have omitted.

 cat ~/.vnc/xstartup 
#!/bin/sh
exec startlxqt

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#11 2016-12-20 19:51:48

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

Re: [SOLVED] Vnc into a headless machine?

Yes i did try with and without exec and i get the same results - blank gray screen.

Last edited by jjb2016 (2016-12-20 19:52:08)

Offline

#12 2016-12-20 20:44:50

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [SOLVED] Vnc into a headless machine?

I don't use gnome so I can't help.

Last edited by graysky (2016-12-24 19:59:42)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#13 2016-12-20 21:09:19

JohnBobSmith
Member
From: Canada
Registered: 2014-11-29
Posts: 804

Re: [SOLVED] Vnc into a headless machine?

Well, you have a couple of "errors" in the log. The first:

/home/justin/.vnc/xstartup: line 24: xterm: command not found

I've never used VNC. But, if you need xterm, and it can't be found, that's certainly a problem. I would double check the xterm requirement(?) to rule this out. The second:

WARNING **: Could not make bus activated clients aware of XDG_CURRENT_DESKTOP=GNOME environment variable: Could not connect: Connection refused

This is important because of the the connection refused part. This is stating why, AFAIK, you are getting the blank/black screen. You have a bad variable that is not registering with bus (dbus??). Heres a solved thread with a near-identical error. Check it out: https://bbs.archlinux.org/viewtopic.php?id=216151

Good luck!


I am diagnosed with bipolar disorder. As it turns out, what I thought was my greatest weakness is now my greatest strength.

Everyday, I make a conscious choice to overcome my challenges and my problems. It's not easy, but its better than the alternative...

Offline

#14 2016-12-20 21:20:30

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,466

Re: [SOLVED] Vnc into a headless machine?

Blanking DBUS_SESSION_BUS_ADDRESS seems like a really bad idea. As does backgrounding your DE.

Offline

#15 2016-12-20 23:20:52

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

Re: [SOLVED] Vnc into a headless machine?

Think i'm going to install a new arch VM and see if I can get it working ... my gut feeling is that there is something already running / existing in my current installation which is stopping this from working.  Will post back my findings ...

Last edited by jjb2016 (2016-12-20 23:21:11)

Offline

#16 2016-12-21 15:22:28

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

Re: [SOLVED] Vnc into a headless machine?

Installed a new Arch VM.  did the following:

1.  Installed:
base
base-devel
gnome
openssh
htop
tigervnc

2.  Created a new user

useradd -m -G wheel -s /bin/bash justin

3.  Logged in as justin.
4.  Started vncserver for the first time

vncserver :0

5.  Stopped vncserver

vncserver -kill :0

6.  Edited .vnc/xstartup ...

#!/bin/sh
exec gnome-session &

7.  Started vncserver

vncserver :0

This worked.  I was able to connect to this vnc session from the VM host machine (and from a remote machine over ssh tunnel).

On the VM host machine, which I've so far failed to get this all working on, I edited the .vnc/xstartup file to match the one used in the VM.  Started the vncserver up without any errors reported in the log file this time (in my previous post there was an error reported).  However when i connect to this vnc session I still only get a blank black screen.  The .vnc/*.log file shows no errors though ... at a bit of a loss!

Offline

#17 2016-12-21 16:07:12

jjb2016
Member
From: Oxfordshire
Registered: 2016-02-29
Posts: 73

Re: [SOLVED] Vnc into a headless machine?

Finally sorted it .... thanks to this thread https://bbs.archlinux.org/viewtopic.php?id=213368
had to replace nvidia-libgl with mesa-libgl

Offline

#18 2018-01-12 18:42:14

soupault
Member
Registered: 2014-06-07
Posts: 2

Re: [SOLVED] Vnc into a headless machine?

These link are related and provide some additional info on the issue:
https://github.com/TigerVNC/tigervnc/issues/39
https://github.com/alces-software/clust … /issues/11

Offline

#19 2018-01-12 18:43:47

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] Vnc into a headless machine?

Don't necrobump, particularly solved threads: https://wiki.archlinux.org/index.php/Co … bumping.22


Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB