Index: /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh
===================================================================
--- /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh	(revision 50732)
+++ /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh	(revision 50733)
@@ -39,15 +39,17 @@
   i[3456789]86|x86)
     cpu="x86"
-    LIB="/usr/lib"
+    lib_candidates="/usr/lib/i386-linux-gnu /usr/lib /lib"
     ;;
   x86_64|amd64)
     cpu="amd64"
-    if test -d "/usr/lib64"; then
-      LIB="/usr/lib64"
-    else
-      LIB="/usr/lib"
-    fi
+    lib_candidates="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib64 /lib"
     ;;
 esac
+for i in $lib_candidates; do
+  if test -d "$i/VBoxGuestAdditions"; then
+    LIB=$i
+    break
+  fi
+done
 
 # Find the version of X installed
Index: /trunk/src/VBox/Installer/linux/run-inst.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/run-inst.sh	(revision 50732)
+++ /trunk/src/VBox/Installer/linux/run-inst.sh	(revision 50733)
@@ -163,5 +163,6 @@
         rm -f "$i-"* 2> /dev/null
     done
-    rm -f "/usr/lib/$PACKAGE" "/usr/lib64/$PACKAGE" "/usr/share/$PACKAGE"
+    rm -f "/usr/lib/$PACKAGE" "/usr/lib64/$PACKAGE" "/usr/share/$PACKAGE" \
+        "/usr/lib/i386-linux-gnu/$PACKAGE" "/usr/lib/x86_64-linux-gnu/$PACKAGE"
 
     # And any packages left under /opt
@@ -181,13 +182,9 @@
   i[3456789]86|x86)
     cpu="x86"
-    lib_path="/usr/lib"
+    lib_candidates="/usr/lib/i386-linux-gnu /usr/lib /lib"
     ;;
   x86_64|amd64)
     cpu="amd64"
-    if test -d "/usr/lib64"; then
-      lib_path="/usr/lib64"
-    else
-      lib_path="/usr/lib"
-    fi
+    lib_candidates="/usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib /lib64 /lib"
     ;;
   *)
@@ -197,4 +194,18 @@
 if [ ! -r "$ARCH_PACKAGE" ]; then
   info "Detected unsupported $cpu machine type."
+  exit 1
+fi
+# Find the most appropriate libary folder by seeing which of the candidate paths
+# are actually in the shared linker path list and choosing the first.  We look
+# for Debian-specific paths first, then LSB ones, then the new RedHat ones.
+libs=`ldconfig -v 2>/dev/null | grep -v ^$'\t'`
+for i in $lib_candidates; do
+  if echo $libs | grep -q $i; then
+    lib_path=$i
+    break
+  fi
+done
+if [ ! -x "$lib_path" ]; then
+  info "Unable to determine correct library path."
   exit 1
 fi
