Skip to content

use sysctl.d instead of /etc/sysctl.conf - #2857

Merged
enoch85 merged 2 commits into
mainfrom
fix/sysctl-d
Sep 26, 2026
Merged

enoch85 merged 2 commits into
mainfrom
fix/sysctl-d

Conversation

@enoch85

@enoch85 enoch85 commented Sep 26, 2026

Copy link
Copy Markdown
Member

On Ubuntu 26.04 the kernel settings the scripts save to /etc/sysctl.conf are never applied at boot:

  • vm.overcommit_memory = 1 for Redis, on every new VM
  • vm.max_map_count for Elasticsearch (Full Text Search)
  • fs.inotify.max_user_watches for files_inotify (SMB mount, SMB server)

Root cause: 24.04 ships /etc/sysctl.conf and the /etc/sysctl.d/99-sysctl.conf -> ../sysctl.conf link. 26.04 ships neither, and systemd-sysctl only reads sysctl.d. The scripts create /etc/sysctl.conf, but nothing reads it.

Fix:

  • Write each setting to its own /etc/sysctl.d/90-*.conf, which every Ubuntu release reads, and apply it right away.
  • The updater restores the 99-sysctl.conf link when /etc/sysctl.conf exists without it, so settings older scripts (or admins) put there apply again.

Existing installs: fixed by the next update. 24.04 VMs already have the link, so nothing changes there.

Verified on an Ubuntu 26.04 test container (fresh install of this branch):

  • /etc/sysctl.conf is no longer created, and systemd-analyze cat-config sysctl.d shows /etc/sysctl.d/90-redis.conf with vm.overcommit_memory = 1, also after a reboot.
  • With the old /etc/sysctl.conf line and no link, update.sh minor created /etc/sysctl.d/99-sysctl.conf -> ../sysctl.conf.
  • The Full Text Search and SMB changes are only checked with shellcheck, not run.

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Assisted-by: ClaudeCode:claude-opus-5-5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
HASH appears unused. Verify use (or export if used externally). SC2034

local HASH

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
SELECTED_GROUPS appears unused. Verify use (or export if used externally). SC2034

local SELECTED_GROUPS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
NC_GROUPS appears unused. Verify use (or export if used externally). SC2034

local NC_GROUPS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
GROUP appears unused. Verify use (or export if used externally). SC2034

local GROUP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
NEWNAME_BACKUP appears unused. Verify use (or export if used externally). SC2034

local NEWNAME_BACKUP

Ubuntu 26.04 ships neither /etc/sysctl.conf nor the
/etc/sysctl.d/99-sysctl.conf -> ../sysctl.conf link that 24.04 has, and
systemd-sysctl only reads sysctl.d at boot. The settings the scripts
append to /etc/sysctl.conf (vm.overcommit_memory for Redis,
vm.max_map_count for Elasticsearch, fs.inotify.max_user_watches for
files_inotify) are therefore lost at the first reboot on 26.04.

Write each setting to its own file in /etc/sysctl.d instead, which every
Ubuntu release reads. On existing VMs where a script created
/etc/sysctl.conf, the updater restores the 99-sysctl.conf link so that
those settings (and any added by hand) apply again.
@enoch85
enoch85 merged commit 80bfaef into main Sep 26, 2026
9 of 10 checks passed
@enoch85
enoch85 deleted the fix/sysctl-d branch September 26, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant