Ubuntu do-release-upgrade unattended

apt upgrade without questions

  • vi /etc/apt/apt.conf.d/local

    • DPkg::options { "--force-confdef"; "--force-confold"; }
  • apt update
  • DEBIAN_FRONTEND=noninteractive apt --yes -o Dpkg::Options='--force-confdef --force-confold' dist-upgrade
    • --force-confdef = select default option @questions
    • --force-confold = if no default -> use old config

Do a release update and accept defaults (=no to new config files)

  • vi /etc/apt/apt.conf.d/local
    • DPkg::options { "--force-confdef"; "--force-confold"; }
  • DEBIAN_FRONTEND=noninteractive do-release-upgrade -f DistUpgradeViewNonInteractive |& tee ~/do-release-upgrade.log

 

Handling of 3rd party repositories

troubleshooting

  • log files are in
    • /var/log/dist-upgrade
  • resume interrupted upgrade with
    • dpkg --configure -a
  • unattended do-release-update does not seem to output error messages.
  • list of possible errors:
    • After updating your package information, the essential package
      'ubuntu-minimal' could not be located. This may be because you have
      no official mirrors listed in your software sources, or because of
      excessive load on the mirror you are using. See /etc/apt/sources.list
      for the current list of configured software sources.
      In the case of an overloaded mirror, you may want to try the upgrade
      again later.


      Restoring original system state

Ansible playbook

https://www.jeffgeerling.com/blog/2018/ansible-playbook-upgrade-all-ubuntu-1204-lts-hosts-1404-or-1604-1804-etc