[pve-devel] applied: [PATCH container 5/5] setup: heuristically warn if the FS hosting /etc is not mounted

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 9 21:12:23 CEST 2020


Check for the existence of /etc, use -e as it could also be a symlink
(and it's just a heuristic). But only do so if the expected ostype
from the config does not match the detected one, this normally
indicates that we had a "reals" distro running but detected the
fallback "unmanaged". Only warn though, as a hint for the user.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/LXC/Setup.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Setup.pm b/src/PVE/LXC/Setup.pm
index fb0be37..8b8fee9 100644
--- a/src/PVE/LXC/Setup.pm
+++ b/src/PVE/LXC/Setup.pm
@@ -96,8 +96,11 @@ sub new {
 	$type = &$autodetect_type($self, $rootdir, $os_release);
 	my $expected_type = $conf->{ostype} || $type;
 
-	warn "got unexpected ostype ($type != $expected_type)\n"
-	    if $type ne $expected_type;
+	if ($type ne $expected_type) {
+	    warn "WARNING: /etc not present in CT, is the rootfs mounted?\n"
+		if ! -e "$rootdir/etc";
+	    warn "got unexpected ostype ($type != $expected_type)\n"
+	}
     }
 
     if ($type eq 'unmanaged') {
-- 
2.20.1






More information about the pve-devel mailing list