From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id DD6FD1FF185 for ; Mon, 4 Aug 2025 12:22:34 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C13081DACC; Mon, 4 Aug 2025 12:24:03 +0200 (CEST) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Mon, 4 Aug 2025 12:23:28 +0200 Message-Id: <20250804102328.201317-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.39.5 MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1754303021240 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.064 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager] pve8to9: check for settings in /etc/sysctl.conf X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" The procps package removed `/etc/sysctl.conf` in version 2:4.0.4-7 [0], as the shipped settings have moved to `linux-sysctl-defaults`[1] and snippet files in /etc/sysctl.d/ have been favored for a while now. Setting them is done by systemd-sysctl.service(8) which only mentions the snippet-directories (/etc/sysctl.d/*.conf). Upon upgrading the settings are not set anymore (but are preserved under /etc/sysctl.conf.dpkg-bak). As `/etc/sysctl.conf` has been around for a long time (and is present in most Unixoid systems), and is the default place where e.g. ansible places settings[2] a warning about lost settings makes sense. [0] https://metadata.ftp-master.debian.org/changelogs//main/p/procps/procps_4.0.4-9_changelog [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1074156 [2] https://docs.ansible.com/ansible/latest/collections/ansible/posix/sysctl_module.html Signed-off-by: Stoiko Ivanov --- this caught me by surprise for a system where I had set `net.ipv6.conf.all.accept_ra=2` in /etc/sysctl.conf PVE/CLI/pve8to9.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/PVE/CLI/pve8to9.pm b/PVE/CLI/pve8to9.pm index 8c26ddbd..112a9f44 100644 --- a/PVE/CLI/pve8to9.pm +++ b/PVE/CLI/pve8to9.pm @@ -2069,6 +2069,33 @@ sub check_legacy_ipam_files { } } +sub check_legacy_sysctl_conf { + my $fn = "/etc/sysctl.conf"; + if (!-f $fn) { + log_pass("Legacy file '$fn' is not present."); + return; + } elsif ($upgraded) { + log_skip("System upgraded '$fn' will not be removed anymore."); + return; + } + my $raw = eval { PVE::Tools::file_get_contents($fn); }; + if ($@) { + log_fail("Failed to read '$fn' - $@"); + return; + } + + my @lines = split(/\n/, $raw); + for my $line (@lines) { + if ($line !~ /^[\s]*(:?$|[#;].*$)/m) { + log_warn( + "Deprecated config '$fn' contains settings - move them to a dedicated file in '/etc/sysctl.d/'." + ); + return; + } + } + log_pass("No settings in '$fn'"); +} + sub check_misc { print_header("MISCELLANEOUS CHECKS"); my $ssh_config = eval { PVE::Tools::file_get_contents('/root/.ssh/config') }; @@ -2164,6 +2191,7 @@ sub check_misc { check_lvm_autoactivation(); check_rrd_migration(); check_legacy_ipam_files(); + check_legacy_sysctl_conf(); } my sub colored_if { -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel