Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to do an apt-get dist-upgrade in Debian that not only automatically answers "yes" to all questions asked, but also uses reasonable defaults as answers to questions that are sophisticated enough to require various interactive dialog boxes to pop up? I'm thinking here of the keymap stuff that shows up when you upgrade libc6, and kernel image choices.

The goal is to be able to remotely initiate a rather large dist-upgrade - even for a machine that is severely behind the times - and not have to babysit it at all, unless something is just horribly, disastrously wrong.

Surely this is possible?

Thanks in advance!

share|improve this question
    
For those that only want to upgrade (rather than dist-upgrade) on Ubuntu, try the unattended-upgrade package. –  Jo Liss Jul 8 '11 at 14:24

3 Answers 3

up vote 16 down vote accepted

If you set DEBIAN_FRONTEND=noninteractive (to stop debconf prompts from appearing) and add force-confold and force-confdef to your /etc/dpkg/dpkg.cfg file, you should have a completely noninteractive package installation experience. Any package that still prompts you for information has a release critical bug (and I say that as both an automation junkie and as a Debian developer).

share|improve this answer
    
Thank you very much! Very helpful. –  Alex Balashov Aug 1 '09 at 18:16
    
this did not work for me. apt-listchanges was opened by less. –  magnetar Sep 12 '12 at 17:28
    
@magnetar: That's a problem with apt-listchanges, not apt. Uninstall apt-listchanges, or configure it appropriately. –  womble Sep 20 '12 at 1:16
    
Try: env APT_LISTCHANGES_FRONTEND=none apt-get dist-upgrade -u -y –  H.-Dirk Schmitt Feb 2 '13 at 17:28

Florian Lohoff posted a way to get what womble suggested into a single command:

DEBIAN_FRONTEND=noninteractive \
apt-get \
-o Dpkg::Options::="--force-confnew" \
--force-yes \
-fuy \
dist-upgrade

Of course you might also use -o Dpkg::Options::="--force-confnew --force-confdef" (search the the dpkg man page for confnew). I'm not sure in what cases this would make a difference though. I personally need the non-interactive upgrade to bring vanilla images up-to-date, in which case I suppose always picking the new config file (without --force-confdef) is a reasonable thing.

share|improve this answer

From the apt-get(8) man page:

   -y, --yes, --assume-yes
       Automatic yes to prompts; assume "yes" as answer to all prompts
       run non-interactively. If an undesirable situation, such as
       changing a held package, trying to install a unauthenticated
       package or removing an essential package occurs then apt-get will
       abort. Configuration Item: APT::Get::Assume-Yes.

For reference, the -y option works on yum(8) as well.

share|improve this answer
2  
I know about that. I use that flag and it successfully answers 'yes' to standard APT Y/N questions about keeping overwriting existing configs, etc., etc. Those aren't the questions I'm referring to. When I do an apt-get -y dist-upgrade it still gave me some 'dialog' prompts for what it considers big-ticket stuff, i.e. keymap changes, libc6-related service restart, etc. I was looking for an additional flag to turn that off as well. –  Alex Balashov Aug 1 '09 at 2:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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