[Bug 1945661] Re: [SRU] openstack commands fail with GTK3 error

Timo Aaltonen 1945661 at bugs.launchpad.net
Mon Dec 16 13:22:32 UTC 2024


Hello Amit, or anyone else affected,

Accepted cmd2 into focal-proposed. The package will build now and be
available at
https://launchpad.net/ubuntu/+source/cmd2/0.8.5-2.1ubuntu0.1 in a few
hours, and then in the -proposed repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed.  Your feedback will aid us getting this
update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested, what testing has been
performed on the package and change the tag from verification-needed-
focal to verification-done-focal. If it does not fix the bug for you,
please add a comment stating that, and change the tag to verification-
failed-focal. In either case, without details of your testing we will
not be able to proceed.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance for helping!

N.B. The updated package will be released to -updates after the bug(s)
fixed by this package have been verified and the package has been in
-proposed for a minimum of 7 days.

** Changed in: cmd2 (Ubuntu Focal)
       Status: In Progress => Fix Committed

** Tags added: verification-needed verification-needed-focal

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to cmd2 in Ubuntu.
https://bugs.launchpad.net/bugs/1945661

Title:
  [SRU] openstack commands fail with GTK3 error

Status in cmd2 package in Ubuntu:
  Fix Released
Status in cmd2 source package in Focal:
  Fix Committed

Bug description:
  [ Impact ]

   * There is a bug in cmd2 v0.8.5 where an exception is thrown when GTK3
     libraries are not installed. This causes Python applications using
     cmd2 to crash unexpectedly

   * This patch backports a fix from upstream that handles that expection
     gracefully, allowing applications to function properly.

   * The workaround to this was to install GTK3, which is not ideal as the
     Python applications are command line tools, not graphical

  [ Test Plan ]

  1) Deploy focal
  2) Enable wallaby, xena or yoga proposed

  sudo add-apt-repository cloud-archive:yoga-proposed

  3) sudo apt update
  4) sudo apt install python3-openstackclient
  5) confirm packages installed 

  dpkg -l | egrep "(cmd2|pyperclip|cliff)"

  python3-cliff                   3.10.0...
  python3-cmd2                    0.8.5-2.1...
  python3-pyperclip               1.7.0-1

  6) Simulate that a display is present

  export DISPLAY=:1

  7) source a credentials file

  source novarc

  8) Try to list servers

  openstack server list

  Traceback (most recent call last):
    File "/usr/bin/openstack", line 6, in <module>
      from openstackclient.shell import main
    File "/usr/lib/python3/dist-packages/openstackclient/shell.py", line 23, in <module>
      from osc_lib import shell
    File "/usr/lib/python3/dist-packages/osc_lib/shell.py", line 24, in <module>
      from cliff import app
    File "/usr/lib/python3/dist-packages/cliff/app.py", line 23, in <module>
      import cmd2
    File "/usr/lib/python3/dist-packages/cmd2.py", line 585, in <module>
      _ = pyperclip.paste()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 667, in lazy_load_stub_paste
      copy, paste = determine_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 558, in determine_clipboard
      return init_gi_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 167, in init_gi_clipboard
      gi.require_version('Gtk', '3.0')
    File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
      raise ValueError('Namespace %s not available' % namespace)
  ValueError: Namespace Gtk not available

  9) Enable focal proposed pocket

  
  cat <<EOF >/etc/apt/sources.list.d/ubuntu-$(lsb_release -cs)-proposed.list
  # Enable Ubuntu proposed archive
  deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe
  EOF

  sudo apt update

  10) update python3-cmd2

  sudo apt install python3-cmd2

  11) retest, should not produce any error

  openstack server list


  [ Where problems could occur ]

   * The code change being backported is already present in jammy+,
  therefore no issues or regressions are expected. However, given that
  cmd2 is a library used by many different applications, and some may be
  coded to handle the ValueError exception on version 0.8.5, or other
  code modifications that exist in later versions but not in 0.8.5, this
  change could potentially break the interaction with other applications
  that were expecting a ValueErrro to be thrown. However, such scenario
  is considered to be unlikely.

  [ Original bug description ]

  Openstack release: Wallaby
  OS: Ubuntu 20.04 server edition
  After installation of python3-openstackclient from apt, while setting up user, roles and project, I executed following command:
  openstack domain create --description "An Example Domain" example

  Error:
  Traceback (most recent call last):
    File "/usr/bin/openstack", line 6, in <module>
      from openstackclient.shell import main
    File "/usr/lib/python3/dist-packages/openstackclient/shell.py", line 23, in <module>
      from osc_lib import shell
    File "/usr/lib/python3/dist-packages/osc_lib/shell.py", line 24, in <module>
      from cliff import app
    File "/usr/lib/python3/dist-packages/cliff/app.py", line 22, in <module>
      import cmd2
    File "/usr/lib/python3/dist-packages/cmd2.py", line 585, in <module>
      _ = pyperclip.paste()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 667, in lazy_load_stub_paste
      copy, paste = determine_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 558, in determine_clipboard
      return init_gi_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 167, in init_gi_clipboard
      gi.require_version('Gtk', '3.0')
    File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
      raise ValueError('Namespace %s not available' % namespace)

  Had to install GTK3 to make openstack commands work but it is taking
  huge time to get a response to the commands. The wait time after
  firing any openstack cli command is around 30 seconds.

  Anybody faced the issue? What is the fix for it if it exists?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cmd2/+bug/1945661/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list