7

I want make Ubuntu 18.04 server (text only) upgrade itself and keep original configure in a bash script. I tried

apt update && apt upgrade -y

and

apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

and

apt upgrade --yes --force-yes

and

export DEBIAN_FRONTEND=noninteractive
apt-get -o Dpkg::Options::="--force-confold" upgrade -q -y --force-yes

ALL not working which means they all ask for interactive.

  • "ALL not working", but what exactly is your output? Are you receiving any errors? Might be something else that fails your attempts? Also as @sudodus asked - what version and flavor of Ubuntu are you running? – Pizza Sep 20 '21 at 11:56
  • Related: https://askubuntu.com/questions/972516/debian-frontend-environment-variable – Jesse Nickles Feb 22 '23 at 10:17

1 Answers1

5

Finally I make a script that works.
This will try upgrade everything and keep the configuration file,
Only safe for flash installed box.

#!/bin/bash
sudo apt update -y
export DEBIAN_FRONTEND=noninteractive
sudo -E apt-get -o Dpkg::Options::="--force-confold" -o Dpkg::Options::="--force-confdef" dist-upgrade -q -y --allow-downgrades --allow-remove-essential --allow-change-held-packages