Skip to content

fix(Boot Settings): Syslinux gui mode fix #2631

Merged
limetech merged 9 commits into
unraid:masterfrom
SimonFair:Syslinux-gui-mode-fix-
May 11, 2026
Merged

fix(Boot Settings): Syslinux gui mode fix #2631
limetech merged 9 commits into
unraid:masterfrom
SimonFair:Syslinux-gui-mode-fix-

Conversation

@SimonFair
Copy link
Copy Markdown
Contributor

@SimonFair SimonFair commented May 6, 2026

When changing from Unraid OS to gui mode the bzroot-gui entry on initrd is being removed. This PR is to fix this so the entry is retained.

Summary by CodeRabbit

  • New Features

    • Boot parameter preview now uses GUI-aware initrd values and auto-refreshes when the selected default boot entry changes.
    • System information page now displays chassis details when available.
  • Improvements

    • More reliable per-entry boot-parameter previews and updates to avoid duplicate or incorrect entries.
    • Robust handling of line endings and more tolerant parsing for cross-environment consistency.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Frontend preview and backend write flows were updated to generate and render GUI-aware initrd values (initrd=/bzroot,/bzroot-gui) per-entry and for the preview when applicable; syslinux/grub write logic now normalizes CRLF, uses replace-once append updates, and default insertion was simplified. System information now optionally shows chassis serial number.

Changes

Boot Parameters GUI-Safe Enhancement

Layer / File(s) Summary
Script: normalize & parse
emhttp/plugins/dynamix/scripts/manage_boot_params.sh
Normalization helper added; parse_append_line() made tolerant of CR/whitespace/line endings; temp syslinux file CR stripped before processing.
Script: default insertion
emhttp/plugins/dynamix/scripts/manage_boot_params.sh
menu default insertion simplified to place the directive immediately after the matching label line.
Script: GUI-safe builders
emhttp/plugins/dynamix/scripts/manage_boot_params.sh
build_append_line_gui_safe() starts with initrd=/bzroot,/bzroot-gui; build_kernel_args_gui_safe() strips that combined prefix for GRUB args.
Script: syslinux write & replace-once
emhttp/plugins/dynamix/scripts/manage_boot_params.sh
Introduced update_syslinux_label_append() to rewrite append lines per label with a replace-once guard; GUI append derived by rewriting initrd=/bzroot when applicable; final files normalized back to CRLF.
UI: preview & default handling
emhttp/plugins/dynamix/BootParameters.page
Added normalizeDisplayLineForComparison(), getSyslinuxInitrdForEntryLabel(label), getPreviewSyslinuxInitrd(), and updateDefaultEntryDisplay(); preview and per-entry diffs render GUI-aware initrd and resync on default selection changes.

System Information Chassis Display

Layer / File(s) Summary
Chassis retrieval & rendering
emhttp/plugins/dynamix/scripts/system_information
dmidecode chassis info read; chassis serial formatted with translated label; conditional "Chassis" table row shown when serial contains numeric content.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant UI as BootParameters.page
  participant Script as manage_boot_params.sh
  participant Loader as Syslinux/GRUB
  User->>UI: toggle APPLY / change default
  UI->>UI: compute per-entry initrd / updatePreview()
  UI->>Script: trigger write with new append/kernel args
  Script->>Loader: write guarded append lines, normalize CRLF
  Loader->>Script: validation result
  Script->>Loader: install final config
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

A rabbit peeks at boot-time skies,
It swaps initrds where the GUI lies,
Strips stray returns and trims each line,
Adds chassis tags to make things fine,
Hops off joyful when configs align. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(Boot Settings): Syslinux gui mode fix' directly addresses the main issue: retaining bzroot-gui in initrd when switching to GUI mode, which aligns with the PR's primary objective.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

🔧 PR Test Plugin Available

A test plugin has been generated for this PR that includes the modified files.

Version: 2026.05.07.1058
Build: View Workflow Run

📥 Installation Instructions:

Install via Unraid Web UI:

  1. Go to Plugins → Install Plugin
  2. Copy and paste this URL:
https://preview.dl.unraid.net/pr-plugins/pr-2631/webgui-pr-2631.plg
  1. Click Install

Alternative: Direct Download

⚠️ Important Notes:

  • Testing only: This plugin is for testing PR changes
  • Backup included: Original files are automatically backed up
  • Easy removal: Files are restored when plugin is removed
  • Conflicts: Remove this plugin before installing production updates
  • Post-merge behavior: This preview stays available after merge until preview storage expires or it is manually cleaned up

