[Bug 2058133] Re: update-manager crashes when ua security-status response is an error

Nathan Teodosio 2058133 at bugs.launchpad.net
Fri Mar 22 09:51:38 UTC 2024


** Description changed:

+ Impact
+ ------
+ 
+ Update Manager fails to launch in the LTS releases if the 'ua security-
+ status' command fails. It tries to parse its output to generate the list
+ of ESM-Apps and ESM-Infra updates that would be available if the system
+ were attached to Ubuntu Pro.
+ 
+ However, if ua finds some problem with unrelated stuff, such as
+ Livepatch (as evidenced by the attached ubuntu-advantage.log), the
+ command just raises an error, crashing Update Manager.
+ 
+ Although Update Manager could catch the error, it would result in not
+ showing Ubuntu Pro updates, simply because the information is not there.
+ 
+ Better would be to ditch 'ua security-status' in favor of the Ubuntu Pro
+ API. The updates() end point[1] will provide the information Update
+ Manager wants even if the Ubuntu Advantage daemon has issues with other
+ services such as Livepatch (as evidenced by #10), and it does not raise
+ exceptions.
+ 
+ [1] https://canonical-ubuntu-pro-client.readthedocs-
+ hosted.com/en/latest/references/api/#u-pro-packages-updates-v1
+ 
+ Test Plan
+ ---------
+ 
+ To be determined
+ 
+ Where problems could occur
+ --------------------------
+ 
+ In the Ubuntu Pro section of the updates, in form of wrong package data
+ (e.g. package name, version number etc.) in the description pane when
+ selecting a package. The section could not show at all, or the program
+ could crash right away.
+ 
+ Original bug report
+ -------------------
+ 
  Below is a run in my computer. Please send a mail on what to do
  
  fuga2:~> update-manager -c -d
  Unexpected error(s) occurred.
  For more details, see the log: /var/log/ubuntu-advantage.log
  To file a bug run: ubuntu-bug ubuntu-advantage-tools
  Traceback (most recent call last):
-   File "/usr/lib/python3/dist-packages/UpdateManager/backend/InstallBackendAptdaemon.py", line 448, in _on_finished
-     self._action_done(action,
-   File "/usr/lib/python3/dist-packages/UpdateManager/backend/__init__.py", line 365, in _action_done
-     self.window_main.start_available()
-   File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 241, in start_available
-     self.refresh_cache()
-   File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 459, in refresh_cache
-     self._get_ua_security_status()
-   File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 285, in _get_ua_security_status
-     s = json.load(p.stdout)
-   File "/usr/lib/python3.10/json/__init__.py", line 293, in load
-     return loads(fp.read(),
-   File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
-     return _default_decoder.decode(s)
-   File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
-     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
-   File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
-     raise JSONDecodeError("Expecting value", s, err.value) from None
+   File "/usr/lib/python3/dist-packages/UpdateManager/backend/InstallBackendAptdaemon.py", line 448, in _on_finished
+     self._action_done(action,
+   File "/usr/lib/python3/dist-packages/UpdateManager/backend/__init__.py", line 365, in _action_done
+     self.window_main.start_available()
+   File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 241, in start_available
+     self.refresh_cache()
+   File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 459, in refresh_cache
+     self._get_ua_security_status()
+   File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 285, in _get_ua_security_status
+     s = json.load(p.stdout)
+   File "/usr/lib/python3.10/json/__init__.py", line 293, in load
+     return loads(fp.read(),
+   File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
+     return _default_decoder.decode(s)
+   File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
+     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
+   File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
+     raise JSONDecodeError("Expecting value", s, err.value) from None
  json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  ^CTraceback (most recent call last):
-   File "/usr/bin/update-manager", line 125, in <module>
-     Gtk.main()
-   File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 1687, in main
-     with register_sigint_fallback(Gtk.main_quit):
-   File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
-     next(self.gen)
-   File "/usr/lib/python3/dist-packages/gi/_ossighelper.py", line 237, in register_sigint_fallback
-     signal.default_int_handler(signal.SIGINT, None)
+   File "/usr/bin/update-manager", line 125, in <module>
+     Gtk.main()
+   File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 1687, in main
+     with register_sigint_fallback(Gtk.main_quit):
+   File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
+     next(self.gen)
+   File "/usr/lib/python3/dist-packages/gi/_ossighelper.py", line 237, in register_sigint_fallback
+     signal.default_int_handler(signal.SIGINT, None)
  KeyboardInterrupt
  
  fuga2:~> ubuntu-bug ubuntu-advantage-tools
  fuga2:~> update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/usr/local/share/doc /usr/local/share/doc none bind,ro 0 0): cannot open directory "/usr/local/share": permission denied
  update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/usr/share/xubuntu-docs /usr/share/xubuntu-docs none bind,ro 0 0): cannot open directory "/var/lib": permission denied
  Gtk-Message: 11:23:47.656: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
  
  fuga2:~>
  
  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: ubuntu-advantage-tools 31.2~22.04
  ProcVersionSignature: Ubuntu 5.15.0-100.110-generic 5.15.143
  Uname: Linux 5.15.0-100-generic x86_64
  ApportVersion: 2.20.11-0ubuntu82.5
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: ubuntu:GNOME
  Date: Sun Mar 17 11:22:30 2024
  PackageArchitecture: all
  SourcePackage: ubuntu-advantage-tools
  UpgradeStatus: Upgraded to jammy on 2024-03-09 (7 days ago)
  apparmor_logs.txt: Mar 17 11:15:18 fuga2 kernel: audit: type=1400 audit(1710666917.933:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="ubuntu_pro_apt_news" pid=1057 comm="apparmor_parser"
  cloud-id.txt-error: Invalid command specified 'cloud-id'.
  livepatch-status.txt-error: Failed running command '/snap/bin/canonical-livepatch status' [exit(1)]. Message: error executing status: open /var/snap/canonical-livepatch/264/livepatchd.err: permission denied
  uaclient.conf:
-  contract_url: https://contracts.canonical.com
-  log_level: debug
+  contract_url: https://contracts.canonical.com
+  log_level: debug

** Summary changed:

- update-manager crashes when ua security-status response is an error
+ [SRU] update-manager crashes when ua security-status response is an error

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to update-manager in Ubuntu.
https://bugs.launchpad.net/bugs/2058133

Title:
  [SRU] update-manager crashes when ua security-status response is an
  error

Status in ubuntu-advantage-tools package in Ubuntu:
  Invalid
Status in update-manager package in Ubuntu:
  Fix Released
Status in update-manager source package in Xenial:
  In Progress
Status in update-manager source package in Bionic:
  In Progress
Status in update-manager source package in Focal:
  In Progress
Status in update-manager source package in Jammy:
  In Progress
Status in update-manager source package in Noble:
  Fix Released

Bug description:
  Impact
  ------

  Update Manager fails to launch in the LTS releases if the 'ua
  security-status' command fails. It tries to parse its output to
  generate the list of ESM-Apps and ESM-Infra updates that would be
  available if the system were attached to Ubuntu Pro.

  However, if ua finds some problem with unrelated stuff, such as
  Livepatch (as evidenced by the attached ubuntu-advantage.log), the
  command just raises an error, crashing Update Manager.

  Although Update Manager could catch the error, it would result in not
  showing Ubuntu Pro updates, simply because the information is not
  there.

  Better would be to ditch 'ua security-status' in favor of the Ubuntu
  Pro API. The updates() end point[1] will provide the information
  Update Manager wants even if the Ubuntu Advantage daemon has issues
  with other services such as Livepatch (as evidenced by #10), and it
  does not raise exceptions.

  [1] https://canonical-ubuntu-pro-client.readthedocs-
  hosted.com/en/latest/references/api/#u-pro-packages-updates-v1

  Test Plan
  ---------

  To be determined

  Where problems could occur
  --------------------------

  In the Ubuntu Pro section of the updates, in form of wrong package
  data (e.g. package name, version number etc.) in the description pane
  when selecting a package. The section could not show at all, or the
  program could crash right away.

  Original bug report
  -------------------

  Below is a run in my computer. Please send a mail on what to do

  fuga2:~> update-manager -c -d
  Unexpected error(s) occurred.
  For more details, see the log: /var/log/ubuntu-advantage.log
  To file a bug run: ubuntu-bug ubuntu-advantage-tools
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/UpdateManager/backend/InstallBackendAptdaemon.py", line 448, in _on_finished
      self._action_done(action,
    File "/usr/lib/python3/dist-packages/UpdateManager/backend/__init__.py", line 365, in _action_done
      self.window_main.start_available()
    File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 241, in start_available
      self.refresh_cache()
    File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 459, in refresh_cache
      self._get_ua_security_status()
    File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 285, in _get_ua_security_status
      s = json.load(p.stdout)
    File "/usr/lib/python3.10/json/__init__.py", line 293, in load
      return loads(fp.read(),
    File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
      return _default_decoder.decode(s)
    File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
      obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
      raise JSONDecodeError("Expecting value", s, err.value) from None
  json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  ^CTraceback (most recent call last):
    File "/usr/bin/update-manager", line 125, in <module>
      Gtk.main()
    File "/usr/lib/python3/dist-packages/gi/overrides/Gtk.py", line 1687, in main
      with register_sigint_fallback(Gtk.main_quit):
    File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
      next(self.gen)
    File "/usr/lib/python3/dist-packages/gi/_ossighelper.py", line 237, in register_sigint_fallback
      signal.default_int_handler(signal.SIGINT, None)
  KeyboardInterrupt

  fuga2:~> ubuntu-bug ubuntu-advantage-tools
  fuga2:~> update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/usr/local/share/doc /usr/local/share/doc none bind,ro 0 0): cannot open directory "/usr/local/share": permission denied
  update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/usr/share/xubuntu-docs /usr/share/xubuntu-docs none bind,ro 0 0): cannot open directory "/var/lib": permission denied
  Gtk-Message: 11:23:47.656: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.

  fuga2:~>

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: ubuntu-advantage-tools 31.2~22.04
  ProcVersionSignature: Ubuntu 5.15.0-100.110-generic 5.15.143
  Uname: Linux 5.15.0-100-generic x86_64
  ApportVersion: 2.20.11-0ubuntu82.5
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: ubuntu:GNOME
  Date: Sun Mar 17 11:22:30 2024
  PackageArchitecture: all
  SourcePackage: ubuntu-advantage-tools
  UpgradeStatus: Upgraded to jammy on 2024-03-09 (7 days ago)
  apparmor_logs.txt: Mar 17 11:15:18 fuga2 kernel: audit: type=1400 audit(1710666917.933:11): apparmor="STATUS" operation="profile_load" profile="unconfined" name="ubuntu_pro_apt_news" pid=1057 comm="apparmor_parser"
  cloud-id.txt-error: Invalid command specified 'cloud-id'.
  livepatch-status.txt-error: Failed running command '/snap/bin/canonical-livepatch status' [exit(1)]. Message: error executing status: open /var/snap/canonical-livepatch/264/livepatchd.err: permission denied
  uaclient.conf:
   contract_url: https://contracts.canonical.com
   log_level: debug

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/2058133/+subscriptions




More information about the foundations-bugs mailing list