Is there a sort of update tool for my Raspbian Debian 7 (Wheezy) package?

I installed php and lighttpd, and I want to keep those automatically updated for when bugs are found.

6 Answers 6


You need to enter some commands into the command line. First of all:

apt-get update  

(this will update the sources of software)

apt-get upgrade  

(this will upgrade everything to the latest version)

  • Is that all ther's to it? Will it upgrade everyting i installed via apt-get, including the Os itself?
    – Michel
    Commented Jan 27, 2013 at 21:33
  • 1
    The "OS itself" being the linux kernel, yes. The first time you do this there will probably be a bunch of updates since the repository will usually contain newer packages than the install image.
    – goldilocks
    Commented Jan 27, 2013 at 22:00
  • Everything that came from the apt repo, that is. Which is normally everything except your data, but might not include e.g. the kernel or bootloader in this case. If you've downloaded stuff from elsewhere or made some of your own, that obviously can't be automagically upgraded :)
    – XTL
    Commented Jan 28, 2013 at 7:02
  • Yep, that's all there is to it. You might have to answer the occasional yes/no question for larger pieces of software, but basically, it's that easy.
    – recantha
    Commented Jan 28, 2013 at 8:30
  • 1
    @Michel : Sometimes "the linux OS" is more broadly referred to as "GNU/Linux" which would include the kernel ("linux" in the strict sense) and userspace fundamentals such as the C library, shell, etc, which are under the GNU umbrella. With windows, all these parts are immutably integrated, whereas the linux world is more heterogeneous and modular, so there can be some confusion. I would have taken "the OS" here to refer to the debian wheezy distro (including the kernel), but you seemed to be referring to something more specific.
    – goldilocks
    Commented Jan 28, 2013 at 13:06

The unattended-upgrades package is the way to automate updating the OS in these debian-family distributions. Follow instructions found in here.

Basically you have to install the package:

sudo apt-get install unattended-upgrades

and add to /etc/apt/apt.conf.d/10periodic the following:

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "7";
APT::Periodic::Unattended-Upgrade "1";

Additionally (since it seems like the porting of the package has not been flawless), change the following line at the first section of /etc/apt/apt.conf.d/50unattended-upgrades:



//        "origin=Debian,archive=stable,label=Debian-Security";

Now your system keeps itself up-to-date automatically.

  • 3
    The last step (swapping out origin=Debian) is no longer necessary in the latest distribution of Raspbian.
    – Dolph
    Commented Feb 9, 2014 at 17:25
  • On Raspbian Wheezy, today, it seems to be still necessary as, for example: Checking: openssl (["<Origin component:'main' archive:'oldstable' origin:'Raspbian' label:'Raspbian' site:'mirrordirector.raspbian.org' isTrusted:True>"])
    – astorije
    Commented Jul 5, 2015 at 9:09
  • Oops, I misread. Yes, origin=Raspbian is still necessary in the configuration file but, no, you don't need to do it yourself anymore indeed, sorry...
    – astorije
    Commented Jul 5, 2015 at 9:12


 $ sudo apt-get update
 $ sudo apt-get upgrade 

Rpi-update first time: install git and certifications for reach github.

$ sudo apt-get install ca-certificates
$ sudo apt-get install git-core
$ sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update
$ sudo chmod +x /usr/bin/rpi-update

update firmware

$ sudo rpi-update
$ sudo ldconfig
$ sudo reboot

Rpi-update after:

$ sudo rpi-update
$ sudo ldconfig
$ sudo reboot



rpi-update can now be fetched directly via apt-get, so there would be no need to deal with Wget. So here is now the updated way:


 $ sudo apt-get update
 $ sudo apt-get upgrade 

You need to reboot the Raspberry Pi now, otherwise the new kernel would not be used!

Rpi-update first time: Install Git and certifications to reach GitHub.

$ sudo apt-get install ca-certificates
$ sudo apt-get install git-core
$ sudo apt-get install rpi-update

Update firmware

$ sudo rpi-update
$ sudo reboot



You could also write a little script with your apt-get steps in there and run it on a schedule once a day / however often you like, that's what I've done.

How to set up a cron job on the Pi:


How to write a bash script:


My script was just a simple

apt-get update
apt-get upgrade -yes
apt-get dist-upgrade -yes
apt-get clean

and I had it logging the output to a file with >> at the end of each line, e.g. apt-get update >> autoupdate.txt.

It's debatable as to how good an idea it is to do this though!

  • Any chance you could share the script &/or info on how to do these timed events. I imagine if the OP knew how to do this, he wouldn't have posted. Commented Dec 23, 2013 at 11:05

The Art of Web site has a wonderfull guide for Debian Wheezy that I only had to modify one line for it to work on my testing RPi. The link will take you to thier guide on cron-apt; which has been peraphrased bellow with modification for RPi repos' system explained.

Install cron-apt

sudo apt-get install cron-apt

Default configuration, actions, and custom configs can be found with

ls -hal /etc/cron-apt/config

ls -hal /etc/cron-apt/action.d/

ls -hal /etc/cron-apt/config.d/

Append the following to /etc/cron-apt/config file with sudo tee -a to enable emails to be sent with verbos information on the actions taken during automated update

echo 'MAILON="output"' | sudo tee -a /etc/cron-apt/config

echo 'DEBUG="verbose"' | sudo tee -a /etc/cron-apt/config

Logging is dumped to : /var/log/cron-apt/log

Make new action file for updating only security related packeges with touch command and add one line with sudo tee command; others will be downloaded but wait for sys-admin to install non-security updates. Allerts of updates and output will be emailed to root user or sys-admin for further review and/or actions to be taken.

sudo touch /etc/cron-apt/action.d/5-security

echo 'upgrade -y -o APT::Get::Show-Upgraded=true' | sudo tee -a /etc/cron-apt/action.d/5-security

Make new configuration file to use above action; spicifficly using /etc/apt/sources.list.d/security.list as the path for security updates. The file path maybe differant on your system if not fully based on Debian Linux; RPi now uses mirror director so /etc/apt/sources.list should be used instead, however, this can not be advised for production level servers because it'll update non-security updates too.

sudo touch /etc/cron-apt/config.d/5-security

echo 'OPTIONS="-o quiet=1 -o APT::Get::List-Cleanup=false -o Dir::Etc::SourceList=/etc/apt/sources.list.d/security.list -o Dir::Etc::SourceParts=\"/dev/null\""' | sudo tee -a /etc/cron-apt/config.d/5-security

Wait a day for cron-apt to update your system and check local logs with the following to see what was updated while you slept

sudo cat /var/log/cron-apt/log

This has been tested on one RPi to work for updating every package as well as an Unbuntu PC that only updates security related packages. So I feel that it is one of the more portable options availabe. The other package for automated updates, suggested by grassroot (thank you, I'm going to test it next), unattended-upgrades seemes like another great option to automate the update process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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