Interview Prep/Linux/Patching, Automation & Golden Images

How do you avoid apt/dnf prompts in automation?

BeginnerProductionPatching, Automation & Golden Images
Answer
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
  -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
sudo dnf -y upgrade

Use apt-get rather than apt in scripts; apt warns that its CLI is not stable for scripting. --force-confold keeps your modified config files when packages ship new ones.

All Linux questions Roadmap: Linux

More on Patching, Automation & Golden Images