📝 Modified Files:

Click to expand file list
emhttp/plugins/dynamix/BootParameters.page
emhttp/plugins/dynamix/scripts/manage_boot_params.sh
emhttp/plugins/dynamix/scripts/system_information

🔄 To Remove:

Navigate to Plugins → Installed Plugins and remove webgui-pr-2631, or run:

plugin remove webgui-pr-2631

🤖 This comment is automatically generated and will be updated with each new push to this PR.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
emhttp/plugins/dynamix/scripts/manage_boot_params.sh (1)

945-952: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

GUI Safe Mode still falls back to non-GUI initrd in one branch.

At Line 951, gui_safe_append is built from new_append unchanged, so it keeps initrd=/bzroot instead of initrd=/bzroot,/bzroot-gui when EXCLUDE_FRAMEBUFFER_FROM_GUI != 1. That breaks GUI Safe Mode semantics.

Suggested fix
     if [[ "${EXCLUDE_FRAMEBUFFER_FROM_GUI}" == "1" ]]; then
         local gui_safe_append="  append $(build_append_line_gui_safe)"
     else
-        local gui_safe_append="  append $new_append"
+        local gui_safe_append="  append $(echo "$new_append" | sed 's/^initrd=\/bzroot\([ ]\|$\)/initrd=\/bzroot,\/bzroot-gui\1/')"
     fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh` around lines 945 - 952,
The GUI safe-mode branch incorrectly uses the plain new_append which leaves
initrd=/bzroot instead of the GUI-safe initrd; change the else branch so
gui_safe_append is built from the GUI-safe builder (use
build_append_line_gui_safe) or otherwise ensure new_append is transformed to
include the GUI initrd (initrd=/bzroot,/bzroot-gui); update the code that sets
gui_safe_append (the variable and the else branch around APPLY_TO_GUI_SAFE_MODE
/ EXCLUDE_FRAMEBUFFER_FROM_GUI) to call build_append_line_gui_safe instead of
using new_append so GUI Safe Mode gets the correct initrd.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh`:
- Around line 945-952: The GUI safe-mode branch incorrectly uses the plain
new_append which leaves initrd=/bzroot instead of the GUI-safe initrd; change
the else branch so gui_safe_append is built from the GUI-safe builder (use
build_append_line_gui_safe) or otherwise ensure new_append is transformed to
include the GUI initrd (initrd=/bzroot,/bzroot-gui); update the code that sets
gui_safe_append (the variable and the else branch around APPLY_TO_GUI_SAFE_MODE
/ EXCLUDE_FRAMEBUFFER_FROM_GUI) to call build_append_line_gui_safe instead of
using new_append so GUI Safe Mode gets the correct initrd.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7fb76cb5-9849-4030-9df8-c3495fa475ec

📥 Commits

Reviewing files that changed from the base of the PR and between c72475e and 0fbd45a.

📒 Files selected for processing (3)
  • emhttp/plugins/dynamix/BootParameters.page
  • emhttp/plugins/dynamix/scripts/manage_boot_params.sh
  • emhttp/plugins/dynamix/scripts/system_information

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
emhttp/plugins/dynamix/scripts/manage_boot_params.sh (1)

959-989: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

GUI Safe Mode missing /bzroot-gui when framebuffer exclusion is disabled.

When EXCLUDE_FRAMEBUFFER_FROM_GUI is 0 (the else branch at line 966), gui_safe_append uses $new_append directly, which has initrd=/bzroot without /bzroot-gui. This differs from the "GUI Mode" handling (line 910) which applies a sed transformation to add /bzroot-gui.

For consistency, "GUI Safe Mode" should also include /bzroot-gui since it's a GUI-enabled mode.

Proposed fix
     # Update "Unraid OS GUI Safe Mode" label if enabled in UI
     if [[ "${APPLY_TO_GUI_SAFE_MODE}" == "1" ]]; then

         # Optionally exclude framebuffer parameters for GUI mode entries
         if [[ "${EXCLUDE_FRAMEBUFFER_FROM_GUI}" == "1" ]]; then
             local gui_safe_append="  append $(build_append_line_gui_safe)"
         else
