I would like to set some Ubuntu Server VM's to always pull updates (nightly) with out asking?


Have a look at cron-apt

  • 1
    +1. Please use a tool already built for this. – Zoredache May 18 '10 at 22:04
  • nothing wrong with using a tool pre-made for these things, but when you're talking about installing a package vs. a 1 line cronjob, it gets a little bit of a toss up. – cpbills May 19 '10 at 1:19
  • @cpbills: The suggested 1 line cronjob does a bad job when it comes to error reporting: You just get a daily mail by cron containing all the ouput. cron-apt is a bit better here. – Florian Diesch May 19 '10 at 16:55
  • @Florian Diesch what error output are you going to see? it's running in the background to update apt-get, and then download the packages (since he said he wanted to download only) and adding 2> /var/log/auto-apt 1> /dev/null would log errors. heck, even 1> /dev/null would only mail error messages. they are both solutions, depending on the person, one may be preferable to another, and for /me/ the single line cronjob would be preferable. – cpbills May 19 '10 at 16:59
  • @cpbills: Of course your solution is fine but cron-apt has some more features that may very well worth installing an additional package. As for the messages I like to have errors and updates logged to syslog so they are in the right context, get archived and I get notified via my usual log checker – Florian Diesch May 19 '10 at 17:28

There is an article here that will tell you how to disable the update pop-up.

You then need to run

apt-get update
apt-get -y upgrade

from root's crontab


i wouldn't recommend unattended updates, but you can do something like this:

create a file... update.sh for example, throw it in /usr/local/sbin/

apt-get update
apt-get -y dist-upgrade

run chmod 700 /usr/local/sbin/update.sh and chown root.root /usr/local/sbin/update.sh

then in root's crontab, add a line:

15 03 * * * /usr/local/sbin/update.sh

this will kick off your apt-get update and apt-get -y dist-upgrade every night at 3:15am

or just:

15 03 * * * /usr/sbin/apt-get update && /usr/sbin/apt-get -y dist-upgrade

in root's crontab sudo crontab -e to edit it.

if you want to download only:

15 03 * * * /usr/sbin/apt-get update && /usr/sbin/apt-get -yd dist-upgrade
  • 3
    the only reason i don't recommend automatic updates is that sometimes new packages clobber your old custom configurations. – cpbills May 18 '10 at 20:53
  • I agree, but that can at least be mitigated to a certain extent by installing something like etckeeper which will keep your configuration files in git/bzr. If they packagers do their job and follow the policies there isn't supposed to be any config breaking changes that happen during a single release. – Zoredache May 18 '10 at 22:08
  • ... local repository ... – Arthur Ulfeldt May 18 '10 at 22:55
  • sure, there is that, if you just want to download the updates... but you didn't ask that. – cpbills May 19 '10 at 1:09

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.