canonical / checkbox

Checkbox is a testing framework used to validate device compatibility with Ubuntu Linux. It’s the testing tool developed for the purposes of the Ubuntu Certification program.
https://checkbox.readthedocs.io
GNU General Public License v3.0
33 stars 50 forks source link

Session Data Not Removed After Purging Checkbox Packages #1521

Open mauriciocoder opened 1 month ago

mauriciocoder commented 1 month ago

Enhancement Proposal

Description:

I encountered an issue with the Checkbox application where session data persisted even after purging the Checkbox Snap packages. After executing the following command to purge the packages:

sudo snap remove --purge checkbox checkbox22

I noticed that the session data in the directory /var/tmp/checkbox-ng was not removed. This led to complications when attempting to launch the Checkbox CLI, as the status of previously executed jobs remained in an "unsupported" state.

When I tried to run the Checkbox CLI with the command:

$ checkbox.checkbox-cli

I received the following output:

$PROVIDERPATH is defined, so following provider sources are ignored ['/home/mauricio/.local/share/plainbox-providers-1', '/var/tmp/checkbox-providers-develop'] 
WARNING:plainbox.secure.providers.v1:Skipped file: /snap/checkbox22/current/providers/checkbox-provider-base/units/stress/suspend_cycles_reboot.md
Failed to disable unit: Unit file plainbox-autostart.service does not exist.
rm: cannot remove '/etc/systemd/system/plainbox-autostart.service': No such file or directory
Failed to disable unit: Unit file plainbox-autostart.service does not exist.
rm: cannot remove '/etc/systemd/system/plainbox-autostart.service': No such file or directory
Traceback (most recent call last):
  File "/snap/checkbox22/current/bin/checkbox-cli", line 8, in <module>
    sys.exit(main())
  File "/snap/checkbox22/current/lib/python3.10/site-packages/checkbox_ng/launcher/checkbox_cli.py", line 166, in main
    return subcmd.invoked(ctx)
  File "/snap/checkbox22/current/lib/python3.10/site-packages/checkbox_ng/launcher/subcommands.py", line 257, in invoked
    if not self._auto_resume_session(self.resume_candidates):
  File "/snap/checkbox22/current/lib/python3.10/site-packages/checkbox_ng/launcher/subcommands.py", line 425, in _auto_resume_session
    self._resume_session(last_session.id, None)
  File "/snap/checkbox22/current/lib/python3.10/site-packages/checkbox_ng/launcher/subcommands.py", line 597, in _resume_session
    raise ValueError(
ValueError: Unsupported outcome for resume not-supported

Despite purging and reinstalling the packages, the problem persisted. Upon investigating the source code, I discovered that Plainbox retains session data in /var/tmp/checkbox-ng. I manually removed the session data from this directory, and after doing so, the Checkbox CLI functioned as expected.

Expected Behavior:

Steps to Reproduce:

  1. Install the Checkbox Snap package.
  2. Execute a few jobs within Checkbox.
  3. Purge the Checkbox package using sudo snap remove --purge checkbox checkbox22.
  4. Reinstall Checkbox.
  5. Attempt to launch the Checkbox CLI with checkbox.checkbox-cli.

Additional Information:

Thank you for looking into this issue!

syncronize-issues-to-jira[bot] commented 1 month ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CHECKBOX-1599.

This message was autogenerated

mauriciocoder commented 1 month ago

It would be helpful to have a solution for the "unsupported" job status when launching checkbox-cli. Perhaps invalidating the previous session and starting a new one could resolve the issue.

Hook25 commented 1 month ago

Sadly this is a feature, not a bug. The idea is that if you need to go back to a previous session, you can always do so because they are stored there, so purging them is not an option. Additionally, the fact that they auto-resumed is also a feature (that admittedly needs a bit of improvement). The idea is that if your session reboots the machine, upon it restarting, the session must go on, if it can't, that is an error condition worth a crash.

With all of this being said, this is a bug (the fact that Checkbox crashes on non-supported), you were very unlucky here, but you were most likely running into another failure condition as changing the version of the providers mid-session (given that it was autoresuming it) will still crash Checkbox.