---
src/inspect-fs-unix.c | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 0fea9c8..b2c5ce1 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -455,6 +455,7 @@ guestfs_int_check_linux_root (guestfs_h *g, struct inspect_fs *fs)
{
int r;
char *major, *minor;
+ size_t i;
fs->type = OS_TYPE_LINUX;
@@ -768,9 +769,6 @@ guestfs_int_check_linux_root (guestfs_h *g, struct inspect_fs *fs)
skip_release_checks:;
- /* Determine the architecture. */
- check_architecture (g, fs);
-
/* We already know /etc/fstab exists because it's part of the test
* for Linux root above. We must now parse this file to determine
* which filesystems are used by the operating system and how they
@@ -780,6 +778,27 @@ guestfs_int_check_linux_root (guestfs_h *g, struct inspect_fs *fs)
if (inspect_with_augeas (g, fs, configfiles, check_fstab) == -1)
return -1;
+ /* Some sysadmins like to mount /usr separately. Unfortunately if
+ * this has been done and the distro uses UsrMove or equivalent,
+ * then there will no arch-specific binaries on the root filesystem
+ * and so check_architecture will fail (RHBZ#1401474). See if there
+ * is a separate /usr (found by check_fstab above) and mount it.
+ * This filesystem will be unmounted by guestfs_umount_all in the
+ * caller.
+ */
+ for (i = 0; i < fs->nr_fstab; ++i) {
+ const char *mp = fs->fstab[i].mountpoint;
+
+ if (STREQ (mp, "/usr")) {
+ guestfs_push_error_handler (g, NULL, NULL);
+ guestfs_mount_ro (g, fs->fstab[i].mountable, mp);
+ guestfs_pop_error_handler (g);
+ }
+ }
+
+ /* Determine the architecture. */
+ check_architecture (g, fs);
+
/* Determine hostname. */
if (check_hostname_unix (g, fs) == -1)
return -1;
--
2.9.3