omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

install/hardware/intel/fred.sh writes a `fred=on` cmdline that Linux 7.1 no longer reads

Open Faxulous opened this issue 2 months ago • 2 comments

System details

Dell XPS 16 DA16260, Intel Panther Lake (Core Ultra 300), Omarchy 4.0.0.alpha, linux-ptl 7.1.8.arch1-2 (stock linux 7.1.9.arch1-2 also installed)

What's wrong?

On an Intel Panther Lake machine, the FRED drop-in installed by install/hardware/intel/fred.sh has no effect on Linux 7.1, and the kernel hands the parameter to user space instead:

$ cat /etc/limine-entry-tool.d/intel-panther-lake-fred.conf
# Intel Panther Lake FRED support
KERNEL_CMDLINE[default]+=" fred=on"

$ journalctl -k -b 0 | grep 'Unknown kernel command line'
kernel: Unknown kernel command line parameters "splash cryptdevice=PARTUUID=…:root fred=on", will be passed to user space.

FRED is enabled regardless: CONFIG_X86_FRED=y, the CPU advertises the fred flag, and asm_fred_entrypoint_user shows up in stack traces.

It was correct when it landed (91af40f, "Enable fred=on on intel ptl machines", 2026-04-30). On 7.0 the option was required — arch/x86/kernel/cpu/common.c:1761 at v7.0:

arglen = cmdline_find_option(boot_command_line, "fred", arg, sizeof(arg));
if (arglen != 2 || strncmp(arg, "on", 2))
        setup_clear_cpu_cap(X86_FEATURE_FRED);

ac66a73be03a ("x86/fred: Enable FRED by default", merged for 7.1-rc1) inverted that. Same file, common.c:1764 at v7.1:

arglen = cmdline_find_option(boot_command_line, "fred", arg, sizeof(arg));
if (arglen == 3 && !strncmp(arg, "off", 3))
        setup_clear_cpu_cap(X86_FEATURE_FRED);

Only off is read; on matches nothing. kernel-parameters.txt at v7.1 now reads "on: enable FRED when it's present, the default setting."

The log line above is the second half: fred= has no __setup() stub, so it misses the registered-parameter sweep. clearcpuid=/setcpuid= carry dummy stubs at common.c:2231/2237 for exactly this, per the comment above them — "to prevent them from becoming an environment variable for init".

Suggested fix: drop fred.sh and its install/hardware/all.sh:23 call. That covers new installs, but every PTL machine installed since April still has the drop-in — nothing under migrations/ removes it, and omarchy apply hardware would rewrite it — so a migration deleting the file and rebuilding the boot image would be needed too, along the lines of what 1785944594.sh and 1786482992.sh already do for other limine-entry-tool.d drop-ins. If a disable switch is ever wanted later, fred=off is the spelling the kernel still reads.

No functional harm observed here — FRED is running as intended either way.

Related: #10037 (same directory, stale drop-in left behind).

Faxulous avatar Sep 04 '26 11:09 Faxulous

Confirmed. Diagnosed here by Claude Opus 5, with an independent second opinion from Codex at xhigh reasoning. Your kernel-side reading checks out line for line against the upstream tree; what follows adds where the token actually ends up, why that keeps this cosmetic, and one thing the cleanup you sketched would miss.

What the script writes, and which machines get it. install/hardware/intel/fred.sh:3-13 creates /etc/limine-entry-tool.d/intel-panther-lake-fred.conf holding KERNEL_CMDLINE[default]+=" fred=on", gated only on omarchy-hw-intel-ptl, which matches the display device name in lspci (bin/omarchy-hw-intel-ptl:5). That is broader than install/hardware/intel/ptl-kernel.sh:4, which additionally requires omarchy-hw-match "XPS" — so every Panther Lake machine gets the drop-in, not only the XPS models that get linux-ptl. bin/omarchy-apply-hardware:75 sources install/hardware/all.sh, which calls the script at line 23, so omarchy apply hardware does recreate the file after a manual delete, as you say. It shipped in v3.7.0 and is in every release since, including v4.0.2.

fred.sh never rebuilds the boot image itself, and the only rebuild all.sh runs after it is inside dell-xps13-sidecar-amps.sh, which does not fire on an XPS 16 — so the parameter reached your cmdline through a later limine-mkinitcpio-hook run rather than at install time. That matters for the cleanup rather than for the bug.

The kernel side, checked against the tags rather than the commit message. At v7.0, arch/x86/kernel/cpu/common.c:1761:

arglen = cmdline_find_option(boot_command_line, "fred", arg, sizeof(arg));
if (arglen != 2 || strncmp(arg, "on", 2))
        setup_clear_cpu_cap(X86_FEATURE_FRED);

At v7.1, common.c:1764:

arglen = cmdline_find_option(boot_command_line, "fred", arg, sizeof(arg));
if (arglen == 3 && !strncmp(arg, "off", 3))
        setup_clear_cpu_cap(X86_FEATURE_FRED);

ac66a73be03a sits between those two tags, so the boundary is exactly 7.0 to 7.1. One clarification worth stating precisely: 7.1 still searches the command line for fred, it just only acts on off. fred=on is parsed and discarded, and FRED is enabled regardless.

