diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
index fd3c201..2ebda5d 100644
--- a/mythtv/programs/mythfrontend/main.cpp
+++ b/mythtv/programs/mythfrontend/main.cpp
@@ -1629,6 +1629,21 @@ static bool WasAutomaticStart(void)
     return autoStart;
 }
 
+// from https://www.raspberrypi.org/forums/viewtopic.php?f=33&t=16897
+// The old way of revoking root with setuid(getuid()) 
+// causes system hang in certain cases on raspberry pi
+
+static int revokeRoot (void)
+{
+  if (getuid () == 0 && geteuid () == 0)      // Really running as root
+    return 0;
+
+  if (geteuid () == 0)                  // Running setuid root
+     return seteuid (getuid ()) ;               // Change effective uid to the uid of the caller
+  return 0;
+}
+
+
 int main(int argc, char **argv)
 {
     bool bPromptForBackend    = false;
@@ -1790,16 +1805,9 @@ int main(int argc, char **argv)
     qApp->setSetuidAllowed(true);
 #endif
 
-#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
-    // If Qt graphics platform is egl (Raspberry Pi) then setuid hangs
-    LOG(VB_GENERAL, LOG_NOTICE, "QT_QPA_PLATFORM=" + qApp->platformName());
-    if (qApp->platformName().contains("egl"))
-      ;
-    else
-#endif
-    if (setuid(getuid()) != 0)
+    if (revokeRoot() != 0)
     {
-        LOG(VB_GENERAL, LOG_ERR, "Failed to setuid(), exiting.");
+        LOG(VB_GENERAL, LOG_ERR, "Failed to revokeRoot(), exiting.");
         return GENERIC_EXIT_NOT_OK;
     }
 
