1

I have an Ubuntu 16.04 based appliance in which packages from the public repository are installed. But not directly using the public repository. Instead an update server is used which downloads the packages and then puts them into one file. An updater on system gets that files, extracts the packages and installs them.

Recently the base-files package gives me some trouble which contains the file /etc/issue (seems it contains the Ubuntu version):

Setting up base-files (9.4ubuntu4.8) ...

Configuration file '/etc/issue'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.

The updater installed the package using the following command line so far:

DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --quiet --yes --force-yes install [Absolute path of the packages]

After that problem occurred I tried the following command line:

DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get -o Dpkg::Options::="--force-confnew" --quiet --yes --force-yes install [Absolute path of the packages]

But that unfortunately didn't change anything.

Now my question is, if there is any option out there, which would fix that behaviour.

2
  • does this answer do it for you : stackoverflow.com/a/29523966/4770754 ?
    – tatsu
    Jun 21, 2019 at 14:31
  • @tatsu , thanks for your reply. Unfortunately I already use all of these parameters as well as the environment variable. And still I get that command line dialog.
    – Grizzly
    Jun 24, 2019 at 8:33

1 Answer 1

0

Thanks to the user seahawk1986 in the German Ubuntu forum: https://forum.ubuntuusers.de/topic/kommandozeilen-abfrage-bei-paketinstallation-u/

I found a solution to the problem: https://debian-handbook.info/browse/en-US/stable/sect.automatic-upgrades.html#id-1.9.17.9

I made a skript:

#!/bin/sh
export DEBIAN_FRONTEND=noninteractive
/usr/bin/yes '' | /usr/bin/apt-get --yes --force-yes --quiet -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install "$@"
  • --yes - Reply with "yes" to every question
  • --force-yes - Force to reply with "yes" to every question
  • --quiet - Don't show e.g. any progress bars.
  • -o Dpkg::Options::="--force-confdef" - Use the default answer if a configuration file should be replaced.
  • -o Dpkg::Options::="--force-confold" - Use the old configuration file if a configuration file should be replaced. Just in case the --force-confdef doesn't work.
  • "$@" - All package paths I pass to that script.
  • export DEBIAN_FRONTEND=noninteractive - Use only non-interactive mode when installing / updating packages.

The interesting part is the

/usr/bin/yes '' |

So far I've never worked with "yes". It simply prints 'y' followed by a line-break (means Enter) which then can be piped to the standard input (stdin). In this case we just use an empty string. That way "yes" floods the stdin with Enter inputs. If a question pops-up, in most cases the default option is used when replying to that question just by pressing enter. And that's the magic which helped me.

Hope that also helps to other people facing the same or similar problems. 🙂

You must log in to answer this question.

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