How to automatically apt-get?

Josef Wolf jw at
Tue Sep 25 19:11:08 UTC 2007

On Tue, Sep 25, 2007 at 05:53:05AM +0200, Mario Vukelic wrote:
> > 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
> Are you trying to break your system on purpose? man apt-get:

Thanks for the hint, Mario.  I added "--force-yes" as a test because
"--yes" did not do what it promises: run interactively.  I do not
really care whether dpkg installs the new config file or keeps my
modified config file.  The systems are configured completely automatic
(with a system similar to cfengine) anyway.  Thus, whatever config
file is kept, it will be overwritten by my hand-crafted version

> --force-yes
> Force yes; This is a dangerous option that will cause apt to continue
> without prompting if it is doing something potentially harmful. It
> should not be used except in very special situations. Using force-yes
> can potentially destroy your system! Configuration Item:
> APT::Get::force-yes

Unfortunately, this description is not very explicit about when/what
exactly this option has which effect.

> My suggestion would be to stop the project. Menu System > Administration
> > Software Sources has the option to install security updates
> automatically. That's as far as you should go.

This is exactly _not_ what I want.  The systems should be installed and
maintained completely unattended without any manual intervention.

> On, and BTW, if you want to automate other things with apt-get, use the
> Configuration Items instead of cmd line switches, it's much cleaner :)

Yes, but I still don't see how to run noninteractive with the configuration
items.  How do I keep dpkg from asking whether to keep my modified config
file or to installed the new file from the package?

More information about the ubuntu-users mailing list