From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] pve8to9: check for settings in /etc/sysctl.conf
Date: Mon, 4 Aug 2025 12:23:28 +0200 [thread overview]
Message-ID: <20250804102328.201317-1-s.ivanov@proxmox.com> (raw)
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 <s.ivanov@proxmox.com>
---
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
next reply other threads:[~2025-08-04 10:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-04 10:23 Stoiko Ivanov [this message]
2025-08-04 12:01 ` [pve-devel] applied: " Thomas Lamprecht
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=20250804102328.201317-1-s.ivanov@proxmox.com \
--to=s.ivanov@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