From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 0328E90E4E for ; Fri, 31 Mar 2023 13:27:56 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D718E2746B for ; Fri, 31 Mar 2023 13:27:55 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 31 Mar 2023 13:27:53 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 506A6431FA for ; Fri, 31 Mar 2023 13:27:53 +0200 (CEST) From: Stoiko Ivanov To: pmg-devel@lists.proxmox.com Date: Fri, 31 Mar 2023 13:27:47 +0200 Message-Id: <20230331112747.26973-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH pmg-api] d/maintscripts: prevent aborting on errors in some commands X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Mar 2023 11:27:56 -0000 in case something goes wrong it is often better to not leave the packaging state broken. failure in the commands masked by this patch are either transient (pmgconfig sync -restart 1 failing when services are masked), or will be noticed quite instantly (failed database or config initialization upon first install) the deb-systemd-invoke change was based on a quick grep in /var/lib/dpkg/info on my system I quickly considered masking even more errors (e.g. related to the ucf handling) - but they don't seem to cause issues (in the past 3 years) - and if something breaks there it is probably worth to get a report reported in our community forum: https://forum.proxmox.com/threads/.125088/ Signed-off-by: Stoiko Ivanov --- This patch should fix the issue - I considered the suggestions discussed off-list with making the reload command not fail when the config-rewrite issues it - but doing so in general feels wrong. Ignoring a failure if a service is masked did not seem robust - e.g. masking 'postfix.service' does not result in 'postfix@-' being masked as well, and still a reload of 'postfix@-' service fails (and explicitly listing this one edge-case felt a bit brittle) Finally not erroring out in `pmgconfig sync -restart 1` felt off as it's the direct entry point for the user - and masking an error should be the caller's responsibility Reproduced the issue from the forum with a 7.2 installation and masking all services as in the upgrade guide[0] before upgrading and with this patch the upgrade does not result in a broken dpkg state anymore [0] https://pmg.proxmox.com/wiki/index.php/Upgrade_from_6.x_to_7.0 debian/postinst | 6 +++--- debian/prerm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/postinst b/debian/postinst index 690d10d..d4d434a 100644 --- a/debian/postinst +++ b/debian/postinst @@ -89,11 +89,11 @@ case "$1" in if test ! -e /proxmox_install_mode ; then - pmgconfig init - pmgdb init + pmgconfig init || true + pmgdb init || true ucf_register_templates - pmgconfig sync --restart + pmgconfig sync --restart || true if [ -z "$2" ]; then if systemctl --quiet is-active pmgpolicy.service ; then diff --git a/debian/prerm b/debian/prerm index 4d0ca06..f9b6f3a 100644 --- a/debian/prerm +++ b/debian/prerm @@ -19,7 +19,7 @@ case "$1" in esac if [ -d /run/systemd/system ] && [ "$1" = remove ]; then - deb-systemd-invoke stop pmgproxy.service pmgdaemon.service >/dev/null + deb-systemd-invoke stop pmgproxy.service pmgdaemon.service >/dev/null || true fi # dh_installdeb will replace this with shell code automatically -- 2.30.2