Monday, 20 August 2012

Start VNC automatically

So a couple of you have been asking about getting VNC to start automatically (me included).  I did a bit of digging and have figured out what to do - it's a few simple steps.  First off though, must say thanks to Penguin Tutor for the actual answer to this issue.

So - I'm assuming that you have VNC up and running, working if you start it manually after each boot.  If not, take a look here.

Create startup file
The first thing you need to do is create the file that will actually start VNC on startup.  I'm doing this via Putty (instructions here), but you can just as easily use Terminal directly from the Pi.

Type the following:
sudo nano /etc/init.d/tightvncserver

NOTE: nano is a lightweight editor - the command above will create a new file called tightvncserver in the /etc/init.d directory and open it for editing, presenting the following screen (note the [ New File ] entry at the bottom, indicating a new file):

Once you have the file open, paste in the following:

# First configure the user you want to run this under - this will generally be pi, unless you've created your own users
export USER='pi'

eval cd ~$USER

# Check the state of the command - this'll either be start or stop 
case "$1" in
    # if it's start, then start vncserver using the details below
    su $USER -c '/usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565'
    echo "Starting vncserver for $USER "
    # if it's stop, then just kill the process
    pkill Xtightvnc
    echo "vncserver stopped"
    echo "Usage: /etc/init.d/vncserver {start|stop}"
    exit 1
exit 0

# thanks - check out for more info!

NOTE: In the file I've specified my own resolution with the text -geometry 1280x800 - you can leave this out of you want

This will be what your screen now looks like.

To exit, press Ctrl+X.  You'll be prompted to save - just type Y:

You'll be prompted to confirm the filename - just press Enter:

Set file properties
Once that's done make sure the file has the right propertied by typing the following:
sudo chmod 755 /etc/init.d/tightvncserver

NOTE: Important to do this step every time you modify this file.  I redid these steps to create the tutorial, skipped this step and couldn't VNC in on the reboot!

Add File to startup sequence
And now just add your file to the list of startup actions by typing the following:
sudo update-rc.d tightvncserver defaults

And that should be it!  Just restart, and you should be able to VNC straight in!

Wednesday, 15 August 2012

Raspbian Wheezy

So after I few weeks (months?) off I decided to try get back on top of everything and what better way than to try out the latest image?  If you haven't been keeping up with things, you'll be pleased to know that Raspberry Pi now has it's own distribution (sort of) - Raspbian.  This is a version of the Debian distribution that has been compiled specifically for the Raspberry Pi.

It can be found here on the Raspberry Pi downloads page:

As always, you can write this using the standard DD process (see here for instructions).

Right - now let's boot it up and see what it's like!  I'm using VNC to connect remotely as my TV is occupied (by Game of Thrones, so I'll let it pass).  You can find out how to set this up here, or just use your TV or HDMI-enabled monitor.

So - I've written my card now and here's what I have:

You'll notice that there's no ssh file here, but I tried booting it up and found that SSH was enabled, so no issue there (I need it to connect over SSH, download VNC and remote in).

And that's it - I'm booted up.  Nothing looks too different:

although I did notice that performance seemed quite good.  Issues I saw in earlier versions (massive CPU usage from Midori, etc.) were gone.

And I'm back baby!!!