{"id":12148,"date":"2016-04-26T12:16:10","date_gmt":"2016-04-26T06:46:10","guid":{"rendered":"http:\/\/blog.taragana.com\/?p=12148"},"modified":"2016-04-26T12:16:10","modified_gmt":"2016-04-26T06:46:10","slug":"safest-way-to-update-and-upgrade-raspbian-wheezy-raspberry-pi-os","status":"publish","type":"post","link":"https:\/\/blog.taragana.com\/safest-way-to-update-and-upgrade-raspbian-wheezy-raspberry-pi-os-12148","title":{"rendered":"Safest way to Update and Upgrade Raspbian Wheezy (Raspberry Pi OS)"},"content":{"rendered":"

There are plethora of instructions on the web to update and upgrade Raspbian and they work too, under normal conditions. However as Raspberry Pi is increasingly being used for Mission Critical tasks, it is important to adopt a procedure which won’t leave you with broken packages or worst, a un-bootable Operating System with your data on it. The following is a simple procedure, with explanations which will make sure that your Pi remains working.
\nFirst let’s update and upgrade the Pi with a single line command, run from terminal:<\/p>\n

sudo apt-get update -y && sudo apt-get upgrade -y && echo success<\/pre>\n

This will update and upgrade your Pi and if successful will print success at the end.
\nNow reboot the Pi with:
\nsudo reboot<\/code>
\nNormally Pi would reboot properly 99% of the time. If it refuses to boot then you can select the old kernel while booting to get back an usable version of Raspbian OS.
\nAfter this only two more steps remain. First is to dist-upgrade the Raspbian OS:
\nsudo apt-get dist-upgrade -y && sudo apt-get autoremove -y && echo success<\/code>
\nYou\u00a0 may wonder why I didn’t do it the very first time. While dist-upgrade<\/strong> is better than plain upgrade<\/strong> as it can intelligently install packages based on dependency, upgrade<\/strong> retains the older kernel and gives you a way to back out safely, unlike dist-upgrade<\/strong>. The procedure outlined above protects your OS from cases where the upgrade is broken for any reason.
\nNow all that is left is to reboot again to make sure everything is OK.:
\nsudo reboot<\/code>
\nYou may notice that I didn’t ask you to rpi-update<\/strong>, an instruction you will find at many places online. This is because you do not need rpi-update<\/strong>, the necessary firmware updates are already installed when you upgraded Raspbian<\/strong>. In fact, and I speak from experience, rpi-update can break your running system. Let’s leave that bleeding edge to who really needs it. If you are reading this article, then it can safely be said you don’t.
\nI used sudo apt-get autoremove<\/strong> to remove any extra packages.
\nThe &&<\/strong> before echo success<\/strong> makes sure success is printed only when the previous command succeeds.
\nDisk space is premium in SD Card. So it may not be out of place to check for available disk space before running update, upgrade or dist-upgrade:
\ndf -h<\/code>
\nTo save some space clean up the downloaded debian archives with:
\nsudo apt-get clean<\/code>
\nNow you understand why automating Raspbian updates \/ upgrades<\/strong> is a bad idea, unless you want to use the Raspberry pi only for testing purposes.
\nAdvanced Note on why rpi-update<\/strong> was not suggested:<\/p>\n

It’s current Raspberry Pi practice not to use this [ rpi-update ] unless you REALLY need it as it can bring in a non-working kernel (i.e. the latest bleeding edge version, which is not guaranteed to work).
\nMy thoughts are that it is not actually required once you have done the apt-get update\/upgrade cycle.<\/p><\/blockquote>\n

James<\/a>, Raspberry Pi Foundation (Trading)<\/p>\n","protected":false},"excerpt":{"rendered":"

There are plethora of instructions on the web to update and upgrade Raspbian and they work too, under normal conditions. However as Raspberry Pi is increasingly being used for Mission Critical tasks, it is important to adopt a procedure which won’t leave you with broken packages or worst, a un-bootable Operating System with your data […]<\/p>\n","protected":false},"author":1,"featured_media":11859,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,13],"tags":[87,88],"_links":{"self":[{"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/posts\/12148"}],"collection":[{"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/comments?post=12148"}],"version-history":[{"count":0,"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/posts\/12148\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.taragana.com\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/media?parent=12148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/categories?post=12148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.taragana.com\/wp-json\/wp\/v2\/tags?post=12148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}