• How To Activate VNC Server in openSUSE 12.3

    Introduction: TightVNC used to run well as a Service in openSUSE about 5 years ago. TightVNC hasn't worked properly since advanced DEs began with the early releases of KDE4, years ago. I noticed today that it's working again so I thought I should post some notes on how to to get it working.

    There are some official ref notes on the Net:Internet Docs (but they still don't work for me. Maybe they'll work for you, so it's worth a read).

    Software: I have openSUSE 12.3 and the VNC software is included by default. If you have any suspicions that you are short a few RPMs, here's what was installed by default in mine:
    Code:
    barack@webserver123:~> rpm -qa | grep vnc
    remmina-plugin-vnc-1.0.0-6.4.1.x86_64
    xorg-x11-Xvnc-7.6_1.0.1-3.12.1.x86_64
    tightvnc-1.3.10-10.4.1.x86_64
    I used XFCE as the DE in this experiment. I assume it's about the same in the other DEs, but let me know if it's not and I'll make adjustments.

    Firewall (SuSefirewall2): Open Yast --> Security and Users --> Firewall.
    • Set to start at boot.
    • Set interfaces in the External Zone.
    • In Allowed Services, use the drop-down to select VNC and Add it to the Allowed Services panel.
    • Then click Next to lock it in.

    That opens the TCP ports 5900 to 5999, so you can open any of those 100 channels in your "vncserver" command.

    Initialise VNC Server: Open a console and run this simple command not as root, just as yourself, ordinary user: vncserver. That will initiate a one-time password dialogue where you will be asked to supply two passwords. The first is for read/write access to the server, the second is for read-only access to the server (i.e as an observer only). You don't have to make a second password if you don't want to.

    Adjust the Server config file. The config file is named xstartup and is located in the hidden folder /home/barack/.vnc. It's an executable shell script.
    These are the default contents:
    Code:
    #!/bin/sh
    xrdb $HOME/.Xresources
    xsetroot -solid grey
    xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    twm &
    For the XFCE DE change the contents to these:
    Code:
    #!/bin/sh
    dbus-launch /usr/bin/startxfce4
    For the KDE DE change the contents to these:
    Code:
    #!/bin/sh
    dbus-launch /usr/bin/startkde
    How to start the Server, including colour depth and geometry

    Here's the reference page: TightVNC: Manual Page for Xvnc(1)

    You can include port number, colour depth and geometry like this: vncserver :2 -depth 16 -geometry 1900x1060
    (You use normal commands, not root commands). VNC is really bad with the "geometry" parameter. I usually leave it out and it will more or less adopt the aspect ratio of the current screen on the server -- and then I can adjust the magnification or contraction as percentages on the client machine using the Connection Options tool on the Client machine.

    Here's an example of starting the server:
    Code:
    barack@webserver123:~> vncserver :2 -depth 16
    
    New 'X' desktop is webserver123.site:2
    
    Starting applications specified in /home/barack/.vnc/xstartup
    Log file is /home/barack/.vnc/webserver123.site:2.log
    How to stop the server: vncserver -kill :2
    Here's an example:
    Code:
    barack@webserver123:~> vncserver -kill :2
    Killing Xvnc process ID 2867
    barack@webserver123:~>
    Running VNC Server as a permanent Service

    You have to use a normal username to get a non-root DE served to the client machine. But don't use any of the common DE user-autostart methods found in KDE, Gnome or XFCE etc. They start infinite loops of desktops and crash your system. Do this instead:

    You can get around the looping issue with a Cron job: create an entry in your personal crontab (not root's crontab). The line for the cron job is like this:

    Code:
    @reboot sleep 15; /usr/bin/vncserver -depth 16
    Voilà

    Be well
    swerdna
    Comments 10 Comments
    1. Knurpht's Avatar
      Knurpht -
      Thanks a lot, John. You made my day, after struggling with this a couple of weeks ago, my customer now has a perfect 12.3 server: ltsp for the "indoor" thin clients + VNC for remote access.

      What matters is the use of remmina. It's vnc plugin does fine, where KRDP and vinagre failed to connect to a 12.3 server. No issues on 12.2.
    1. Knurpht's Avatar
      Knurpht -
      Addition:

      As a result of testing one user had entries for both :4 and :5, another user for :4 only. Using
      Code:
      @reboot sleep 15; /usr/bin/vncserver -depth 16
      resulted in the vncserver startin for the first user, not for the second, since :4 was already given to the first user.
      To avoid this:
      either run the vncserver only once for each user, or change the above to
      Code:
      @reboot sleep 15; /usr/bin/vncserver :4 -depth 16
      for the first user
      Code:
      @reboot sleep 15; /usr/bin/vncserver :5 -depth 16
      for the second, etc.
    1. swerdna's Avatar
      swerdna -
      Excellent Gertjan
      I didn't see that coming, nice that you found it. I'll make an edit when I can (don't know when because the editor is broken).
    1. jdmcdaniel3's Avatar
      jdmcdaniel3 -
      openSUSE comes with a TightVNC, but it is not the same as you can get for free for Windows. As an alternative, you can consider using the Java version you can download from the TightVNC website which does work if Firefox under openSUSE 13.1. Here is the download link:

      http://www.tightvnc.com/download/2.7...-2.7.2-bin.zip

      I downloaded this file to my $HOME/Downloads folder ($HOME is always your /home/username folder) and extracted all of the files using ark there which gave me the file:

      $HOME/Downloads/tvnjviewer-2.7.2-bin/nossh/tightvnc-jviewer.jar

      There are two copies of this file. One is an example and one is just the jar file. You must use Dolphin or other file manager to mark executable or you can run the following terminal command:

      chmod +x $HOME/Downloads/tvnjviewer-2.7.2-bin/nossh/tightvnc-jviewer.jar

      In my example, I just left the file as extracted, but you can move it where you like. By leaving it in place, there is no need to be root to run it, which is what I suggest, but moving this file to $HOME/bin might also be a good choice. It is up to you.

      Now, one the file is marked executable, it can be run as follows:

      Alt-F2: /usr/bin/java -jar $HOME/Downloads/tvnjviewer-2.7.2-bin/nossh/tightvnc-jviewer.jar

      And Here is what you see from this Java Application:



      This just provides another way to do a remote connection using TightVNC.

      Thank You,
    1. smileybri's Avatar
      smileybri -
      Sorry for my total noob comments. I have replaced my Redmond OS with OpenSuse (KDE). It is a Dell StudioXPS 9100 with Corei7 and 8GB Ram. I still run Windows on my laptop and regularly use RealVNC. I have been unable to connect to my Desktop (OpenSuse13.1) with the Windows RealVNC viewer but I think my config is wrong.

      Above you mention a change in contents of the xstartup file in .vnc This is my default xstartup in 13.1
      #!/bin/sh

      xrdb $HOME/.Xresources
      xsetroot -solid grey
      xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
      twm &
      If I understand you correctly I should change this to
      #!/bin/sh
      dbus-launch /usr/bin/startkde
      RPM output if helpful
      smileybri@linux-0dwn:~> rpm -qa | grep vnc
      python-gtk-vnc-0.5.3-1.2.x86_64
      libgvnc-1_0-0-0.5.3-1.2.x86_64
      tightvnc-1.3.10-14.2.1.x86_64
      libgtk-vnc-1_0-0-0.5.3-1.2.x86_64
      libgtk-vnc-2_0-0-0.5.3-1.2.x86_64
      xorg-x11-Xvnc-7.6_1.0.1-15.1.3.x86_64
      gtk-vnc-lang-0.5.3-1.2.noarch
      libvncclient0-0.9.9-7.1.2.x86_64
      Thank you for your article.
    1. jdmcdaniel3's Avatar
      jdmcdaniel3 -
      Quote Originally Posted by smileybri View Post
      Sorry for my total noob comments. I have replaced my Redmond OS with OpenSuse (KDE). It is a Dell StudioXPS 9100 with Corei7 and 8GB Ram. I still run Windows on my laptop and regularly use RealVNC. I have been unable to connect to my Desktop (OpenSuse13.1) with the Windows RealVNC viewer but I think my config is wrong.

      Above you mention a change in contents of the xstartup file in .vnc This is my default xstartup in 13.1

      If I understand you correctly I should change this to


      RPM output if helpful


      Thank you for your article.
      One thing I ran into was the port number. If I add :1 to the end of the IP address, it is the same as using 5901 over 5900 and so pay attention to port numbers as being off by one is as bad as being off by 100.

      Thank You,
    1. Knurpht's Avatar
      Knurpht -
      Quote Originally Posted by smileybri View Post
      Sorry for my total noob comments. I have replaced my Redmond OS with OpenSuse (KDE). It is a Dell StudioXPS 9100 with Corei7 and 8GB Ram. I still run Windows on my laptop and regularly use RealVNC. I have been unable to connect to my Desktop (OpenSuse13.1) with the Windows RealVNC viewer but I think my config is wrong.

      Above you mention a change in contents of the xstartup file in .vnc This is my default xstartup in 13.1

      If I understand you correctly I should change this to


      RPM output if helpful


      Thank you for your article.
      Your xstartup is OK. But please, this is the article section, it's not a forums page. Create a topic in the forums, state your openSUSE version etc. , and include output of
      Code:
      ls -l ~/.vnc
    1. jefferyfernandez's Avatar
      jefferyfernandez -
      Hi guys,

      I am connecting to my opensuse desktop from a mac client (chicken of the vnc). After following the setup, I can connect to my desktop but I get a black screen with an X as the mouse pointer. I am running openSUSE 12.3 and KDE. Any pointers?
    1. swerdna's Avatar
      swerdna -
      Quote Originally Posted by jefferyfernandez View Post
      Hi guys,

      I am connecting to my opensuse desktop from a mac client (chicken of the vnc). After following the setup, I can connect to my desktop but I get a black screen with an X as the mouse pointer. I am running openSUSE 12.3 and KDE. Any pointers?
      The default DE that is served is TWM, so: Did you adjust the local config file to serve KDE (file name is xstartup, in local folder .vnc)?
    1. faleloncio's Avatar
      faleloncio -
      I'm using vncserver in my server but I'm connecting to it using KRDC, instead TightVNC, and if work fine for me.