]> git.proxmox.com Git - pve-container.git/commitdiff
setup: heuristically warn if the FS hosting /etc is not mounted
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 9 Sep 2020 18:02:25 +0000 (20:02 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 9 Sep 2020 18:54:57 +0000 (20:54 +0200)
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@proxmox.com>
src/PVE/LXC/Setup.pm

index fb0be37dee3593fe241aef6d3d4d7b5be8ae2ddb..8b8fee99417fc57745f1ac842bc7019549be960e 100644 (file)
@@ -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') {