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
- RELEASE_UPGRADER_ALLOW_THIRD_PARTY=1
- https://www.linuxuprising.com/2019/01/ubuntu-users-can-now-keep-ppas-and.html
- To keep 3rd party repos -> still need to change xenial to bionix though....
- Re-enable 3rd party ppas
- for f in /etc/apt/sources.list.d/*.list; do sed -i 's/xenial/bionic/g' $f; sed -i 's/^# \(.*\) # disabled on upgrade to.*/\1/g' $f;done
- apt update
troubleshooting
- 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-
Solution:
-
Replace /etc/apt/sources.list with original file
-
e.g. for 16.04 Xenial:
-
cp -a /etc/apt/sources.list /etc/apt/sources.list.old;wget --output-document=/etc/apt/sources.list https://gist.githubusercontent.com/rohitrawat/60a04e6ebe4a9ec1203eac3a11d4afc1/raw/fcdfde2ab57e455ba9b37077abf85a81c504a4a9/sources.list && apt update
-
-
Ansible playbook