Vnc On C7

Home » CentOS » Vnc On C7
CentOS 8 Comments

I am trying to get a remote screen on C7. I did the following on C7 server:
yum install tigervnc-server
cp /lib/systemd/system/vncserver@.service
/etc/systemd/system/vncserver@:1.service
systemctl daemon-reload
edit /etc/systemd/system/vncserver@:1.service and replace
with myuser
su – myuser run VNCpassword to set password
systemctl start VNCserver@:1.service
systemctl enable VNCserver@:1.service

Then when I use something like VNCviewer from a windows laptop into the linux desktop I get the password prompt, but the next screen says “oh no, something went wrong”.

Did I do something wrong above?
Thanks,

Jerry

8 thoughts on - Vnc On C7

  • That sounds like the desktop environment (Gnome3) is failing, probably because its a compositing desktop environment and fails because it can’t use GL.

    You could try it with a desktop manager other than Gnome3.

  • Hi Jerry,

    Hope that works. If not, I’m suspicious that the file copy created a file with the wrong (default) SELinux context, which you could confirm with “ls -lZ”, and fix with restorecon. Also you can run “ausearch –success no –interpret -ts today”
    to check the audit log for permissions issues that silently escape notice.

    Hope that helps,

  • Two things:

    1) I am not using just Gnome3… I am using the MATE desktop if that makes a difference.

    2) selinux is disabled on this machine.

    Thanks,

    Jerry

  • Here are my notes for getting VNC to work on CentOS 7 with mate:

    VNCSERVER SETUP

    To start VNCserver:
    systemctl start VNCserver@1:service

    to kill and restart the VNC server as a user:
    vncserver -kill :1
    vncserver :1

    To get mate to show up use the follow text in your

    ~.vnc/xstartup file:

    #!/bin/sh

    # Uncomment the following two lines for normal desktop:
    # unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    # exec /etc/X11/xinit/xinitrc

    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r HOME/.Xresources ] && xrdb HOME/.Xresources
    xsetroot -solid grey
    VNCconfig -iconic &
    x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
    mate-session &

  • Thanks Frank.

    The below in fact worked and restarting the service.

    Jerry

    To get mate to show up use the follow text in your

    ~.vnc/xstartup file:

    #!/bin/sh

    # Uncomment the following two lines for normal desktop:
    # unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    # exec /etc/X11/xinit/xinitrc

    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r HOME/.Xresources ] && xrdb HOME/.Xresources
    xsetroot -solid grey
    VNCconfig -iconic &
    x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
    mate-session &

  • Hi Jerry,

    I done a lot of search in google. Than I find your post, but without success for my problem.

    I have add your xstartup file. But I can’t get it working with this startupfile. One problem is, that I can’t find the x-terminal-emulator on my machine.

    Which package must I install for x-terminal-emulator in CentOS7 ?

    Maybe you can have a look at my logfile and my configuration for additional hints.

    I am happy for any kind of feedback.

    Koenigsohn

    **************** *devtest1:4.log* **************************
    Xvnc TigerVNC 1.3.1 – built Mar 31 2016 16:34:53
    Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
    See http://www.tigervnc.org for information on TigerVNC. Underlying X server release 11702000, The X.Org Foundation

    Wed Jul 13 15:49:53 2016
    VNCext: VNC extension running!
    VNCext: Listening for VNC connections on all interface(s), port 5904
    VNCext: created VNC server for screen 0
    No protocol specified
    /usr/bin/vncconfig: unable to open display “:4”
    No protocol specified xsetroot: unable to open display ‘:4’
    /home/ulkoenig/.vnc/xstartup: line 12: x-terminal-emulator: command not found No protocol specified vncconfig: unable to open display “:4”
    No protocol specified

    ** (mate-session:2597): WARNING **: Could not open X display No protocol specified

    ** (mate-session:2597): WARNING **: Cannot open display:
    ***********************************************************************

    *The xstartup file is here*
    ********************** xstartup *************************
    #!/bin/sh

    # Uncomment the following two lines for normal desktop:
    # unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
    # exec /etc/X11/xinit/xinitrc

    [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
    [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic &
    x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
    mate-session &
    ***********************************************************

    *The VNCserver.service file is here*
    ************************ /etc/systemd/system/vncserver@:4.service
    **************************

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

    [Service]
    Type=forking
    # Clean any existing files in /tmp/.X11-unix environment ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
    ExecStart=/usr/sbin/runuser -l ulkoenig -c “/usr/bin/vncserver %i -geometry
    1280×1024”
    PIDFile=/home/ulkoenig/.vnc/%H%i.pid ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’

    [Install]
    WantedBy=multi-user.target
    ****************************************************************************************************

  • Do you mean ‘xterm’ (executable in package with the same name).

    The symlink called ‘x-terminal-emulator’ is a debianism.

LEAVE A COMMENT