-            local gui_safe_append="  append $new_append"
+            local gui_safe_append="  append $(echo "$new_append" | sed 's/^initrd=\/bzroot\([ ]\|$\)/initrd=\/bzroot,\/bzroot-gui\1/')"
         fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh` around lines 959 - 989,
The GUI Safe Mode branch currently sets gui_safe_append="  append $new_append"
which leaves initrd=/bzroot instead of the GUI initrd; change the else branch so
gui_safe_append uses the same GUI transformation as the regular GUI Mode (i.e.,
produce an append line where initrd=/bzroot is replaced with initrd=/bzroot-gui
or call build_append_line_gui_safe) so the awk replacement writes the GUI initrd
for "Unraid OS GUI Safe Mode"; update the else branch that assigns
gui_safe_append to perform that substitution rather than using $new_append
unchanged.
🧹 Nitpick comments (1)
emhttp/plugins/dynamix/scripts/manage_boot_params.sh (1)

747-749: 💤 Low value

Remove useless echo.

The echo "$(cmd)" pattern is redundant. The command output can be used directly via command substitution.

Proposed fix
 build_kernel_args_gui_safe() {
-    echo "$(build_append_line_gui_safe | sed 's/^initrd=\/bzroot,\/bzroot-gui[ ]*//')"
+    build_append_line_gui_safe | sed 's/^initrd=\/bzroot,\/bzroot-gui[ ]*//'
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh` around lines 747 - 749,
In build_kernel_args_gui_safe, remove the redundant echo and
command-substitution wrapper around build_append_line_gui_safe; instead have the
function directly pipe build_append_line_gui_safe's output into sed to strip the
initrd prefix (the sed expression 's/^initrd=\/bzroot,\/bzroot-gui[ ]*//'), so
replace the echo "$(build_append_line_gui_safe | sed ...)" form with a direct
pipeline using build_append_line_gui_safe | sed ... to emit the cleaned kernel
args.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh`:
- Around line 959-989: The GUI Safe Mode branch currently sets gui_safe_append="
append $new_append" which leaves initrd=/bzroot instead of the GUI initrd;
change the else branch so gui_safe_append uses the same GUI transformation as
the regular GUI Mode (i.e., produce an append line where initrd=/bzroot is
replaced with initrd=/bzroot-gui or call build_append_line_gui_safe) so the awk
replacement writes the GUI initrd for "Unraid OS GUI Safe Mode"; update the else
branch that assigns gui_safe_append to perform that substitution rather than
using $new_append unchanged.

---

Nitpick comments:
In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh`:
- Around line 747-749: In build_kernel_args_gui_safe, remove the redundant echo
and command-substitution wrapper around build_append_line_gui_safe; instead have
the function directly pipe build_append_line_gui_safe's output into sed to strip
the initrd prefix (the sed expression 's/^initrd=\/bzroot,\/bzroot-gui[ ]*//'),
so replace the echo "$(build_append_line_gui_safe | sed ...)" form with a direct
pipeline using build_append_line_gui_safe | sed ... to emit the cleaned kernel
args.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 48e58db9-72fb-4907-a5ec-e4c87abbaea3

📥 Commits

Reviewing files that changed from the base of the PR and between 0fbd45a and 988c7a2.

📒 Files selected for processing (2)
  • emhttp/plugins/dynamix/BootParameters.page
  • emhttp/plugins/dynamix/scripts/manage_boot_params.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/BootParameters.page

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
emhttp/plugins/dynamix/scripts/manage_boot_params.sh (1)

955-962: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

GUI Safe Mode still rewrites to the non-GUI initrd.

When EXCLUDE_FRAMEBUFFER_FROM_GUI=0, this branch reuses $new_append, which still starts with initrd=/bzroot. Any save through this path will drop /bzroot-gui from the Unraid OS GUI Safe Mode entry, so one GUI boot target still regresses.

Suggested fix
         if [[ "${EXCLUDE_FRAMEBUFFER_FROM_GUI}" == "1" ]]; then
             local gui_safe_append="  append $(build_append_line_gui_safe)"
         else
