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!


  1. I need help. My server did not start after a reboot, no matter what script i use. I´m using Raspbian “wheezy” from 2012-08-16. I did all the steps described above. I am wondering about your note to the chmod, but i did it. Can you help me?

    1. Hi Bernhard - I'm not too sure I'm afraid. The first time I tried, it also didn't work, but after I ran the chmod step it worked. I deleted the file, re-traced my steps a 2nd time and it worked that time too.

      Best advice? Scrap everything and try it again from scratch, re-run through the steps & instructions :) So often I kick myself when it works the 2nd time.

      Something else I tried when troubleshooting my initial issue was to connect via Putty and run the file you created manually - that'll identify if it's an issue with the file or configuring it in the start-up process.

      Hope this helps!

  2. In the tightvncserver file you use different names when starting and killing the process, why is that?

  3. If I understand it correctly, Xtightvnc in the pkill command is the name or the process that is actually running, whereas the application itself is called vncserver. I haven't confirmed this yet, but if you get vnc up and running and then look at your processes you should see one running called Xtightvnc.

  4. My own fault totally but any way you can *prevent* vnc from loading after doing this?

    I'm pretty new with Linux and currently cant figure out how to get onto my desktop now!!

    Probably something really obvious but Id appreciate a pointer.

    1. I haven't tried to use this myself, but after a quick google it looks like you'll just need to do the following:
      1) Delete the script file you created
      2) Remove the script from the startup process

      As mentioned, I haven't tested this myself, but I think the commands would be as follows:
      1) sudo delete /etc/init.d/tightvncserver
      2) sudo update-rc.d tightvncserver remove

      I hope it works!

    2. hi tass,

      i think you made a small mistake in the commands, delete should be rm (stands for remove), no shame on you becous i had to look it up ;) just letting every1 know.


    3. Thanks for the head-up Harrie!

  5. Good day to all
    I follow with interest and passion raspberry on the blog, I tried to start the tightvncserver to boot, that does not work, the error 'this (update-rc.d: using dependency based boot sequencing
    insserv: warning: script 'tightvncserver' missing LSB tags and overrides
    There will be 'a solution to the problem?

    1. Hi Stefano. I haven't actually hit that problem on my Pi, although I've tried to replicate this same process on my Ubuntu machine and got pretty much the same issue. Not too sure where it comes from. I see someone has posted an alternative below that might help. What he's done there is to put the actual command line straight into the rc file, rather than using the method above which places a shortcut of sorts into the rc file. This direct approach might get better results?

  6. You can actually have this start at a boot-up by editing your /etc/rc.local file and inserting the following before the exit 0 line.

    su -c "tightvncserver :1 -geometry 1280x1024 -depth 24" user

    Geometry you can change to your screen resolution and user would your username that you use to login. I have seen vncserver be used instead of tightvncserver but couldn't get that to work on my system.

    1. Thanks for the suggestion - hope this more direct approach helps Stefano out!

  7. I was also getting "Missing LSB tags and overrides."

    Adding the following to the start of the file seemed to take care of it:
    # Provides: vncserver
    # Required-Start: networking
    # Required-Stop:
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Starts VNC
    # Description:

    No warnings, and I was able to VNC in without a problem.

  8. Hi,

    It seems that tightvnc server stops responding after a day or so. I have it running on my pi which is always on. Any ideas why this happens and what a possible resolution is?


    1. Sorry samad64, I haven't had this problem as I don't tend to leave my Pi on long enough, and if I do it's to use Raspbmc. I'll try get one of my other boards up and running soon to see if I experience the same issue. What distro and you running?

  9. im using raspbian wheezey from 10/28/12

    thanks for looking into it

    1. Right - I've re-imaged, am up and running - let's see how it goes. I've got a few more questions:
      - how are you starting VNC - automatically or manually?
      - if manually, what command are you using?
      - if automatically are you using the initial command I posted, or have you tried the 'Unknown' comment above?

    2. I'm using your automatic method. Have not tried unknown's comment above.

      I've got a workaround for now, a cron job set to execute every 24 hours to kill the server and restart it... but its not very ideal

      When I am unable to connect, it simply says the password is incorrect - though a restart of vnc will let me in with the same password

    3. OK, thanks. Odd that it's giving you a password error. I've started with the other approach first (su -c "tightvncserver :1 -geometry 1280x1024 -depth 24" user). The poster suggested tighvncserver rather than vncserver as he had issues with vncserver - might be related. I'll keep it running over the next few days and keep connecting in and let you know how it goes.

    4. Hi samad64. So I've run this for the past few days, intermittently connecting, without any issue. There are a couple of things different that I can think of - it might be worth trying them one by one:
      - I'm using the latest Wheezy release (2012-12-16). You might not have to create a new blank image - simply running sudo apt-get update
      - I've running tightvncserver now rather than vncserver like my post outlines.

      I don't think it's hardware related due to the 'password' error, so I would hope of those 2 sort it out. Let us know how it goes.

  10. Adding:

    su -c "tightvncserver :1 -geometry 1280x1024 -depth 24" user

    to the /etc/rc.local file, did solve the missing LSB tags and overrides error.

    Thanks for the excellent guide!

  11. You can actually have this start at a boot-up by editing your /etc/rc.local file and inserting the following before the exit 0 line.
    su -c "tightvncserver :1 -geometry 1280x1024 -depth 24" user
    Ben Linus,
    Go here for more info

  12. Unfortunately my pi didn't start the vnc server after the reboot. What is the problem. This is a virgin pi, I have been using it since 2 hours. :)

  13. hello all,
    If you have problems with starting vnc on boot you can have a look on this website:

    For me it worked out this way :D
    Good luck!

    1. first i want to say that i am glad to help you with my google skills :P

      This method is also more useful in another way, becous it will only start the vnc server when startx (desktop) get launched so it will not try to start it up on boot and fail (if you are not starting startx automatically) and then you still need to start it manually..

      gr. Harrie

  14. hi ,
    i have a problem when running vnc server, like this :

    Couldn't start Xtightvnc; trying default font path.
    Please set correct fontPath in the vncserver script.
    Couldn't start Xtightvnc process.

    help me please

  15. Every tutorial I have used to get tightvncserver to start at boot renders my pi useless. After doing this one I am stuck in a login boot - A box asking me for my username pi, and my password raspberry with a choice of default login. Password works but then just comes back up again.

  16. This comment has been removed by the author.

  17. Raspberry Pi... Teach your kids about computing! I was a unix admin long ago (now a windows admin). Linux has had 20+ years to evolve and we're still dealing with this obtuse command-line crap. What a joke!

  18. Great job and very nice content... i read this blog, this blog is very helpful for me...
    I am very thankful to share this post.. I hope you have more information about this post.. So, Please share me.. Thanks..
    Visit my site:- Linksys Router Support

  19. Wow its really nice service provider to solve your problem in bootmgr missing error go through this link and solve your any query about windows 7 realted problem .
    BOOTMGR Missing in Windows 7
    Thank you
    Aalia lyon

  20. Gusto mo ba ng online work?
    Earn while you enjoy time with your Family & Lovedones!
    Email me: / /
    Contact Number: 09465046302
    For more details, kindly visit

  21. Great post!
    I also have a Pi blog:

  22. Now that you have the ability to VNC into your Pi, you will likely never want to hook it up to a monitor, mouse and keyboard again.

  23. woww artikel yg sangat sangat bagus sekali..

    Agen Bola Terpercaya

  24. Hi, I've been looking through the web to find a solution to my vnc or x problem. I can successfully connect to my pi via vnc however all I get is grey desktop and x mouse pointer. Any ideas why? Cheers, George

  25. i was using headless setup using ethernet, but suddenly it has stopped working due to ethernet port, . is there any way to setup headless via VNC directly without display ?

  26. i was using headless setup using ethernet, but suddenly it has stopped working due to ethernet port, . is there any way to setup headless via VNC directly without display ?

  27. If you are looking for space in East Delhi , just logon and make it perfect deal for yourself as is the best destination to find property deals in patparganj industrial area with real pics of premises and will complete solution to your requirements.Just logon to or call on +919958023001 and let the experts do the best for you.

    Office space for rent in patparganj Industrial area

    Office space for rent in karkardooma

    Commercial Office space for rent in laxmi nagar

    Office space for rent in Preet vihar

    Bridal Mehndi Artist in Delhi

  28. Do read and share your views ....

  29. This comment has been removed by the author.

  30. This comment has been removed by the author.

  31. This blog is fascinating one and it induce me to know more about it. Thanks for the sharing this blog and keep on sharing these kind of useful blogs. PG Near Perungudi

  32. This is really an informative blog for an ECE student like me this blog is worth to read and know many things about Raspberry pie.
    coworking space in Hyderabad
    Office Space in HyderabadOffice space for rent in Bangalore
    Coworking space in Bangalore

  33. Thanks for sharing .If you're planning to start a business in Chennai and looking for professional Business Center In Chennai can help you find a strategic business office address. They offers a wide range of serviced offices, office suites and tailormade office packages including business set-up services.
    Fully Furnished Office Space For Rent In Chennai
    Co-Working Space In Chennai
    Best Co-Working Space In Chennai
    Private Office Space In Chennai
    Office Space In Chennai
    Shared Office Space For Rent In Chennai
    Business Center In Chennai

  34. Halo,I'm Helena Julio from Ecuador,I want to talk good about Le_Meridian Funding Investors on this topic.Le_Meridian Funding Investors gives me financial support when all bank in my city turned down my request to grant me a loan of 500,000.00 USD, I tried all i could to get a loan from my banks here in Ecuador but they all turned me down because my credit was low but with god grace I came to know about Le_Meridian so I decided to give a try to apply for the loan. with God willing they grant me loan of 500,000.00 USD the loan request that my banks here in Ecuador has turned me down for, it was really awesome doing business with them and my business is going well now. Here is Le_Meridian Funding Investment Email/WhatsApp Contact if you wish to apply loan from / WhatsApp Contact:+1-989-394-3740.


    Website paling ternama dan paling terpercaya di Asia ^^
    Sistem pelayanan 24 Jam Non-Stop bersama dengan CS Berpengalaman respon tercepat :)
    Memiliki 9 Jenis game yang sangat digemari oleh seluruh peminat poker / domino

    - Adu Q
    - Bandar Q
    - Bandar Sakong
    - Bandar Poker
    - Poker
    - Domino 99
    - Capsa Susun
    - Perang Baccarat

    Permainan Judi online yang menggunakan uang asli dan mendapatkan uang asli ^^
    * Minimal Deposit : 20.000
    * Minimal Withdraw : 20.000
    * Deposit dan Withdraw 24 jam Non stop ( Kecuali Bank offline / gangguan )
    * Bonus REFFERAL 15 % Seumur hidup tanpa syarat
    * Bonus ROLLINGAN 0.3 % Dibagikan 5 hari 1 kali
    * Proses Deposit & Withdraw PALING CEPAT
    * Sistem keamanan Terbaru & Terjamin
    * Poker Online Terpercaya
    * Live chat yang Responsive
    * Support lebih banyak bank LOKAL

    Contact Us

    Website SahabatQQ
    WA 1 : +85515769793
    WA 2 : +855972076840
    FACEBOOK : SahabatQQ Reborn
    TWITTER : SahabatQQ
    YM :
    Kami Siap Melayani anda 24 jam Nonstop

    Daftar SahabatQQ


  36. Very informative and useful..
    Do visit the wesite for Transaction Management,Property Managment,
    Tenant Placement Service, Rental Property Management, Best Office Space In Bangalore,
    Fully Furnished Office Space, Flexible Office And Co-Working Space.
    Spaces India is a corporate leasing and Property Management Services Company.
    To know more about Commercial Spaces for rent
    To know about Spacesindia services we provide
    For Spacesindia Interior Designs.


    Yang Merupakan Agen Bandarq, Domino 99, Dan Bandar Poker Online Terpercaya di asia hadir untuk anda semua dengan permainan permainan menarik dan bonus menarik untuk anda semua

    Bonus yang diberikan NagaQQ :
    * Bonus rollingan 0.5%,setiap senin di bagikannya
    * Bonus Refferal 10% + 10%,seumur hidup
    * Bonus Jackpot, yang dapat anda dapatkan dengan mudah
    * Minimal Depo 15.000
    * Minimal WD 20.000

    Memegang Gelar atau title sebagai Agen BandarQ Terbaik di masanya

    Games Yang di Hadirkan NagaQQ :
    * Poker Online
    * BandarQ
    * Domino99
    * Bandar Poker
    * Bandar66
    * Sakong
    * Capsa Susun
    * AduQ
    * Perang Bacarrat (New Game)

    Tersedia Deposit Via pulsa :
    Telkomsel & XL


    Info Lebih lanjut Kunjungi :
    Website : NagaQQ
    Facebook : NagaQQ Official
    Kontakk : Info NagaQQ
    linktree : Agen Judi Online
    WHATSAPP 1 : +855977509035
    Line : Cs_nagaQQ
    TELEGRAM : +855967014811

    agen bandarq terbaik
    Winner NagaQQ
    Daftar NagaQQ
    Agen Poker Online

  38. Coworking is an American business model where individuals/organizations work independently under one roof yet share many office facilities and value-added services amongst each other. iSprout is now a leading coworking space in Hyderabad. We have a similar set-up in Vijayawada and Chennai with the vision to become a Pan-India brand. The concept of coworking spaces that started in the USA in 2005 is now a global phenomenon.

  39. iSprout Business Center is a home for inspiring workspaces created to match the needs of ever-growing business enterprises. From a single dedicated space for a freelancer to custom-made corners for established corporate, there is room for everyone. To name a few we offer private office spaces, coworking space in Hyderabad, single desks, virtual offices, conference rooms, everything with flexible plans which suit your pockets. Come join the hub of dreamers, workers and achievers! With a suite of amenities to offer, it just gets better!
    Gone are the days when just any office space would do. Today, employee productivity & office ecosystem are greatly influenced by the functional and aesthetic standards of the workstation. office space for rent in hyderabad is here to redefine the art, science, and the future of “plug-n-play office space for rent in Hyderabad, Vijayawada and Chennai.”

    office space in hyderabad
    office space for startups in hyderabad

    office space in vijayawada

    private office space for rent

    coworking space in chennai

    best coworking space in chennai

    business centre in hyderabad

  40. Next from Kia is the KIA SONET, comes with wild design, fantastic build quality, thundering speed & what not! Kia sonet features are truly incredible. Know Kia Sonet on road Price in Hyderabad CarKia 36 @ Jubliee Hills.

  41. Thanks for sharing good information about Start VNC automatically. It was extremely helpful. Coworking Office Space in Noida

  42. Thanks for sharing good information about Start VNC automatically. It is extremely helpful. Coworking Office in Noida

  43. This comment has been removed by the author.

  44. Thank you for sharing. I am so very inspired by your story. I have a mountain of student loans and other consumer debt that is screaming at me and that I need to pay off. After making a mess of my finances, I woke up and wanted to be home with my children. I’ve been home for 4 years, but have to get from under this mountain. Your post was filled with great information. It’s a lot to digest, but will definitely save this to reference over and over as I move forward.

    Harold Burton

  45. Thanks for sharing such an amazing content. Really loved to read such amazing blog. Well, coworking space has changed the whole scenario of working culture. These spaces has all facilities for a company that needs to be there. Well, Qdesq is a platform which provides coworking spaces, meeting rooms, virtual office, private office space, and many more. Visit Qdesq to know more about coworking spaces in India.

  46. "I needed to take a minute to thank you. Your guide convinced me to go ahead and finally start my own blog. I wanted it to look professional from day 1 and I must say that it has been a great hit ever since I launched. Your guide has helped me incredibly much, and I am so grateful you put it together for people like me. Keep up the awesome work. Thanks again and greetings from Germany.Joseph Donahue

  47. Very useful & enlightening post! Thank you very much for sharing. You can check-Spiritual Maturity: 7 Steps to Be More Spiritually Mature

  48. Great Share!

    First off, congratulations on this post. If You are searching for latest government jobs in India. Other department for state and central government job. This bucket list for you to know the right jobs detail.

    This is really awesome but that's what you always crank out my friend. Reading your story got my face leaking and my heart singing. Find qualification based government job and vacancies with employment news at:

    All the best, I’m excited to watch your journey! Keep it works and share your amazing thoughts.

    Great share and thanks again for the mention here,

    Thanks and Regards!

  49. Thats a very long and informative post. You where on point from the onslaught, choosing domain names, niche etc to readership and improving your blog. useful content from any upcoming blogger.
    Kelly Hubbard

  50. Great article. Keep writing. I have bookmarked your page.

    If you need free Dofollow backlinks. Follow the websites

  51. Having a office can boost your productivity because it gives you the positive environment to work and of course when you sit on a chair with a proper working mindset then it feels even more product and excellent to work, well for all those who are looking for the Our Office you can visit here to check out the best available options for you.