Upgrade from 20.04 to 22.04 failed: AttributeError: 'DistUpgradeController' object has no attribute 'tasks'

Bug #1969786 reported by Alex Diaz-Manero
108
This bug affects 14 people
Affects Status Importance Assigned to Milestone
ubuntu-release-upgrader (Ubuntu)
Fix Released
High
Brian Murray
Jammy
Triaged
High
Brian Murray

Bug Description

On focal 20.04 I executed the following commands:

sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install update-manager-core -y
sudo apt-get dist-upgrade -y
sudo apt-get autoremove

also I disabled 3rd party repositories (Google, FreeCad and some other)
 in /etc/apt/sources.list.d/

Checking the version I have
uname -mrs
  > Linux 5.13.0-40-generic x86_64
lsb_release -a
  > No LSB modules are available.
       Distributor ID: Ubuntu
       Description: Ubuntu 20.04.4 LTS
       Release: 20.04
       Codename: focal

Then I run the following command to execute the distribution upgrade procedure

sudo do-release-upgrade -d

  And deep down into the process (95%) I hit the following "bug"
...
Installing new version of config file /etc/xdg/autostart/org.gnome.Evolution-alarm-notify.desktop ...
Processing triggers for dbus (1.12.20-2ubuntu4) ...
Processing triggers for libc-bin (2.35-0ubuntu3) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done

Calculating the changes

Calculating the changes

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/jammy", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/DistUpgrade/DistUpgradeMain.py", line 241, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/DistUpgrade/DistUpgradeController.py", line 2038, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/DistUpgrade/DistUpgradeController.py", line 1992, in fullUpgrade
    if not self.calcDistUpgrade():
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/DistUpgrade/DistUpgradeController.py", line 1101, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):
AttributeError: 'DistUpgradeController' object has no attribute 'tasks'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/problem_report.py", line 477, in add_to_existing
    self.write(f)
  File "/usr/lib/python3/dist-packages/problem_report.py", line 430, in write
    block = f.read(1048576)
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/jammy", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/DistUpgrade/DistUpgradeMain.py", line 241, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/DistUpgrade/DistUpgradeController.py", line 2038, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/DistUpgrade/DistUpgradeController.py", line 1992, in fullUpgrade
    if not self.calcDistUpgrade():
  File "/tmp/ubuntu-release-upgrader-ql9_ymmz/DistUpgrade/DistUpgradeController.py", line 1101, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):
AttributeError: 'DistUpgradeController' object has no attribute 'tasks'

   I have to admit of this is really a but or if it is "self-made" that I broke the python installation myself as I see that is using python38 from my system.

  I haven' t rebooted the computer ... The computer is "functional" but many Apps (file browser, LibreOffice to mention 2) have disappeared. I am scared that if I reboot I am going to be left without notebook to work with.
  Any guidance to get out of this issue would be much appreciated.

Thank you for reading.
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.23
Architecture: amd64
CasperMD5CheckResult: skip
CrashDB: ubuntu
CrashReports:
 640:1000:125:3187472:2022-04-21 11:52:05.895499130 +0100:2022-04-21 11:52:04.499463693 +0100:/var/crash/_usr_libexec_tracker-extract.1000.crash
 640:0:125:55315:2022-04-21 11:57:28.128352842 +0100:2022-04-21 11:57:28.120352608 +0100:/var/crash/_usr_bin_do-release-upgrade.0.crash
CurrentDesktop: ubuntu:GNOME
DistroRelease: Ubuntu 20.04
InstallationDate: Installed on 2020-12-22 (484 days ago)
InstallationMedia: Ubuntu 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
Package: ubuntu-release-upgrader (not installed)
ProcVersionSignature: Ubuntu 5.13.0-40.45~20.04.1-generic 5.13.19
Tags: focal wayland-session dist-upgrade
Uname: Linux 5.13.0-40-generic x86_64
UpgradeStatus: Upgraded to focal on 2022-04-21 (0 days ago)
UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
VarLogDistupgradeAptclonesystemstate.tar.gz: Error: command ['cat', '/var/log/dist-upgrade/apt-clone_system_state.tar.gz'] failed with exit code 1: cat: /var/log/dist-upgrade/apt-clone_system_state.tar.gz: Permission denied
_MarkForUpload: True

Related branches

Revision history for this message
Nick Rosbrook (enr0n) wrote :

Hi,

If your system is still in this state, can you run `apport-collect 1969786` so we can see the upgrade log files?

Revision history for this message
Alex Diaz-Manero (admanero) wrote : CurrentDmesg.txt.txt

apport information

tags: added: apport-collected focal wayland-session
description: updated
Revision history for this message
Alex Diaz-Manero (admanero) wrote : JournalErrors.txt

apport information

Revision history for this message
Alex Diaz-Manero (admanero) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Alex Diaz-Manero (admanero) wrote : ProcEnviron.txt

apport information

Revision history for this message
Alex Diaz-Manero (admanero) wrote : VarLogDistupgradeAptHistorylog.txt

