all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] pve8to9: check for settings in /etc/sysctl.conf
@ 2025-08-04 10:23 Stoiko Ivanov
  2025-08-04 12:01 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2025-08-04 10:23 UTC (permalink / raw)
  To: 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 <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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH manager] pve8to9: check for settings in /etc/sysctl.conf
  2025-08-04 10:23 [pve-devel] [PATCH manager] pve8to9: check for settings in /etc/sysctl.conf Stoiko Ivanov
@ 2025-08-04 12:01 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-08-04 12:01 UTC (permalink / raw)
  To: pve-devel, Stoiko Ivanov

On Mon, 04 Aug 2025 12:23:28 +0200, Stoiko Ivanov wrote:
> 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).
> 
> [...]

Applied, thanks!

[1/1] pve8to9: check for settings in /etc/sysctl.conf
      commit: 2b699991acaffbae1375e528b09ad15e2e370238


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-04 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-04 10:23 [pve-devel] [PATCH manager] pve8to9: check for settings in /etc/sysctl.conf Stoiko Ivanov
2025-08-04 12:01 ` [pve-devel] applied: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal