APT upgrade without configuration related prompts
Since a lot of our clients use small Amazon EC2 instances to host their websites, we have to deal with the Linux updates regularly. Also, the goal is to spend only the time necessary on repeatable tasks. This leads to the automatization of the process.
The known issue is that some of the packages ask for the update of the configuration files. In most cases, we want to keep them as they are.
The same issue is with Grub configuration, the difference is that Grub displays the message in a different way and the typical switches (DPKG Options) are not working with Grub config.
The solution for this was to set noninteractive mode during the update process. Right now our updates are running smoothly without asking too many questions:
# export DEBIAN_FRONTEND=noninteractive # apt update # apt upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" # apt autoremove -y
Please note that the above commands should be executed as root or prepend with sudo if executed from the user account. If you want to run them all at once, you can use:
export DEBIAN_FRONTEND=noninteractive; apt update ; apt upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" ; apt autoremove -y