2

I'm running a tiny script to update and upgrade some Debian machines but since some weeks it always stopped due to some "news" the terminal is showing up. When manually upgrading I see a "fullscreen" (find screenshot below) from some software, which forces to press "q". I don't want to change any software so I'd like to find a solution, which allows to just skip every interactive screen, while upgrading.

Usually I was fine using:

sudo apt-get update -y 
sudo apt-get upgrade -y

After I realised that the upgrade process is interrupted without any timeout, I also tried to use the solution of this post:

sudo DEBIAN_FRONTEND=noninteractive apt-get -y upgrade

but unfortunately with the same result. Does anybody have a solution to just upgrade a machine without any interruptions?

xorg-server, press q to quit

UPDATE:

First I just executed:

DEBIAN_FRONTEND=noninteractive

Secondary edited the /etc/dpkg/dpkg.cfg file to:

# dpkg configuration file
#
# This file can contain default options for dpkg.  All command-line
# options are allowed.  Values can be specified by putting them after
# the option, separated by whitespace and/or an `=' sign.
#

# Do not enable debsig-verify by default; since the distribution is not using
# embedded signatures, debsig-verify would reject all packages.
no-debsig

# Log status changes and actions to a file.
log /var/log/dpkg.log

force-confold
force-confdef

Finally I executed:

sudo apt-get upgrade -yq

This did the trick regarding "press q to quit" - great!

I think it's also working to combine the commands executing:

DEBIAN_FRONTEND=noninteractive
sudo apt-get -o Dpkg::Options::="--force-confnew --force-confdef" --force-yes -yq upgrade

Unfortunately another similar problem shows up now:

enter image description here

Also trying to edit /etc/apt/listchanges.conf didn't work out unfortunately:

[apt]
frontend=none
email_address=root
confirm=0
save_seen=/var/lib/apt/listchanges.db
which=news

SOLUTION:

I noticed (sorry if this is obvious for an advanced linux user) that bash acts different, when you execute a command via script than directly entering the command into the console.

All in all it was enough for my script solution to add the -yp parameter and set the DEBIAN_FRONTEND. In order to be safe, I'd edit the /etc/dpkg/dpkg.cfg file too.

#!/bin/bash
DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND
apt-get -yq update
apt-get -yq upgrade
  • The changes to listchanges.conf did work out, you're not seeing the changes any more. The rpi-chromium-mods screen is something else. – Stephen Kitt Dec 27 '16 at 11:53
5

you should set DEBIAN_FRONTEND=noninteractive, this will stop debconf prompts from appearing.

After that, add force-confold and force-confdef to your /etc/dpkg/dpkg.cfg file. then use the -y option

sudo apt-get -y update && sudo apt-get -y upgrade

or use this command

apt-get -o Dpkg::Options::="--force-confnew --force-confdef" --force-yes -y upgrade

and if it doesn't work try

apt-get -o Dpkg::Options::="--force-confnew" --force-yes -y upgrade
  • Thank you for your response. I changed the dpkg.cfg file and set DEBIAN_FRONTEND to non interactive but unfortunately with no success. Also the other commands didn't work for me. Do I get this right to just append dpkg.cfg with the lines force-confdef and force-confold ? The "q to quit" message just keeps popping up. – user3191334 Dec 27 '16 at 8:29
  • try adding the q flag sudo apt-get upgrade -yq – Dababi Dec 27 '16 at 8:53
  • Thanks that worked out for the first problem but another one shows up. Do you have a suggestion for the new one? – user3191334 Dec 27 '16 at 11:28
1

The update information is given by apt-listchanges. If you never want to see these details, you can remove the package entirely. Otherwise, you can configure it using /etc/apt/listchanges.conf; in your case,

frontend=mail

or

frontend=none

will avoid the installation being interrupted.

(apt-listchanges is supposed to do the right thing in these circumstances, so it should be possible to fix it in other ways so that it still shows update details in interactive mode. In particular you could try adding the -q option to apt-get.)

Note that simply running

DEBIAN_FRONTEND=noninteractive

won't change anything, you need to ensure it ends up in the environment of the apt-get processes:

export DEBIAN_FRONTEND
  • Thanks for your response, the -q command worked! I tried editing it to none but a similar problem shows up, I updated the post. Do you have any suggestions? – user3191334 Dec 27 '16 at 11:27
  • frontend=none only affects apt-listchanges. The rpi-chromium-mods screen you're getting is shown by the rpi-chromium-mods package (so I take it you're actually running Raspbian, is that correct?). – Stephen Kitt Dec 27 '16 at 11:51
  • You also need to export DEBIAN_FRONTEND. – Stephen Kitt Dec 27 '16 at 11:54
  • Yes right, I'm running Raspbian, I thought that this might be the problem too but I exported it by just typing DEBIAN_FRONTEND=noninteractive. Might there be a problem because I export the frontend using the pi user but upgrading via sudo? – user3191334 Dec 27 '16 at 11:59
  • 1
    No, just typing DEBIAN_FRONTEND=noninteractive doesn't export the variable, you need to run export DEBIAN_FRONTEND afterwards. – Stephen Kitt Dec 27 '16 at 12:01

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.