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 Answers2

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.

harrymc
  • 498,455
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
patrick
  • 1,273