Setting up a VNC server in MK 802 / any linux box

VNC is an useful tool to have, especially in the case of linux boxes like MK 802. Instead of buying an expensive HDMI monitor which will be 4x costlier than the device itself is not a brilliant idea.

If you are using Ubuntu/Xubuntu/Lubuntu, the steps for preparing your box with VNC is fairly simple. The prerequisite for setting up a VNC server includes an ssh service working on the box. You can use open-ssh for this. Chances of this application already being there in your system is pretty high.

Installing  Open SSH in your Linux box

  • Open terminal from the box
  • Run sudo apt-get install ssh
  • Run ssh  username@IP from any other system on the same network and it should get connected to our box.

Once this is done and verified, we can move to the installation of the VNC server which will help us to connect to the box. TightVNCServer is the default choice for this, due to so many reasons. Primarily since it can be tightly intergrated to the lubuntu/xubuntu which is apt for a linux box.

Installing TightVNC Server

  • Open terminal from the box
  • Run sudo apt-get install tightvncserver .TightVNC might be already on your image FYI.
  • Run vncserver for the first time to set up the initial password and confirm it. Please bear in mind that this is the only password you (or anyone for that matter!) need to get control of your linux box. This password will be mapped to your user folder (~/.vnc/passwd )

Setting up the TightVNC Server

Once it’s installed and the password has been configured, we need to give the information on the screen resolution it should allow, the color depth, which user it should run as (by default) and so on.

So let’s configure it:

  1. Open terminal.
  2. Run sudo nano /etc/init.d/vncserver ( nano or gedit or leafpad ..).
  3. Enter the below content after making certain changes such as replace “username” with your username and “desktopname” with the name you want to use for the VNC server.
    #!/bin/sh –e
    # Provides: vncserver
    # Required-Start: networking
    # Default-Start: S
    # Default-Stop: 0 6
    # The Username:Group that will run VNC
    export USER="username"
    # The display that VNC will use
    # Color depth (between 8 and 32)
    # The Desktop geometry to use.
    # The name that the VNC Desktop will have.
    OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"
    case "$1" in
    log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
    su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
    log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"
    su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
    echo "need to implement"
    exit 0
  4. After saving the content in vncserver file, you have to give it permissions as sudo chmod +x /etc/init.d/vncserver
  5. Now update your rc folder so that the server starts up automatically with the system. update-rc.d vncserver defaults
  6. That’s it. Now server will be running when you reboot the system.

Few other things that can be changed in the file other than the names are the desktop resolution and the color depth. If you are on LAN, go on and maximize it.

 Setting up the window session for the VNC

By default, tightvncserver will be using the Ubuntu-one session (Xsession). If you want to switch to lubuntu orlxde to be more resource efficient then follow these steps:

  1. Open terminal
  2. Run sudo nano ~/.vnc/xstartup , where all the startup configurations are to be stored.
  3. You can set it up with this content for  Ubuntu to load an Xsession. #!/bin/shxrdb $HOME/.Xresources
    xsetroot -solid grey
    #x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    #x-window-manager &
    # Fix to make GNOME work
  4. Replace the /etc/X11/Xsession with /usr/bin/startlubuntu & for having an lxde session which is more resource friendly.

P.S :

  1. If you want to change the tightvncserver port from the default (5901) , you can do so by editing : /usr/bin/vncserver
  2. Also note that the applications like nm-connection-editor will not show a root permission box. Use gksudo from a terminal window within the VNC window to get root permissions.

One thought on “Setting up a VNC server in MK 802 / any linux box”

  1. Thanks! This works well!
    I’ve got an MK802+ (A10s/1GB) with Lubuntu 12.04 on it. It’s got a lot of niggles, and I’m still trying to get it set up right. When I tried to connect to tightvncserver on the MK802, I would simply be greeted with a grey screen and an error dialog (“Failed to load GNOME session”). Editing the xstartup file fixed this issue.

Leave a Reply