8

We create a digital ocean server running on Ubuntu 20.04.2 LTS (Focal Fossa) per user. Once every few months, this process gets stuck, as something in the update requires a Y or a Yes etc. We keep looking up new ways to deal with "automatically say yes", but every few months, there is a new thing that we have not dealt with it seems.

Our update command right now is: yes Y | sudo apt-get dist-upgrade -qq -y.

Our most recent stop was this:

Configuring openssh-server
--------------------------

A new version (/tmp/fileJQ04gT) of configuration file /etc/ssh/sshd_config is 
available, but the version installed currently has been locally modified.

  1. install the package maintainer's version
  2. keep the local version currently installed
  3. show the differences between the versions
  4. show a side-by-side difference between the versions
  5. show a 3-way difference between available versions
  6. do a 3-way merge between available versions
  7. start a new shell to examine the situation

What do you want to do about modified configuration file sshd_config

Is this the way to automatically say yes to all questions in the update (or to just silently update)?

2
  • 1
    Could he use DEBIAN_FRONTEND=noninteractive? Is that a safe approach?
    – greymatter
    Commented Apr 1, 2021 at 18:17
  • 1
    this did not work Commented Apr 1, 2021 at 19:19

2 Answers 2

5

The SuperUser post Non-interactive apt upgrade suggests this script:

DEBIAN_FRONTEND=noninteractive \
  apt-get \
  -o Dpkg::Options::=--force-confold \
  -o Dpkg::Options::=--force-confdef \
  -y --allow-downgrades --allow-remove-essential --allow-change-held-packages

You might also consider using the unattended-upgrades package to download and install security upgrades automatically and unattended. For more information see one of the many articles about it: How to set up automatic updates on Ubuntu Server 18.04 or 20.04.

3
  • 2
    To this "script" just add the option you want to use: in the case of the asking guy: upgrade
    – k.Cyborg
    Commented May 21, 2022 at 16:31
  • anyone thinking of trying this with the ubuntu 22 openssh-server upgrade, i ran sudo apt-get -qy -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-confdef dist-upgrade and it still appears to be trying to prompt me even tho DEBIAN_FRONTEND=noninteractive is also set
    – volvox
    Commented Sep 18, 2023 at 18:25
  • @volvox, see my answer to your question at superuser.com/a/1813960/221324
    – nturner
    Commented Oct 24, 2023 at 20:07
1

I had the exact same issue with sshd_config trying to automate cassandra install for ubuntu 20.04

A new version (/tmp/filekTzYtV) 
of configuration file /etc/ssh/sshd_config is available, 
but the version installed currently has been locally   │      │ modified.

solution:

sudo DEBIAN_FRONTEND=noninteractive apt-get -yq upgrade

####full cassandra install script that bypasses interactive prompt####

sudo apt-get update -y
sudo DEBIAN_FRONTEND=noninteractive apt-get -yq upgrade
apt-get install openjdk-8-jdk -y
java -version
apt-get install apt-transport-https gnupg2 -y
wget -q -O - https://www.apache.org/dist/cassandra/KEYS | apt-key add -
sh -c 'echo "deb http://www.apache.org/dist/cassandra/debian 311x main" > /etc/apt/sources.list.d/cassandra.list'
apt-get update -y
apt-get install cassandra -y
systemctl status cassandra
1
  • See the comments below the question.
    – harrymc
    Commented Oct 24, 2023 at 20:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .