Bug 676338

Summary: system-config-kickstart: RuntimeError: could not open display
Product: Red Hat Enterprise Linux 6 Reporter: Jan Stodola <jstodola>
Component: system-config-kickstartAssignee: Chris Lumens <clumens>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: atodorov, lars
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: system-config-kickstart-2.8.6.4-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 17:01:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 705163    

Description Jan Stodola 2011-02-09 15:11:33 UTC
Description of problem:
system-config-kickstart executed in non-graphical environment throws a
traceback:

[root@rtt6 ~]# system-config-kickstart 
Traceback (most recent call last):
  File "/usr/bin/system-config-kickstart", line 28, in <module>
    from meh.ui.gui import GraphicalIntf
  File "/usr/lib/python2.6/site-packages/meh/ui/gui.py", line 21, in <module>
    import gtk
  File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module>
    _init()
  File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init
    _gtk.init_check()
RuntimeError: could not open display


Version-Release number of selected component (if applicable):
system-config-kickstart-2.8.6.3-1.el6.noarch

How reproducible:
always

Steps to Reproduce:
1. login to a system using ssh -x username@name
2. run system-config-kickstart

Actual results:
traceback when running system-config-kickstart via ssh -x connection

Expected results:
User should see a human readable message, not any traceback, see
system-config-lvm for example:

[root@rtt6 ~]# system-config-lvm 

  Unable to initialize graphical environment. Most likely cause of failure
  is that the tool was not run using a graphical environment. Please either
  start your graphical user interface or set your DISPLAY variable.

  Caught exception: could not open display

Comment 1 RHEL Program Management 2011-02-09 15:28:25 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 2 Chris Lumens 2011-02-15 18:07:56 UTC
If you apply the following patch to /usr/share/system-config-kickstart, I think it'll fix the problem up.

index cd41e6a..f9b511a 100755
--- a/src/system-config-kickstart
+++ b/src/system-config-kickstart
@@ -24,9 +24,8 @@
 import signal
 import sys, os
 
-from meh.dump import *
-from meh.ui.gui import GraphicalIntf
-from meh.handler import *
+from meh.dump import ExceptionDump
+from meh.handler import ExceptionHandler
 
 sys.path.append("/usr/share/system-config-kickstart")
 
@@ -90,7 +89,8 @@ if __name__ == "__main__":
 
     try:
         import kickstartGui
-    except:
+        from meh.ui.gui import GraphicalIntf
+    except RuntimeError:
         print (_("Could not open display because no X server is running."))
         print (_("Try running 'system-config-kickstart --help' for a list of options."))
         sys.exit(0)

Comment 3 Jan Stodola 2011-02-16 13:39:54 UTC
patch applied on /usr/bin/system-config-kickstart:

* it fixes the issue for sessions without X:

[root@dell-per905-01 ~]# system-config-kickstart 
Could not open display because no X server is running.
Try running 'system-config-kickstart --help' for a list of options.

* it breaks sessions with X (tested using X11 forwarding):

[root@dell-per905-01 system-config-kickstart]# system-config-kickstart 
/usr/share/system-config-kickstart/kickstartGui.py:101: GtkWarning: GtkSpinButton: setting an adjustment with non-zero page size is deprecated
  xml = gtk.glade.XML ("system-config-kickstart.glade", domain="system-config-kickstart")
Traceback (most recent call last):
  File "/usr/bin/system-config-kickstart", line 100, in <module>
    config = Config(programName="system-config-kickstart", 
NameError: name 'Config' is not defined

This modification fixes the new problem, both X and non-X works as expected:
-from meh.handler import ExceptionHandler
+from meh.handler import ExceptionHandler, Config

Comment 4 Chris Lumens 2011-02-16 16:36:54 UTC
Ah, good catch.  Thanks.

Comment 6 Chris Lumens 2011-05-16 18:02:39 UTC
*** Bug 705121 has been marked as a duplicate of this bug. ***

Comment 8 Alexander Todorov 2011-08-11 10:29:31 UTC
Tested with system-config-kickstart-2.8.6.4-1.el6.noarch

1) Without X
# system-config-kickstart 
Could not open display because no X server is running.
Try running 'system-config-kickstart --help' for a list of options.

2) With X forwarding (ssh -X) - GUI started successfully

3) With X running locally (Xvnc) - GUI started successfully

Comment 9 errata-xmlrpc 2011-12-06 17:01:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1683.html