apport information

Revision history for this message
Alex Diaz-Manero (admanero) wrote : VarLogDistupgradeAptlog.txt

apport information

Revision history for this message
Alex Diaz-Manero (admanero) wrote : VarLogDistupgradeApttermlog.txt

apport information

Revision history for this message
Alex Diaz-Manero (admanero) wrote : VarLogDistupgradeLspcitxt.txt

apport information

Revision history for this message
Alex Diaz-Manero (admanero) wrote : VarLogDistupgradeMainlog.txt

apport information

Revision history for this message
Nick Rosbrook (enr0n) wrote : Re: Upgrade from 20.04 to 22.04 failed

Thanks, Alex.

Looking at VarLogDistupgradeMainlog.txt, I can see that need_server_mode() is returning true the third time it's called, and this leads to DistUpgradeController.calcDistUpgrade trying to read DistUpgradeController.tasks later on. But, DistUpgradeController.tasks would only be assigned if need_server_mode() had been true much earlier in the process.

That piece should be easy to fix, but I think the real issue is that 'ubuntu-desktop' is ostensibly not installed at that phase.

tags: added: rls-jj-incoming
Revision history for this message
Alex Diaz-Manero (admanero) wrote :

Are you referring to this line?

DEBUG need_server_mode(): can not find a desktop meta package or key deps, running in server mode

  I don't understand this ... It is a laptop that only has a SSH server active on (to be able to do SCP secure copy from the other CentOS box). Why it doesn' t have this "desktop meta package"?
  How do I install this "desktop meta package"?
  How do I go to install "ubuntu-desktop" then ? Because I only need desktop on my notebook, I certainly don't need server.

Revision history for this message
Alex Diaz-Manero (admanero) wrote :

Shall I run
do-release-upgrade -d --mode=desktop ?
shall I use the "--proposed" option?

Revision history for this message
Nick Rosbrook (enr0n) wrote :

> Are you referring to this line?

Yes, that is the line I was referring to.

> I don't understand this ...

Yeah, I think this is the real bug, the ubuntu-desktop meta package was removed during your upgrade (according to VarLogDistupgradeApttermlog.txt). You can try installing it again with `sudo apt install ubuntu-desktop`.

Revision history for this message
Alex Diaz-Manero (admanero) wrote :

I managed to sort it out ... After a scare. I lock the desktop and I was unable to log back in. Upon rebooting I would only get a text prompt and no network connection after login.
  Somehow I managed to get the ethernet up and running. Then with apt upgrade and apt install ubuntu-desktop... I have a flashy new desktop.
  I must say ... I was very impressed how the apt command gave me the option to see diffs in some config and policy files in ImageMagick, ssh_config and few others that I had forgotten about. Very impressed with that feature.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-release-upgrader (Ubuntu):
status: New → Confirmed
tags: added: fr-2316
tags: removed: rls-jj-incoming
Revision history for this message
kasimir normann (lafayettehl1) wrote :

Hello,
I was at the same point, but i accidently cancelled the process. After reboot load into the grub boot-menu.When i choose ubuntu as bootoption it is stuck in the boot. What shall i do or where should I ask?

Changed in ubuntu-release-upgrader (Ubuntu Jammy):
milestone: none → ubuntu-22.04.1
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-release-upgrader (Ubuntu Jammy):
status: New → Confirmed
Revision history for this message
Alistair Buxton (a-j-buxton) wrote (last edit ):

I encountered this bug while upgrading from Xubuntu 20.04. After the upgrader failed I ran it a second time and it was able to complete successfully. However, after rebooting, most of the desktop packages were missing. I had to install netplan, xubuntu-desktop, lightdm, gnome-polkit-agent, and maybe a few other things in order to have a working system. It is as if the upgrader thought my system was a server install?

My system was initially installed as Xubuntu 18.04, upgraded to 20.04, and then upgraded to 22.04.

Logs from the first upgrader run are on duplicate bug 1985966.

Revision history for this message
Gi (giammi56) wrote :

@a-j-buxton I encountered the same problem. Do you now have a working system? How have you indentified which packages to reinstall after rebooting?

Revision history for this message
Yue Ren (yue-ren-kl) wrote :

@giammi56 Some people reported how they fixed their system post-crash in this duplicate issue:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1986346

Revision history for this message
JamesRichardson (james-time4tea) wrote :

Idk if it is relevant, but I also had upgraded through multiple versions, starting with 16 I think.

I think this should be considered a relatively serious bug as it left me with an unbootable system, having to boot from USB, do some mounts and a chroot to get the luks/lvm boot working again. Luckily I had a spare computer to research this and create a suitable usb key, but this wouldn't be the case for all, even if they were confident enough to try that sort of thing.

Once it came back, because gnome was gone, the network was also non functional, which is another large barrier to recovering the system.

