Index: /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh
===================================================================
--- /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh	(revision 75427)
+++ /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh	(revision 75428)
@@ -149,4 +149,27 @@
     stop && start
     return 0
+}
+
+setup_opengl()
+{
+    # Install the guest OpenGL drivers.  For now we don't support
+    # multi-architecture installations
+    rm -f /etc/ld.so.conf.d/00vboxvideo.conf
+    rm -Rf /var/lib/VBoxGuestAdditions/lib
+    if /usr/bin/VBoxClient --check3d 2>/dev/null; then
+        mkdir -p /var/lib/VBoxGuestAdditions/lib
+        ln -sf "${INSTALL_DIR}/lib/VBoxOGL.so" /var/lib/VBoxGuestAdditions/lib/libGL.so.1
+        # SELinux for the OpenGL libraries, so that gdm can load them during the
+        # acceleration support check.  This prevents an "Oh no, something has gone
+        # wrong!" error when starting EL7 guests.
+        if test -e /etc/selinux/config; then
+            if command -v semanage > /dev/null; then
+                semanage fcontext -a -t lib_t "/var/lib/VBoxGuestAdditions/lib/libGL.so.1"
+            fi
+            chcon -h  -t lib_t "/var/lib/VBoxGuestAdditions/lib/libGL.so.1"
+        fi
+        echo "/var/lib/VBoxGuestAdditions/lib" > /etc/ld.so.conf.d/00vboxvideo.conf
+    fi
+    ldconfig
 }
 
@@ -456,4 +479,7 @@
         fail "Failed to set up VBoxClient to start automatically."
     ln -s "${lib_dir}/98vboxadd-xclient" /usr/bin/VBoxClient-all 2>/dev/null
+    case "${x_version}" in 4.* | 6.* | 7.* | 1.?.* | 1.1* )
+        setup_opengl
+    esac 
 }
 
Index: /trunk/src/VBox/Additions/linux/installer/vboxadd.sh
===================================================================
--- /trunk/src/VBox/Additions/linux/installer/vboxadd.sh	(revision 75427)
+++ /trunk/src/VBox/Additions/linux/installer/vboxadd.sh	(revision 75428)
@@ -263,39 +263,7 @@
 
     # Put the X.Org driver in place.  This is harmless if it is not needed.
+    # Also set up the OpenGL library.
     myerr=`"${INSTALL_DIR}/init/vboxadd-x11" setup 2>&1`
     test -z "${myerr}" || log "${myerr}"
-    # Install the guest OpenGL drivers.  For now we don't support
-    # multi-architecture installations
-    rm -f /etc/ld.so.conf.d/00vboxvideo.conf
-    rm -Rf /var/lib/VBoxGuestAdditions/lib
-    if /usr/bin/VBoxClient --check3d 2>/dev/null; then
-        setup_gl=true;
-    else
-        unset setup_gl
-    fi
-    # Disable 3D if Xwayland is found, except on Ubuntu 18.04.
-    if type Xwayland >/dev/null 2>&1; then
-        unset PRETTY_NAME
-        . /etc/os-release 2>/dev/null
-        case "${PRETTY_NAME}" in
-            "Ubuntu 18.04"*) ;;
-            *) unset setup_gl ;;
-        esac
-    fi
-    if test -n "${setup_gl}"; then
-        mkdir -p /var/lib/VBoxGuestAdditions/lib
-        ln -sf "${INSTALL_DIR}/lib/VBoxOGL.so" /var/lib/VBoxGuestAdditions/lib/libGL.so.1
-        # SELinux for the OpenGL libraries, so that gdm can load them during the
-        # acceleration support check.  This prevents an "Oh no, something has gone
-        # wrong!" error when starting EL7 guests.
-        if test -e /etc/selinux/config; then
-            if command -v semanage > /dev/null; then
-                semanage fcontext -a -t lib_t "/var/lib/VBoxGuestAdditions/lib/libGL.so.1"
-            fi
-            chcon -h  -t lib_t "/var/lib/VBoxGuestAdditions/lib/libGL.so.1"
-        fi
-        echo "/var/lib/VBoxGuestAdditions/lib" > /etc/ld.so.conf.d/00vboxvideo.conf
-    fi
-    ldconfig
 
     # Mount all shared folders from /etc/fstab. Normally this is done by some
