VNC Setup Guide!!! Board side only...

Hey guys

Thought i would make a tutorial on installing x11vnc and setting it up to auto load at startup with a permanent connection.

I am doing it so that anybody that is interested in using vnc can find the info in one location.

Ok here goes nothing!

  1. Open a terminal and type “opkg update” and hit enter.

  2. Type “opkg install x11vnc” and hit enter.

  3. Type “x11vnc -bg -o %HOME/.xllvnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0” and hit enter.

  4. Type “nautilus” it will bring up a new window. Make sure not to mess with any files if you do not know what they are. Nautilus gives you the ability to delete and modify system files.

  5. Now find a place to create a new file (make sure it is some where it will not get deleted).

  6. Now right click and select create new document > empty file.

  7. Now name the file what ever you like but make sure it is something that makes sense. Also make sure the name ends with “.sh”. For instance i used “VncStartup.sh”.

  8. Now double click the file and it will open an editor.

  9. Now type.

“#!/bin/sh
exec x11vnc -forever”

  1. Now save the file and close the editor.

  2. Make note of the file path, you will need it in the next step.

  3. In the terminal type “chmod a+x /your/file/path/here” (for instance mine was chmod a+x /MYscrpits/VncStartup.sh) and hit enter.

  4. Now on the panel (up top where it says Applications, Places, System) select System > Preferences > Startup Applications.

  5. Select the startup programs tab and click Add.

  6. For the name you can choose what ever you like (i used Vnc Startup). Now click browse and locate the file you created earlier and click open. For the comment you can type in a description that tells you what it does and click save.

  7. Close the startup applications window and restart your board.

Now you should have a working vnc connection and it doesn’t matter how many times you terminate your connection to the board, you will always have a connection and not have to restart x11vnc every time you want to use it.

Please note that you will need to know the ip address of the board to connect to it.

If i missed anything let me know or if anybody would like to add feel free to do so.

-Wil

I can’t test this right now because I have a crazy work week and I just reflashed my BBB the other day (opkg update/upgrade went in the weeds) but I’m pretty sure that I was able to simplify this by installing the angstrom-x11vnc-xinit package.

If I remember correctly, this provided a clean way to manage VNC through systemd - but I might be imagining that part. I was looking at this over two weeks ago and I’ve slept since then.

But I know for certain that I did not have to execute anywhere near this many steps after I installed that package.

A caveat is that I have no idea if this package is for root auto-login only or if it works just fine with a normal multi-user password protected setup. Like I said, I looked at this a while ago and unfortunately I can’t go back to it right now. But I wanted to throw it out there as something to take a look at.

Kleven

Hi Kleven

Just got done trying your two step method and it is the same as just installing x11vnc. It would still have to be configured. But by all means if you do have an easier way I am open to suggestions. Anything to make this as simple and painless of a process would be great.

The reason it is broken down so much is because I made it so that anyone with absolutely zero experience could zip through it without having to try to piece info together from different sites.

But like I said I am open to suggestions.

Best way to improve ones self is constructive criticism.

-Wil

Hmm… I just reflashed with the 2013.05.20 image a couple days ago and after installing and configuring a few things earlier today, I did this:

opkg install angstrom-x11vnc-xinit

And then I rebooted. VNC automagically started up and served display :0 - I’m connected to it right now.

Are you using an older image? If I have time I will try this again making sure I do nothing else but flash and then install the angstrom-x11vnc-xinit package so I can be certain I’m not doing something else that changes how this works.

As far as I can recall the only other thing I setup on the BBB since I reflashed was ntpd, but perhaps I am overlooking some other thing I might have done.

Can confirm the following:

    1. Upgrade to 05/20/13 image
    1. Run:
  • opkg update

  • opkg upgrade- 3. Reboot bbb

    1. Run: opkg install angstrom-x11vnc-xinit
    1. Reboot bbb
    1. From a vnc-client (vnc viewer), access 192:168.7.2:0
    1. Should see bbb desktop

If I skipped (2) and tried (4) direct, the install of x11vnc would fail.

thanks,
/venkat

I may have done something wrong then because that is the same procedure I used except mine was on my network and not over the USB.

Good to hear though cuz now I can stop writing this script that was kicking my ass this morning.

-Wil

Can get it to work over ethernet/intranet too.
The only hiccup though is that X related apps hog cpu resources like crazy:

  • With just X/x11vnc running in “sleep” state, %CPU use is 10%

  • With both + a terminal, %CPU use for all 3 is 20% and stays there

  • With both + gnome-system-monitor, %CPU for all 3 jumps to 80% and stays there

So I think, as expected, the bbb is not really suited for X-based use.

/venkat

Ok I’ll give it a shot here in a bit.

-Wil

Yes, I will second this observation re: performance. Running the Gnome desktop and a VNC server on display :0 definitely makes things a bit sluggish.

Running top doesn't show major CPU loading so perhaps it's memory or something in the network stack being obnoxious.

Venkat, thanks for the clarification. I knew I was probably forgetting something and the update/upgrade was an important detail I missed.

Ok tried it again and I feel Like an idiot. I was trying to vnc from my phone and it still would not connect until I realized I was trying to use the wrong port. Switched the port to 5900 and it works great.

Thanks for the info Kleven. It is much easier this way.

-Wil

I’m not sure that it would be a good idea to add it to the image. Most users won’t use it. It would just add to the teams work load trying to maintain it and keep it working. I think it is just as easy for anyone to install it themselves using Klevens procedure and that way the SW guys can concentrate on trying to get all the other stuff working.

-Wil

Ok I see your point.

-Wil

Wrong. You can use the mini usb cable to access the internet if you turn on connection sharing on the computer where you plug it into.

I was going to say “what if they don’t have internet access”. But they must have to have ordered a board.

-Wil

Another way to approach this is by using the autorun script section on you BBB and doing it through node.js. All you have to do is add this script to your autorun folder in Cloud9 and reboot the board.

// http://nodejs.org/api.html#_child_processes
var sys = require(‘sys’);
var exec = require(‘child_process’).exec;
var child;

// executes pwd
var command = “x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0 -forever”;
child = exec(command, function (error, stdout, stderr) {
sys.print('stdout: ’ + stdout);
sys.print('stderr: ’ + stderr);
if (error !== null) {
console.log('exec error: ’ + error);
}
});