Bug 494498

Summary: distribution upgrade failed with error log and "exitMainLoopMidFlight"
Product: [KDE Neon] neon Reporter: Phil Hord <phil.hord>
Component: generalAssignee: Neon Bugs <neon-bugs>
Status: REPORTED ---    
Severity: normal CC: carlosd.kde, jr, neon-bugs
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Phil Hord 2024-10-11 03:03:08 UTC
SUMMARY
Distribution Upgrade to 24.04 failed multiple times with the same error log (pasted below).

STEPS TO REPRODUCE
1. Clicked upgrade notice for 24.04
2. Followed prompts to start upgrade
3. Got error message and failed upgrade

OBSERVED RESULT
Upgrade failed

EXPECTED RESULT
Upgrade success

SOFTWARE/OS VERSIONS

ADDITIONAL INFORMATION
Operating System: KDE neon 6.2
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2
Kernel Version: 6.8.0-45-generic (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-10610U CPU @ 1.80GHz
Memory: 15.3 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Manufacturer: LENOVO
Product Name: 20UCS4TR00
System Version: ThinkPad X1 Yoga Gen 5

Error output:
localuser:root being added to access control list
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Error in function pulse
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py", line 216, in pulse
    self.dialog.installationProgress.setValue(
TypeError: setValue(self, value: int): argument 1 has unexpected type 'float'
Error in function pulse
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py", line 216, in pulse
    self.dialog.installationProgress.setValue(
TypeError: setValue(self, value: int): argument 1 has unexpected type 'float'
Error in function pulse
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py", line 216, in pulse
    self.dialog.installationProgress.setValue(
TypeError: setValue(self, value: int): argument 1 has unexpected type 'float'
Error in function pulse
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py", line 216, in pulse
    self.dialog.installationProgress.setValue(
TypeError: setValue(self, value: int): argument 1 has unexpected type 'float'
Error in function pulse
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py", line 216, in pulse
    self.dialog.installationProgress.setValue(
TypeError: setValue(self, value: int): argument 1 has unexpected type 'float'
Error in function pulse
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py", line 216, in pulse
    self.dialog.installationProgress.setValue(
TypeError: setValue(self, value: int): argument 1 has unexpected type 'float'
Error in function pulse
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py", line 216, in pulse
    self.dialog.installationProgress.setValue(
TypeError: setValue(self, value: int): argument 1 has unexpected type 'float'
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Unit packagekit.socket does not exist, proceeding anyway.
Created symlink /run/systemd/system/packagekit.socket → /dev/null.
Created symlink /run/systemd/system/packagekit.service → /dev/null.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
No snaps are installed yet. Try 'snap install hello-world'.
No snaps are installed yet. Try 'snap install hello-world'.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
Error: GDBus.Error:org.freedesktop.systemd1.UnitMasked: Unit packagekit.service is masked.
exitMainLoopMidFlight
Removed /run/systemd/system/packagekit.service.
Removed /run/systemd/system/packagekit.socket.
Comment 1 Phil Hord 2024-10-11 03:07:25 UTC
I thought the python error may be causing some problem, and I fixed it manually.  I tried the upgrade again and it succeeded this time.  I don't know if that was really the reason for the failure, though.  I'm skeptical since it occurred several times before finally quitting. But maybe it's some lazy error checking code finally killing it in the end after watching the errors.  

The fix for this was trivial.

diff --git tmp/DistUpgradeFetcherKDE.py usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py
index 9d6e9e4..cea3873 100644
--- tmp/DistUpgradeFetcherKDE.py
+++ usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeFetcherKDE.py
@@ -213,9 +213,9 @@ class KDEAcquireProgressAdapter(apt.progress.base.AcquireProgress):
 
     def pulse(self, owner):
         apt.progress.base.AcquireProgress.pulse(self, owner)
-        self.dialog.installationProgress.setValue(
+        self.dialog.installationProgress.setValue(int(
             (self.current_bytes + self.current_items) /
-            float(self.total_bytes + self.total_items) * 100)
+            float(self.total_bytes + self.total_items) * 100))
         current_item = self.current_items + 1
         if current_item > self.total_items:
             current_item = self.total_items