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 <[email protected]>
---
 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



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to