Benjamin Drung (bdrung)
summary: - Upgrade from 20.04 to 22.04 failed
+ Upgrade from 20.04 to 22.04 failed: AttributeError:
+ 'DistUpgradeController' object has no attribute 'tasks'
Changed in ubuntu-release-upgrader (Ubuntu):
assignee: nobody → Brian Murray (brian-murray)
status: Confirmed → In Progress
importance: Undecided → High
Changed in ubuntu-release-upgrader (Ubuntu Jammy):
importance: Undecided → High
status: Confirmed → Triaged
assignee: nobody → Brian Murray (brian-murray)
milestone: ubuntu-22.04.1 → jammy-updates
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-release-upgrader - 1:22.10.7

---------------
ubuntu-release-upgrader (1:22.10.7) kinetic; urgency=medium

  * DistUpgrade/DistUpgradeController.py: In one of the final calls of
    need_server_mode() do not allow switching from a desktop mode upgrade to a
    server mode upgrade. (LP: #1969786)
  * data/release-upgrades: set Prompt to normal
  * Run pre-build.sh: updating mirrors, demotions, and translations.

 -- Brian Murray <email address hidden> Mon, 22 Aug 2022 12:56:34 -0700

Changed in ubuntu-release-upgrader (Ubuntu):
status: In Progress → Fix Released
tags: added: foundations-todo
Revision history for this message
Gi (giammi56) wrote :

I still have the same problem, although it happens way earlier during the updating process:

----------------------------------------
Calculating the changes

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-0fysul7a/jammy", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-0fysul7a/DistUpgrade/DistUpgradeMain.py", line 241, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-0fysul7a/DistUpgrade/DistUpgradeController.py", line 2042, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-0fysul7a/DistUpgrade/DistUpgradeController.py", line 1991, in fullUpgrade
    if not self.calcDistUpgrade():
  File "/tmp/ubuntu-release-upgrader-0fysul7a/DistUpgrade/DistUpgradeController.py", line 1100, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):
AttributeError: 'DistUpgradeController' object has no attribute 'tasks'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/problem_report.py", line 477, in add_to_existing
    self.write(f)
  File "/usr/lib/python3/dist-packages/problem_report.py", line 430, in write
    block = f.read(1048576)
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Original exception was:
Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-0fysul7a/jammy", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-0fysul7a/DistUpgrade/DistUpgradeMain.py", line 241, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-0fysul7a/DistUpgrade/DistUpgradeController.py", line 2042, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-0fysul7a/DistUpgrade/DistUpgradeController.py", line 1991, in fullUpgrade
    if not self.calcDistUpgrade():
  File "/tmp/ubuntu-release-upgrader-0fysul7a/DistUpgrade/DistUpgradeController.py", line 1100, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):
AttributeError: 'DistUpgradeController' object has no attribute 'tasks'
=== Command detached from window (Wed Sep 21 08:56:43 2022) ===

Revision history for this message
Brian Murray (brian-murray) wrote :

I have a fix for this bug which should work, however we are missing a test case for verifying that the fix in fact worked. What we could use at this point in time are log files from people trying to upgrade and failing. The easiest way to send those in would be to open a new bug report using 'ubuntu-bug ubuntu-release-upgrader' after a failed upgrade attempt. Alternatively, the file 'apt-clone_system_state.tar.gz' in /var/log/dist-upgrade/ might be enough.

Revision history for this message
achan (achan1989) wrote :

Brian, see ubuntu-release-upgrader bug 1990308 (was marked as a duplicate of this one)

Revision history for this message
Gi (giammi56) wrote (last edit ):

Brian, here you can find the full requested log of the failed update. Inside the tar.gz there are apt.log and main.log

Revision history for this message
John Russell (jrussell-88) wrote (last edit ):

I have the same problem on upgrading 20.04 to 22.04

release-upgrader version '22.04.15'

Brian, I've attached the /var/log/dist-upgrade logs:
apt.log
apt-term.log
history.log
main.log

Let me know if you need anything else.

From main.log:
----------------------------------------------------
2023-03-02 15:52:37,810 ERROR not handled exception:
Traceback (most recent call last):

  File "/tmp/ubuntu-release-upgrader-mowqr6lm/jammy", line 8, in <module>
    sys.exit(main())

  File "/tmp/ubuntu-release-upgrader-mowqr6lm/DistUpgrade/DistUpgradeMain.py", line 241, in main
    if app.run():

  File "/tmp/ubuntu-release-upgrader-mowqr6lm/DistUpgrade/DistUpgradeController.py", line 2042, in run
    return self.fullUpgrade()

  File "/tmp/ubuntu-release-upgrader-mowqr6lm/DistUpgrade/DistUpgradeController.py", line 1991, in fullUpgrade
    if not self.calcDistUpgrade():

  File "/tmp/ubuntu-release-upgrader-mowqr6lm/DistUpgrade/DistUpgradeController.py", line 1100, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):

AttributeError: 'DistUpgradeController' object has no attribute 'tasks'

2023-03-02 15:52:37,810 DEBUG running apport_crash()

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.