DistUpgradeController.py key 'devRelease' not set correctly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-release-upgrader (Ubuntu) |
Fix Released
|
High
|
Brian Murray | ||
Focal |
Fix Released
|
High
|
Brian Murray |
Bug Description
Test Case
---------
1) run do-release-upgrade
2) cancel the upgrade
3) cd /tmp/ubuntu-
4) edit DistUpgrade/
5) run 'sudo ./focal --frontend DistUpgradeViewGtk'
Observe a traceback which ends with "configparser.
With the version of the release upgrader from -proposed you will still need to edit DistUpgradeCache.py but will not encounter a Traceback.
Original Description
-------
I encountered this bug when execution do-release-upgrade on an Ubuntu 19.10 machine.
The release upgrade crashed ungracefully not calling abort() which should rollback all changes up to that point.
So I ended up with kind of a broken packages and configuration hell on my server machine.
I finally was able to perform the release upgrade by using apt / dpkg manually and resolving package dependencies and conflicts by hand.
The bug is on actually two places:
DistUpgradeCont
DistUpgradeCache.py (using unsafe code within except block: accessing undefined key 'devRelease' and provoke KeyError)
In general: the idea of except or catch or whatever is not just execute different code logic in case of exception. It is about doing the most basic stuff in case anything goes wrong (which should be as exception (error) safe as possible)
Bad practice:
try
doSomething();
catch exception
ignoreExcepti
doSomethingEl
Good practice:
try
doSomethingUn
catch exception e
logAndHandleE
useAnotherTry
That kind of bad structure costed me 1 day of error analysis (I am not a python guy) and another 1 day to revert the things from the failed upgrade.
The bugs:
Since I can not find any source code git repository, the next lines target the python module which can be found in /usr/lib/
(line numbers may differ)
Major Bug:
DistUpgradeCont
Current:
if self.options:
if self.options.
else:
Should be:
if self.options:
if self.options.
else:
Minor Bug:
DistUpgradeCach
Error arised in lines 667-668
elif self.config.
cause "devRelease" was not set on "Options" (see Major bug)
except block should not excecute unsafe code cause its job is error handling and roll back.
please make the entire block more fail safe (also use additional "try" if neccessary)
Since it seems like that accessing keys in python is not safe (reminds me of javascript)
it should be always checked if the key does even exist before accessing it.
Thanks for taking care of that.
Edit: I found the attachment feature after writing this report so please find the DistUpgradeCont
Please keep me up to date
<email address hidden>
Best Regards
Related branches
Changed in ubuntu-release-upgrader (Ubuntu): | |
status: | New → Fix Committed |
importance: | Undecided → High |
assignee: | nobody → Brian Murray (brian-murray) |
Changed in ubuntu-release-upgrader (Ubuntu Focal): | |
status: | New → In Progress |
importance: | Undecided → High |
assignee: | nobody → Brian Murray (brian-murray) |
description: | updated |
Changed in ubuntu-release-upgrader (Ubuntu Focal): | |
milestone: | none → ubuntu-20.04.1 |
Here is the content of /var/log/ dist-upgrade/ main.log (file path may differ):
root@snoobeam:/# cat /var/log/ dist-upgrade/ main.log e.cfg'] ' wText' view dist-upgrade/ apt-clone_ system_ state.tar. gz' lUpdate focalPostInitia lUpdate client- 10.1', skipping server- 10.1', skipping -mono certbot cli-common command- not-found- data cpp-7 cpp-8 daemon denyhosts dovecot-ldap dovecot-lmtpd dovecot- managesieved dovecot-mysql dovecot-sieve fail2ban fonts-dejavu fonts-glyphicon s-halflings g++-7 galera-3 gcc-10-base gcc-7 gcc-7-base gcc-8 gcc-8-base gcc-8-multilib gir1.2- spiceclientglib -2.0 inotify-tools jenkins ldap-account- manager ldap-auth-client ldap-auth-config lib32gcc-8-dev lib32mpx2 libaopalliance-java libapache-pom-java libapache2- mod-php7. 2 libapache2-mod-rpaf libapt-inst2.0 libapt-pkg5.0 libasan4 libatinject- jsr330- api-java libcdi-api-java libcilkrts5 libcommons-cli-java libcommons-io-java libcommons- lang3-java libcommons- parent- java libcrypto++-dev libcrypto++6 libcwidget3v5 libdbd-mysql-perl libdb...
2020-05-28 21:03:34,995 INFO Using config files '['./DistUpgrad
2020-05-28 21:03:34,995 INFO uname information: 'Linux snoobeam.com 5.4.0-33-generic #37-Ubuntu SMP Thu May 21 12:53:59 UTC 2020 x86_64'
2020-05-28 21:03:35,113 INFO apt version: '1.9.4ubuntu0.1'
2020-05-28 21:03:35,113 INFO python version: '3.7.5 (default, Apr 19 2020, 20:18:17)
[GCC 9.2.1 20191008]'
2020-05-28 21:03:35,114 INFO release-upgrader version '20.04.19' started
2020-05-28 21:03:35,129 INFO locale: 'en_US' 'UTF-8'
2020-05-28 21:03:35,202 INFO screen could not be run
2020-05-28 21:03:35,271 DEBUG Using 'DistUpgradeVie
2020-05-28 21:03:35,337 DEBUG enable dpkg --force-overwrite
2020-05-28 21:03:35,436 DEBUG creating statefile: '/var/log/
2020-05-28 21:03:36,399 DEBUG lsb-release: 'eoan'
2020-05-28 21:03:36,400 DEBUG _pythonSymlinkCheck run
2020-05-28 21:03:36,402 DEBUG openCache()
2020-05-28 21:03:36,403 DEBUG quirks: running PreCacheOpen
2020-05-28 21:03:36,403 DEBUG running Quirks.PreCacheOpen
2020-05-28 21:03:36,671 DEBUG /openCache(), new cache size 10843
2020-05-28 21:03:36,672 DEBUG need_server_mode(): can not find a desktop meta package or key deps, running in server mode
2020-05-28 21:03:36,672 DEBUG checkViewDepends()
2020-05-28 21:03:36,678 DEBUG running doUpdate() (showErrors=False)
2020-05-28 21:03:37,783 DEBUG openCache()
2020-05-28 21:03:38,020 DEBUG /openCache(), new cache size 10843
2020-05-28 21:03:38,020 DEBUG doPostInitialUpdate
2020-05-28 21:03:38,020 DEBUG quirks: running focalPostInitia
2020-05-28 21:03:38,021 DEBUG running Quirks.
2020-05-28 21:03:38,301 DEBUG MetaPkgs:
2020-05-28 21:03:38,692 DEBUG no PkgRecord found for 'fonts-urw-base35', skipping
2020-05-28 21:03:38,998 DEBUG no PkgRecord found for 'mariadb-
2020-05-28 21:03:38,998 DEBUG no PkgRecord found for 'mariadb-
2020-05-28 21:03:39,016 DEBUG no PkgRecord found for 'pgadmin4-apache2', skipping
2020-05-28 21:03:39,016 DEBUG no PkgRecord found for 'pgdg-keyring', skipping
2020-05-28 21:03:39,022 DEBUG no PkgRecord found for 'postgresql-12', skipping
2020-05-28 21:03:39,102 DEBUG Foreign:
2020-05-28 21:03:39,102 DEBUG Obsolete: apt-transport-https aptitude aptitude-common binfmt-support ca-certificates