From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] applied: [PATCH container 5/5] setup: heuristically warn if the FS hosting /etc is not mounted
Date: Wed, 9 Sep 2020 21:12:23 +0200 [thread overview]
Message-ID: <20200909191223.4187564-5-t.lamprecht@proxmox.com> (raw)
In-Reply-To: <20200909191223.4187564-1-t.lamprecht@proxmox.com>
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 | 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
prev parent reply other threads:[~2020-09-09 19:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-09 19:12 [pve-devel] applied: [PATCH container 1/5] ct start: track lxc-start stderr and print in error case Thomas Lamprecht
2020-09-09 19:12 ` [pve-devel] applied: [PATCH container 2/5] implement debug start Thomas Lamprecht
2020-09-09 19:12 ` [pve-devel] applied: [PATCH container 3/5] protected_call: remove left-over rootdir/dev mkdir Thomas Lamprecht
2020-09-09 19:12 ` [pve-devel] applied: [PATCH container 4/5] alpine: setup net: pass whole config to parent method Thomas Lamprecht
2020-09-09 19:12 ` Thomas Lamprecht [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200909191223.4187564-5-t.lamprecht@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox