Raspberry Pi – VNC Mirror (Repeater) – Make any computer public anywhere

***Please visit the new simplified installation of the Raspberry Pi VNC Mirror***

Here is an extenstion for this blog-entry you also might to read!

Raspberry Pi LogoRaspberry Pi Logo

The idea is to show any machine (virtual or real) to public. So you can setup a computer with VNC anywhere and can put a big TV screen at another place.

We need a Raspberry Pi Model B, a network connection and a micro USB power plug (either over USB <-> micro USB plugged into your RPi or TV or seperate power device)

I have downloaded the 2012-09-18 Image of the Raspbian Image wheezy.

Follow the basic instructions of the RPi config.

Important: if you don’t have 1920×1080 resolution (Full HD) it might not work for you. I have experienced that if your remote computer has a resolution of 1280×768 the ssvncviewer exits immediately. But if you changed it to a common resoltion of 1280×720 it will work with one little dissadvantage: The screen stays black with a circle shaped cursor. You have to login from another computer on the remote machine first, so it will work. These 1280xYYY resolutions make somehow troubles.

paste these lines in your commandline (or over putty)

Ommit the lines with proxy if you have none.

Programms and settings

# start a root session
sudo bash
echo "exec openbox-session">/home/pi/.config/openbox/autostart.sh
# proxies
export http_proxy=http://proxy1.sysstem.at:8080
export https_proxy=https://proxy1.sysstem.at:8080
echo "Acquire::http::Proxy "http://proxy1.sysstem.at:8080";">>/etc/apt/apt.conf
# updates
apt-get update
apt-get upgrade -y
# install programs
apt-get install x11vnc vim ssvnc unp htop -y
# autostart x11vnc
mkdir .config/autostart/
echo [Desktop Entry]>/home/pi/.config/autostart/x11vnc.desktop
echo Encoding=UTF-8>>/home/pi/.config/autostart/x11vnc.desktop
echo Type=Application>>/home/pi/.config/autostart/x11vnc.desktop
echo Name=X11VNC>>/home/pi/.config/autostart/x11vnc.desktop
echo Comment=>>/home/pi/.config/autostart/x11vnc.desktop
echo Exec=x11vnc -forever -shared -usepw -ultrafilexfer -display :0>>/home/pi/.config/autostart/x11vnc.desktop
echo StartupNotify=false>>/home/pi/.config/autostart/x11vnc.desktop
echo Terminal=false>>/home/pi/.config/autostart/x11vnc.desktop
echo Hidden=false>>/home/pi/.config/autostart/x11vnc.desktop
# remove desktop links
rm /home/pi/Desktop/*.desktop


If the X11VNC does not start correctly after boot try to change parameters in the x11vnc.desktop file

sudo vim /home/pi/.config/autostart/x11vnc.desktop

Time settings

# set timezone and select your city
sudo dpkg-reconfigure tzdata

#reconfigure ntp
sudo dpkg-reconfigure ntp

# set timeserver
sudo vim /etc/ntp.conf
server ntp.sysstem.at iburst

#stop ntp daemon
sudo /etc/init.d/ntp stop

#set time
sudo ntpdate ntp.sysstem.at

#start ntp
sudo /etc/init.d/ntp start

Monitor preferences

sudo vim /boot/config.txt

search and edit the following

# remove black borders on screen. set to 0 if problem occour

# pretend hdmi is plugged in and hdmi resolution will work

#Force console size


# set resolution to 1920x1080@60Hz
# hdmi_mode=4 for 1280x720@60Hz
#check website for more modes

# remove 1 of 2 desktops (we only need 1)

vim /home/pi/.config/openbox/lxde-rc.xml
# at desktops:

X11VNC settings

# define a password for your x11vnc
x11vnc -storepasswd /home/pi/.vnc/passwd

Upload a new desktop wallpaper, most likely the logo of your company

Change background by rightclicking on your desktop and choose a new picture

 VNC client – autostart script

sudo vim /home/pi/.config/autostart/vncview.sh

paste the following:

# Process check script: The script simply checks if a process is running and if it is not found to be running it will execute it.
# The script loops in preset intervals, hence it is possible to monitor a process continuously.

# Variables
ProcessInstances=`sudo ps aux | grep [s]svncviewer | wc -l`

#VNC Variables
para="-display :$display -viewonly -fullscreen -shared -passwd $passfile -scale $resolution -encodings zywrle"

# Logic
while [ $Running -gt 0 ]

if [ `sudo ps aux | grep [s]svncviewer | wc -l` -gt 0 ]; then
echo Process already running! Nothing to do.
echo Process not running! Starting process
# This is the command that should start the process in question
$vnc $host $para &

# How often shall we repeat the check?
echo Sleeping for $SleepInterval seconds
sleep $SleepInterval


exit 0

Service for VNC Client script

sudo vim /etc/init.d/vncviewd

paste the following

# Provides: vncviewd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start VNC Viewer Daemon.
# Description: Start VNC Viewer at boot time.

#! /bin/sh
# /etc/init.d/vncviewd

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
    echo "Starting vncviewd"
    # run application you want to start
    su pi /home/pi/.config/autostart/vncview.sh
    exit 0
    echo "Stopping vncviewd"
    # kill application you want to stop
    pkill -f vncview.sh
    exit 0
    echo "Usage: /etc/init.d/vncviewd {start|stop}"
    exit 1

exit 0

register vncviewd for autostart

sudo update-rc.d vncviewd

Monitor script

sudo vim /etc/init.d/monitor

paste the following


# Provides: monitor
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop Monitor
# Description: Start or stop Monitor
#! /bin/sh
# /etc/init.d/monitor
# Carry out specific functions when asked to by the system
case "$1" in
echo "Starting monitor"
# Enable HDMI with preferred mode
/opt/vc/bin/tvservice -p
# Change console to enable monitor output
# not very nice
sudo chvt 6
sudo chvt 7
echo "Stopping monitor"
/opt/vc/bin/tvservice -o
echo "Usage: /etc/init.d/monitor {start|stop}"
exit 1
exit 0

register for autostart

sudo update-rc.d monitor

Disable sleep mode for monitor

sudo vim /etc/kbd/config
# DO NOT changes this line. VNC needs to blank the console for fullscreen mode
BLANK_TIME=30 (Was 30)

# Powerdown time. The console will go to DPMS Off mode POWERDOWN_TIME
# minutes _after_ blanking. (POWERDOWN_TIME + BLANK_TIME after the last input)
# change this line (original was 30)

restart KBD

sudo /etc/init.d/kbd restart

Set a time schedule for your monitor. This reduces energy consumption.

Monitor only runs form 6 am to 6 pm (06:00-18:00)

sudo vim /etc/crontab

paste the following

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.


# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
0  6 * * 1-5    root    /etc/init.d/monitor start
0 18 * * 1-5    root    /etc/init.d/monitor stop

Delete your history

history -c

Test your configuration and make a backup of your SD card. It is always good to have one 😉

The only thing left what i wanted to do was to add a custom loading screen while booting.

Maybe you can get it working by using plymouth or other programs. If so please don’t hesitate to leave me a comment.

Here is an extenstion for this blog-entry you also might to read!

*Raspberry Pi is a trademark of the Raspberry Pi Foundation

VMware vSphere Hypervisor (ESXi) with Backup – Step by Step

VMware vSphere Hypervisor (ESXi) Installation



The plan is to use a simple and cheap Computer with two USB Flash Drive and a harddisk with lots of space to host one to three Windows VMware machines.

In our case we bought 15 Computers, 400 Euro each, 15 harddisks with 2 TB each for approx. 100 Euro each and 30 nano USB Flash Drive with 8GB for 7 Euro each.


Things you need to know

 We decided to use Nano USB Flash Drive because of the following reasons:

  • The filesystem is independent from the VMware Data Harddisks
    • Therefore we can easily exchange a broken Hostssystem
    • This is also the reason why there are 2 USB Flash Drive per Computer
    • It is cheap
    • (Speed: could be better if you used better USB Flash Drives. Nano Drives are a simple micro SD Card built-in in a nano USB card reader. And the speed of the micro SD Card is approximately equal to a single SATA-harddisk)

Usually I would recommend to change the Flash Drive after 5 years, but the vSphere Hypervisor does not write that much on the System Drive so you can use it theoretically much longer.

One of the worst things you could do edit files with Windows system tools.


I would recommend Notepad++ for Windows which can be downloaded here.

The thing is that Linux handles the <RETURN> different (r) than Windows (rn).


│   ├───backup.conf
│   └───vmware
│       └───firewall

Save the ghettoVCB.sh and the ghettoVCB-restore.sh in this directory:


the other files in


Do you prefer to get emailed when a backup finishes?

Open the ghettoVCB.sh file

There is a little fault in the script when it comes to saying HELO to the SMTP Server. In the script is

hostname -s

where we say HELO to. This is not correct, because we say HELO to the localhost instead to the SMTP Server.

change (line ~1088)

echo -ne "HELO $(hostname -s)rn" > "${EMAIL_LOG_HEADER}"



Do you prefer to get your emails over a Windows SMTP Server?

Open the ghettoVCB.sh file

The backupscript does not ask or try if it is a Windows or Linux SMTP Server. The problem which comes with the SMTP Server is similar to the text-editor problem: Windows uses Carriage Return Linefeed (<CR><LF>) and Linux just Carriage Return (<CR>).

Change (line ~1122)

                           "${NC_BIN}" -i "${EMAIL_DELAY_INTERVAL}" "${EMAIL_SERVER}" "${EMAIL_SERVER_PORT}" < "${EMAIL_LOG_CONTENT}" > /dev/null 2>&1


                           "${NC_BIN}" -C -i "${EMAIL_DELAY_INTERVAL}" "${EMAIL_SERVER}" "${EMAIL_SERVER_PORT}" < "${EMAIL_LOG_CONTENT}" > /dev/null 2>&1

You also need to open the built-in firewall for the Emails. This can be done be creating a custom firewall rule.

Create a textfile here:


with the following content:

  <service id='1000'>
    <rule id='0000'>



define your Backup Volume (datastore2 is available only if you have more than one harddisk)


Activate email log (if you prefer)


Email Server (I recommend the IP address instead of the SMTP server name because the name could not be resolved in every case such as network restrictions)


Email FROM (I recommend an suffix (VMB_) and the hostname as identifier)

EMAIL_FROM=VMB_`hostname –s`@sysstem.at

Email TO



Automatic Backup with cron

Create the file (no extension!)


with the following content (the first 4 lines are default by the vSphere Hypervisor, the 5th and last line is our custom line) Help about cron: Linuxhelp.net

#min hour day mon dow command
1 1 * * * /sbin/tmpwatch.py
1 * * * * /sbin/auto-backup.sh
0 * * * * /usr/lib/vmware/vmksummary/log-heartbeat.py
0 21 * * 0 /bin/ghettoVCB.sh -g /etc/backup.conf/ghettoVCB.conf -a

Computer preparation

Open the Computer install the 2TB harddrive (do not forget to connect a SATA and cable)

In my special case i had 6 (!) Windows partitions on the original harddrive. I needed to delete them before beginning with the installation, otherwise the vSphere Client would have problems adding the harddrive as datastore. Follow this tutorial if you have a similair situation.

Now plugin your USB Drive, and a keyboard (no mouse required) and a monitor.

Enter your BIOS/UEFI and change the boot priority to

  1. DVD
  2. SD/MMC (this should be the Nano USB)

all other is not needed and you can exclude it from boot order or place it anywhere past these two.

Another thing I did in the BIOS is to set the option: No halt on any errors. This will prevent the error

No Keyboard detectedPress F1 to resume

which makes a lot inexperienced users laugh. A computer (or server) needs to have a keyboard connected and after this error appears you can plugin a keyboard afterwards and press F1. But in my opinion we do not need to use a keyboard for this little servers. A powerplug and a networkcable is all we need.

Install the vSphere Hypervisor (ESXi)

Now the computer and the software is prepared we can install our servers.

  • Burn the predownloaded vSphere Hypervisor ISO to a disk (CD or DVD does not matter)
  • Boot the new server with it.
  • Accept the Terms of Condition (TOC)
  • Accept the EULA (End User Licence Agreement) with F11
  • Select the drive (in our case the SD/MMC Card) you want your vSphere Hypervisor to install to
  • Select a keyboard-layout of your choice
  • give a root password (choose a complex one, we add a user with a easier password to work with later)
  • Hit F11 to install
  • After the installation hit enter for reboot (the CD slot automatically opens, remove the CD)
  • Start the Computer, the screen of the vSphere Hypervisor appears
  • Hit F2 to make your preferences
  • I suggest to enter a fixed ip address aswell your DNS Servers

You are done with the configuration on the computer.

Configuration via vSphere Client

Download the vSphere Client via http://yourserverip/ (Link on the Website) and of course install it.

Save this setup for your colleagues as they may also want to use it and do not have to download it again. You only need do download and install it once, and not for every VMware Hypervisor you install.

I recommend to change the language of the vSphere to english (if it is not your default). From the information found here  you only need to add the following line to your shortcut (do not forget the space before the dash -)

 -locale en_US

Start the vSphere Hypervisor and type in the IP or hostname of the server you defined. Login with root and your password you entered before.

Enter your license key for unlimited use (there are some restrictions but it’s free!)

Add your harddiskdrives (or solidstatedrives) as new storages. I name them datastore 1-x because i have no use for these names and internally it is also named like this.

Now we add a new user with a new role, because we do not want to work with our VMs as root.

Go from home to Roles (Or Press [CTRL]+[SHIFT]+[R])

Add a new role with the following permissions

Confirm with OK and go back to the Inventory ([CTRL]+[SHIFT]+[H])

Go to local Users & Groups and make a right click then click add…

Give your user a login and also a strong password, but do not allow shell access because it should only be for the root user.

Go to Permissions and Add a Permission

In the window “Assign Permissions”

  • click Add…
  • select your user
  • click Add
  • click OK

Now assign the role you defined from the right column to your user and hit OK

Next step is to turn on SSH to get the prepared backupscript and other files onto the machine. Go to Configuration->Security Profile->Properties

Select SSH Server->Options…

Start the server with the button START but do NOT change the startup policy. It is not needed for this configuration.

Start WinSCP and PuTTY and enter your root credentials.


  • On your local filesystem navigate to your ESX folder (with the bin, etc and var folder within)
  • On the remote machine go to the /tmp folder.
  • copy the ESX folder to /tmp
In Putty
  • Change dir to /tmp with
cd /tmp
  • Make your backup-scripts executeable
chmod +x bin/ghettoVCB*
  • tarball and zip your files (stick together and compress. The filename must not exceed 12 characters. This is because of the 8.3 naming convention.)
tar -czvf sysstem.tgz bin/ etc/ var/
  • Verifiy if there were no errors
tar -tzvf sysstem.tgz
  • copy it to the bootbank
cp /tmp/sysstem.tgz /bootbank/
  • add your ‘module’ to the boot.cfg
sed -e '/modules=/s/$/ --- sysstem.tgz/' -i /bootbank/boot.cfg

Download the sysstem.tgz if you want to install more systems like this one.


For all further systems ONLY (skip this at the first system):

You just need to copy the sysstem.tgz to /bootbank in WinSCP and execute the following line in PuTTY

sed -e '/modules=/s/$/ --- sysstem.tgz/' -i /bootbank/boot.cfg


Shut your host down regularly over the vSphere Hypervisor so all your changes will be written to disk.

Now you are done with your VMware vSphere Hypervisor (ESXi).

In another article I will write about the migration from an old VMware host to the new vSphere Hypervisor and how to upgrade the host and also some more configuration such as the SSL Certificate and some other stuff.