4

I am loading Jessie using Berryboot and I note it is from September 2015. This is too early as I need the latest version with Node-Red built in and some recent changes.

I see lots of threads about upgrading from Wheezy to Jessie - but what are the series of instructions (as user Pi) for ensuring I move from an older version of Jessie to the latest?

Any takers?

  • 2
    Joan's answer is correct but just to clarify some semantics: There are not really multiple versions of Jessie; the software is updated constantly (which is why you should consider running those commands on a regular basis, at least weekly). One might refer to "a more recent version", but there is really only one Jessie, there is just the potential for different installations to fall behind one another in terms of updates. I.e., it would be more correct to say "an install updated to 1-6-16", etc. The SD card images, as you notice, are snapshots from a particular point in time. – goldilocks Jan 6 '16 at 13:46
5

I run the following script on an ad hoc basis. I call it update and it lives in /usr/local/bin.

#!/bin/bash
PATH="/sbin:/usr/sbin:$PATH"
export PATH
sudo apt-get -yq update
#
sudo apt-get -yq upgrade
sudo apt-get -yq dist-upgrade
#
sudo apt-get autoremove

It updates the repositories indexes (update) and then upgrades (upgrade and dist-upgrade) all the packages. Finally it gets rid of any newly orphaned packages.

It ensures I'm up to date with the Raspbian and raspberrypi.org repositories.

EDITED TO ADD

/usr/local/bin is normally in the program path so the script can be run by simply typing update.

However the script must first have been made executable with the command

sudo chmod +x /usr/local/bin/update

  • 1
    Understand the commands - thanks. Just for anyone looking in - when making that file - you need to set execute permissions or you're told it is not found when running sudo update... all of which seems a bit daft when clearly it is found :-) – Peter Scargill Jan 6 '16 at 11:02
  • Something with the execute permission is not surprisingly flagged as "executable" but that can be a text script as well as a ELF or a.out or all sorts of other binary file. Without that bit (and the absence of a noexec option in the /etc/fstab entry for the filesystem where the file resides) the kernel/shell will ignore it as something it can run - which is a useful safety step if the binary or script is not compatible for THIS OS but is being stored or served to a different platform. Remember everything in *NIX is a file... – SlySven Jan 7 '16 at 3:21
  • @PeterScargill added note about executable bit. – joan Jan 7 '16 at 9:31
2

sudo apt-get update -y && sudo apt-get upgrade -y

Then, it's best practice to run sudo apt-get dist-upgrade -y after.


apt-get update refreshes the package index files from sources listed on /etc/apt/sources.list

apt-get upgrade will fetch new versions of packages that are installed on your system. This command will fail if there are conflicting packages, hence the need for apt-get dist-upgrade. The versions it will install depend on the index apt-get update downloaded, so running apt-get update beforehand is important.

apt-get dist-upgrade does the same thing as apt-get upgrade, but handles changing dependencies. It will attempt to upgrade more important packages at the expense of less important ones. Some packages may be automatically removed.

The -y switch tells apt-get to answer yes on any questions it might ask.

The && part tells whatever is running the command to execute the second command if the first is successful. So an apt-get upgrade won't happen if ever apt-get update fails.

(Source)

  • 1
    This answer was automatically flagged as low-quality because of its length and content. Would you mind explaining a little what's the instructions do? – Ghanima Jan 6 '16 at 11:15
  • @Ghanima updated – PNDA Jan 6 '16 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.