[PATCH v2 rhel7-branch] Fix hang at reboot with VNC installs (#1036572)

Will Woods wwoods at redhat.com
Tue Sep 9 14:43:43 UTC 2014

If the X server goes away, anaconda (like other X clients) will get an X
IO error; by default this is handled (in libX11) by doing an exit(1).
(It's also possible that the dbus server dies before us, and then we get
a dbus error; the default handler for that (in libdbus) is... exit(1).)
Either way: calling vnc.shutdownServer() can make anaconda exit early.

Obviously, if that happens before we've initiated reboot, the system
won't reboot. So: don't do that until after initiating reboot!

(In fact, we probably don't *need* to shut down VNC when we're doing
reboot/halt/etc, since the shutdown process will kill the server for
us.. but for other use-cases we should still clean up after ourselves.)
 anaconda | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/anaconda b/anaconda
index ae88954..419466b 100755
--- a/anaconda
+++ b/anaconda
@@ -54,9 +54,6 @@ def exitHandler(rebootData, storage, exitCode=None):
         if os.path.isdir('/mnt/sysimage/root'):
-    if flags.usevnc:
-        vnc.shutdownServer()
     if exitCode:
@@ -94,6 +91,12 @@ def exitHandler(rebootData, storage, exitCode=None):
         else: # reboot action is KS_REBOOT or None
             subprocess.Popen(["systemctl", "--no-wall", "reboot"])
+    # Shutting down the server may make anaconda terminate early, via the
+    # default X11 io error handler or the libdbus error handler.
+    # So save this for last, after we've initiated poweroff/halt/reboot.
+    if flags.usevnc:
+        vnc.shutdownServer()
 def startMetacityWM():
     childpid = os.fork()
     if not childpid:

More information about the anaconda-patches mailing list