-            local gui_safe_append="  append $new_append"
+            local gui_safe_append="  append $(echo "$new_append" | sed 's/^initrd=\/bzroot\([ ]\|$\)/initrd=\/bzroot,\/bzroot-gui\1/')"
         fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh` around lines 955 - 962,
The GUI Safe Mode branch currently reuses new_append (which contains
initrd=/bzroot) when EXCLUDE_FRAMEBUFFER_FROM_GUI==0, causing the GUI entry to
lose /bzroot-gui; change the assignment that sets gui_safe_append so it
generates an append line that preserves the GUI initrd—either call
build_append_line_gui_safe to produce the full append string instead of reusing
new_append or explicitly replace the initrd token in new_append with
initrd=/bzroot-gui before assigning gui_safe_append (update the code around
APPLY_TO_GUI_SAFE_MODE, EXCLUDE_FRAMEBUFFER_FROM_GUI, gui_safe_append,
build_append_line_gui_safe and new_append accordingly).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh`:
- Around line 955-962: The GUI Safe Mode branch currently reuses new_append
(which contains initrd=/bzroot) when EXCLUDE_FRAMEBUFFER_FROM_GUI==0, causing
the GUI entry to lose /bzroot-gui; change the assignment that sets
gui_safe_append so it generates an append line that preserves the GUI
initrd—either call build_append_line_gui_safe to produce the full append string
instead of reusing new_append or explicitly replace the initrd token in
new_append with initrd=/bzroot-gui before assigning gui_safe_append (update the
code around APPLY_TO_GUI_SAFE_MODE, EXCLUDE_FRAMEBUFFER_FROM_GUI,
gui_safe_append, build_append_line_gui_safe and new_append accordingly).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f4211979-f316-4caf-993e-374a734f0bf9

📥 Commits

Reviewing files that changed from the base of the PR and between 988c7a2 and cb1d7ed.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/scripts/manage_boot_params.sh

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh`:
- Around line 280-284: The syslinux stanza matching is too strict: in the AWK
block(s) that start with the /^label[[:space:]]+/ pattern (used by read_config
and related parsing code), normalize whitespace and relax equality so labels
match regardless of tabs/multiple spaces or trailing/leading spacing, and accept
"append" lines without requiring leading indentation; specifically, in the block
that lowercases and trims the line (the /^label[[:space:]]+/ handler), change
the equality check that compares to "label " label to a regex or
normalized-compare that matches "label" followed by any whitespace then the
target label, and mirror the same relaxed matching logic in the other identical
blocks (the one around the append handling and the duplicate section at lines
~833–840) so label and append stanza detection is whitespace-agnostic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e68231bc-e78a-41c7-95b0-23651db1d04e

📥 Commits

Reviewing files that changed from the base of the PR and between cb1d7ed and ed82ba7.

📒 Files selected for processing (2)
  • emhttp/plugins/dynamix/BootParameters.page
  • emhttp/plugins/dynamix/scripts/manage_boot_params.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • emhttp/plugins/dynamix/BootParameters.page

Comment thread emhttp/plugins/dynamix/scripts/manage_boot_params.sh
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
emhttp/plugins/dynamix/scripts/manage_boot_params.sh (1)

749-751: 💤 Low value

Remove unnecessary echo wrapper.

The echo "$(cmd)" pattern is redundant—the pipeline already outputs to stdout.

♻️ Suggested fix
 build_kernel_args_gui_safe() {
-    echo "$(build_append_line_gui_safe | sed 's/^initrd=\/bzroot,\/bzroot-gui[ ]*//')"
+    build_append_line_gui_safe | sed 's/^initrd=\/bzroot,\/bzroot-gui[ ]*//'
 }

Note: The same pattern exists in build_kernel_args() on line 746.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh` around lines 749 - 751,
The function build_kernel_args_gui_safe uses an unnecessary echo wrapper around
a command substitution; replace the body so it directly pipes
build_append_line_gui_safe into sed (i.e., remove echo and the "$(…)" wrapper)
to let the pipeline write to stdout; also apply the same simplification to the
build_kernel_args function which uses the identical echo "$(…)" pattern.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@emhttp/plugins/dynamix/scripts/manage_boot_params.sh`:
- Around line 749-751: The function build_kernel_args_gui_safe uses an
unnecessary echo wrapper around a command substitution; replace the body so it
directly pipes build_append_line_gui_safe into sed (i.e., remove echo and the
"$(…)" wrapper) to let the pipeline write to stdout; also apply the same
simplification to the build_kernel_args function which uses the identical echo
"$(…)" pattern.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 63c6f028-ef84-4f73-a200-5e5f684e2e4e

📥 Commits

Reviewing files that changed from the base of the PR and between ed82ba7 and b5fa746.

📒 Files selected for processing (1)
  • emhttp/plugins/dynamix/scripts/manage_boot_params.sh

@SimonFair SimonFair marked this pull request as ready for review May 7, 2026 12:57
@limetech limetech merged commit 90d3729 into unraid:master May 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants