How to automatically apt-get?

Matt Morgan minxmertzmomo at
Tue Sep 25 16:05:21 UTC 2007

On 9/25/07, Derek Broughton <news at> wrote:
> Josef Wolf wrote:
> > Hello,
> >
> > I'd like to automatically "apt-get update" and the like.  I've tried the
> > following:
> >
> >   #!/bin/sh
> >   export DEBIAN_FRONTEND=noninteractive
> >   apt-get --yes --force-yes -q update
> >   apt-get --yes --force-yes -q upgrade
> Besides Mario's good point about the danger of doing this, it's the hard
> way.
> Apt is _designed_ to do automatic updates.  You should have
> a /etc/cron.daily/apt, which does the "apt-get update".  Then you need to
> have the following lines in a file somewhere in /etc/apt/apt.conf.d/:
> APT::Periodic::Update-Package-Lists "1";
> APT::Periodic::Download-Upgradeable-Packages "1";
> The first says to get the updates, the second says to download them.  At
> this point they're still not installed, just downloaded.
> To actually do unattended upgrades (Ack!!!) you need to set some parameters
> regarding unattended upgrades - see the Apt howto, I don't know how that's

What problems have arisen in the recent past (I'm looking for
examples) with unattended upgrades in Ubuntu? I have very successfully
done unattended upgrades with other OSes in the past (but am new to

On Debian, for example, on servers at work I'd usually set up my
sources.list to upgrade only from the security repos, so that I'd get
security updates right away (important) but not feature changes
(important to avoid on a server, usually). In 2+ years I never had
serious trouble with automatically applying security updates in

The distinction between security & other repos is one of Debian's
insanely great features and its presence in Ubuntu was important for

Would you guys recommend doing the same thing (ie automatically
upgrading from the security repos only) with Ubuntu, or not? In this
case we're talking about a desktop with very few services (eg no file
shares, I don't even ssh into it), so local config changes are almost


More information about the ubuntu-users mailing list