Repository navigation
Merge GRUB cmdline instead of overwriting it (closes #19) - #30
Merged
Merged
Conversation
tune_kernel replaced GRUB_CMDLINE_LINUX_DEFAULT wholesale, dropping any other kernel parameters the user/distro had set (a boot-safety risk). Add a pure grub_merge_cmdline helper that preserves every existing param and replaces only the HugePage/MSR params we manage (hugepagesz/hugepages/default_hugepagesz/ msr.allow_writes), and use it in tune_kernel. Idempotent: re-runs strip the old managed params and re-add the current ones, so a stable config detects "already configured" and makes no change. Tests: unit tests for grub_merge_cmdline (preserve/replace/idempotent) and an E2E assertion that "quiet splash" survives the HugePage configuration. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (#19 — boot-safety)
tune_kernelconfigured persistent HugePages by replacing the whole line:sed -i 's|^GRUB_CMDLINE_LINUX_DEFAULT=.*|GRUB_CMDLINE_LINUX_DEFAULT="$NEW_PARAMS"|'$NEW_PARAMSisproposed-grub.sh's full string (quiet splash <hugepages/msr params>), so any other kernel parameters the user or distro had set were silently dropped — e.g.nomodeset,intel_iommu=on,amd_iommu=on,console=, root-fs flags. On the wrong box that's a failed/headless boot.Fix
A pure, testable
grub_merge_cmdlinehelper merges in only the params we own and preserves everything else:hugepagesz=*,hugepages=*,default_hugepagesz=*,msr.allow_writes=*).bak)tune_kernelnow reads the current cmdline, computes the merge, and only rewrites when it actually changes (still backing up to.bakfirst).Tests
grub_merge_cmdlinepreservesquiet/customnomodeset, adds the HugePage/MSR params, is idempotent, and replaces (not accumulates) stale managed params.quiet splashis still present in/etc/default/grubafter HugePage configuration (native Linux + Docker).No Pithead/XMRig surface (host-local boot config).
make testgreen; closes #19.🤖 Generated with Claude Code