Where the token ends up. There is no __setup("fred=") or early_param("fred") at either tag, so fred=on reaches unknown_bootoption() at init/main.c:548. Because it carries a value it takes the "Environment option" branch at init/main.c:581-593 and lands in envp_init[] — an environment variable for PID 1. Tokens without a value take the argv branch at lines 594-604; this one does not. So nothing here reaches init's argument list and nothing changes how the machine boots. The clearcpuid=/setcpuid= stubs you cite are the same mechanism read from the other side: their comment at common.c:2221-2225 says outright that they exist "to prevent them from becoming an environment variable for init".

The notice from print_unknown_bootoptions() (init/main.c:865) is not new either — an unmodified Omarchy install already reports splash cryptdevice=... the same way, splash into argv and cryptdevice= into the environment. fred=on joins a list Omarchy has always had. That puts this at cosmetic: a dead parameter and one unread variable.

Codex raised the one path by which it could be worse, and it is bounded rather than hypothetical. MAX_INIT_ENVS is CONFIG_INIT_ENV_ARG_LIMIT (init/main.c:140), which defaults to 32 (init/Kconfig:230-233); envp_init[] already starts with HOME and TERM (init/main.c:198); overflowing it sets panic_later and panics at init/main.c:1158. Crossing that needs roughly thirty other unknown value-bearing parameters, which no Omarchy install is near. Not your bug, but it is why the entry is not literally free.

Nothing installable is on the far side of the boundary. Arch's linux is 7.1.9.arch1-2 and linux-ptl is pinned at pkgver=7.1.8.arch1 / pkgrel=2 in omacom-io/omarchy-pkgs (pkgbuilds/linux-ptl/PKGBUILD), so no kernel a current install can pull still reads fred=on. The residual case is a retained Snapper snapshot booting a pre-7.1 kernel: removing the parameter would leave FRED off there, which costs performance rather than correctness.

One addition to the cleanup you sketched. 91af40f also appended the drop-in's contents to /etc/default/limine, and 75cb4f71 dropped that write and deleted migrations/1777546300.sh without cleaning what it had already written. bin/omarchy-upgrade-to-quattro:599-616 appends to that file rather than replacing it, so a machine first set up between 2026-04-30 and 2026-05-25 can carry a second fred=on there that deleting the drop-in would not reach. Codex added a second point: bin/omarchy-migrate:88-97 marks a migration complete only after it exits zero, so a cleanup that deletes both sources and then fails at limine-mkinitcpio would re-run with nothing left to trigger on. It wants a marker or a /proc/cmdline comparison, the way migrations/1786482992.sh does.

No fix filed. The correction is a removal plus a migration that rebuilds the boot image on every Panther Lake machine in the field, and whether to spend that is a decision about how machines boot rather than a defect for triage to quietly correct — so it goes to the maintainer rather than into a pull request from here. test/shell.d/limine-cmdline-migration-test.sh already carries the sudo and limine-mkinitcpio stub harness such a migration would be tested against.

Related. #10037 is the same shape — a /etc/limine-entry-tool.d/ drop-in that outlives its purpose with nothing to remove it — though its stale resume= points at freed blocks where this one is inert. Three one-off repair migrations already exist for that directory, which suggests the pattern rather than either instance is the thing worth fixing. #10154 lives in the same file tree but is an unrelated mechanism (pacman -R aborting the whole transaction on one missing target), and #10048 shares nothing with either beyond subject matter.

Codex agreed with the mechanism I had already established, so its independence on that point is not guaranteed — codex exec -s read-only restricts writes, not reads. The environment-limit path, the boot-image rebuild ordering, and the migration retryability point are its own, and each was checked against the source before being repeated here.

omarchybot avatar Sep 04 '26 12:09 omarchybot

#10165 is the open fix for this. It removes install/hardware/intel/fred.sh and its call in install/hardware/all.sh. It also adds migrations/1788521801.sh, which deletes the drop-in when it matches the shipped file exactly and rebuilds the boot image, with a marker so a failed rebuild is retried. It already says Fixes #10155, so this issue closes when it merges. The pull request is reviewed and tested on a worker as its own item, so this comment covers only what it means for this issue.

On current quattro (10f1cbf7c) one gap remains. The original 91af40f also appended the drop-in's line to /etc/default/limine, and 3.x still does that today (install/config/hardware/intel/fred.sh:15-16 on dev). bin/omarchy-upgrade-to-quattro carries that file across without removing the line, and #10165's migration never reads it. So a Panther Lake machine upgraded from 3.x keeps fred=on after the migration runs, and the boot-image rebuild bakes it straight back in.

The second opinion raised one more point, which I checked against the source. limine-mkinitcpio can exit zero after skipping a failed kernel build, and migrations/1789325478.sh:34-38 already guards against exactly that. #10165 clears its retry marker on the exit code alone, so a machine whose rebuild silently failed would be recorded as done with the old cmdline still in its image. It also suggested that an earlier version of the script (f15094c9e) wrote a different drop-in that the exact match would miss. I rejected that: the commit changed the script's comment and its hardware gate, not the file it writes.

Neither gap changes the impact. This is still cosmetic, as the earlier diagnosis said, because 7.1 enables FRED whatever the parameter says. Whether #10165 lands as it is or first takes on /etc/default/limine is the maintainer's call, and this issue waits on that.

Checked by Claude Opus 5.5 against quattro, dev and #10165's head (8341444), with a second opinion from Codex at medium effort. Codex reached the /etc/default/limine gap on its own, but independence is not guaranteed because it can read this session's working files.

omarchybot avatar Oct 11 '26 04:10 omarchybot