Tuesday, November 12, 2013

Raspberry Pi Journal #36


Updating Raspberry Pi


This should be clear to everybody, but knowing that there are noobs out there, I thought I should mention this. Then again, noobs probably won't be able to find this page, so ... what can I say?

Anyway, when you try to install packages via apt-get, it is advisable to update the database. Those packages are indexed and you should refresh the index as to what packages are available and from where. It does take some time, but you really should update at least weekly. If a certain package you're trying to update is not available, then you should at least refresh the index and see if the list is outdated.


  • sudo apt-get update


Another thing that you can do is to upgrade all your installed packages to the newest current version. I don't usually do this, believing that if it ain't broke, don't fix it. But sometimes there is a feature that is new, and you want it. And if you're upgrading one, may as well upgrade the other. This kind of upgrade will not delete any packages. I would always do double backup before doing this, however.


  • sudo apt-get upgrade


Another kind of upgrade will actually remove obsolete packages. Presumably, this will keep your system current, and clean. I don't see this being done anywhere, however. Besides, if I really want to have a clean, current system, I'd rather rebuild than doing a simple upgrade.


  • sudo apt-get dist-upgrade


If you want to upgrade only one package, you can install it again. This will update only the package you want. I would use this most of all. Furthermore, you can install old package if you want. Check out the man page for details.


  • sudo apt-get install packagename


Any old, obsolete package should be removed. There are two kinds: remove and purge. The difference between them is that remove retains the configuration files in anticipation of future installation. Purge will remove not only the package, but also the configuration files, as well. Practically speaking, though, "remove" is the command you use if you want to lighten up your distro, but unsure whether or not purging of a package will break it. So you remove it, and see if everything still works fine. Then you purge it out of the system.

Speaking of different packages, you're probably wondering how you can tell what packages are installed on your system. Use dpkg command. You can get a list of the different packages that are installed on your system with this command:


  • dpkg --get-selections


You should see the list of installed packages, with the status "install" alongside it. As always, check the man page for details.

No comments:

Post a Comment