Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qubes-update-gui doesn't start (crashes) after updating to 4.2 #9203

Closed
kord1e opened this issue May 9, 2024 · 5 comments · Fixed by QubesOS/qubes-desktop-linux-manager#194
Labels
affects-4.2 This issue affects Qubes OS 4.2. C: manager/widget C: updates diagnosed Technical diagnosis has been performed (see issue comments). P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. pr submitted A pull request has been submitted for this issue. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.

Comments

@kord1e
Copy link

kord1e commented May 9, 2024

Qubes OS release

4.2.0, updated from 4.1

Brief summary

Qubes Update tool crashes on start

Steps to reproduce

  1. Try to open Qubes Update tool from the menu

  2. Try to open Qubes Update tool from dom0 terminal using qubes-update-gui

Expected behavior

Qubes Update tool would start

Actual behavior

Qubes Update tool doesn't start. Console output is here:

$ qubes-update-gui
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/qui/updater/updater.py", line 60, in do_activate
    self.perform_setup()
  File "/usr/lib/python3.11/site-packages/qui/updater/updater.py", line 167, in perform_setup
    self.intro_page.populate_vm_list(self.qapp, self.settings)
  File "/usr/lib/python3.11/site-packages/qui/updater/intro_page.py", line 106, in populate_vm_list
    self.refresh_update_list(settings.update_if_stale)
  File "/usr/lib/python3.11/site-packages/qui/updater/intro_page.py", line 119, in refresh_update_list
    to_update = self._get_stale_qubes(cmd)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qui/updater/intro_page.py", line 214, in _get_stale_qubes
    in output.decode().split("\n", maxsplit=1)[0]
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: list index out of range
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/qui/updater/updater.py", line 60, in do_activate
    self.perform_setup()
  File "/usr/lib/python3.11/site-packages/qui/updater/updater.py", line 167, in perform_setup
    self.intro_page.populate_vm_list(self.qapp, self.settings)
  File "/usr/lib/python3.11/site-packages/qui/updater/intro_page.py", line 106, in populate_vm_list
    self.refresh_update_list(settings.update_if_stale)
  File "/usr/lib/python3.11/site-packages/qui/updater/intro_page.py", line 119, in refresh_update_list
    to_update = self._get_stale_qubes(cmd)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qui/updater/intro_page.py", line 214, in _get_stale_qubes
    in output.decode().split("\n", maxsplit=1)[0]
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: list index out of range
@kord1e kord1e added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. labels May 9, 2024
@alimirjamali
Copy link

If you run it with qubes-update-gui --log DEBUG, it should provide some debug information.

Since Update GUI runs qubes-vm-update --dry-run --update-if-stale 7 (7 days since last check is the default), then parses the output of it to synthesize the list of updatable VMs, it would be better to test it as well with qubes-vm-update --dry-run --update-if-stale 7 --log DEBUG.

@andrewdavidwong andrewdavidwong added C: manager/widget needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. C: updates affects-4.2 This issue affects Qubes OS 4.2. labels May 10, 2024
@simonthum
Copy link

simonthum commented May 12, 2024

I am experiencing the same problem. On my machine, the output of said command is empty, probably this results in split() not yielding an element at index 0.

Classic.

On my machine, the command only generates output if I add -A or -T. Adding -S does not produce output. Like the OP, I have just completed my in-place update to Qubes 4.2 and am now attempting to update VMs.

@simonthum
Copy link

I was a bit too fast. Pythons split() is sane enough:

Splitting an empty string with a specified separator returns [''].

I had a hunch and tried

qubes-update-gui --standalones

which worked once, but not more.

@Minimalist73
Copy link

Same thing happened to me this morning.
Took a quick look, and ended up changing this in /usr/lib/python3.11/site-packages/qui/updater/intro_page.py

 def _get_stale_qubes(self, cmd):
     try:
         self.log.debug("Run command %s", " ".join(cmd))
         output = subprocess.check_output(cmd)
         self.log.debug("Command returns: %s", output.decode())
 
+        output_lines = output.decode().split("\n")
+        if ":" not in output_lines[0]:
+            return set()
+
         return {
             vm_name.strip() for vm_name
-            in output.decode().split("\n", maxsplit=1)[0]
-            .split(":", maxsplit=1)[1].split(",")
+            in output_lines[0].split(":", maxsplit=1)[1].split(",")
         }
     except subprocess.CalledProcessError as err:
         if err.returncode != 100:
             raise err
         return set()

For the details, it runs qubes-vm-update --dry-run --update-if-stale <number> and wait for an output which contains some qube names. When no qubes are detected by the previous command, nothing is returned, meaning that index 0 is empty and the _get_stale_qubes function doesn't check for that.

@andrewdavidwong andrewdavidwong added diagnosed Technical diagnosis has been performed (see issue comments). pr submitted A pull request has been submitted for this issue. and removed needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. labels May 13, 2024
@thomasengesland
Copy link

thomasengesland commented May 25, 2024

My intro_page.py looks quite different, so I am not comfortable to edit it manually. Have 4.2.1.

The _get_stale_qubes function is not in the file.

intro_pages.py.md

    def refresh_update_list(self, update_if_stale):
        """
        Refreshes "Updates Available" column if settings changed.
        """
        self.log.debug("Refreshing update list")
        if not self.active:
            return

        output = subprocess.check_output(
            ['qubes-vm-update', '--dry-run',
             '--update-if-stale', str(update_if_stale)])

        to_update = [
            vm_name.strip() for vm_name
            in output.decode().split("\n", maxsplit=1)[0]
            .split(":", maxsplit=1)[1].split(",")]

        for row in self.list_store:
            row.updates_available = bool(row.vm.name in to_update)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.2 This issue affects Qubes OS 4.2. C: manager/widget C: updates diagnosed Technical diagnosis has been performed (see issue comments). P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. pr submitted A pull request has been submitted for this issue. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants