Files
firmware/docs/upgrading.md
Oleksandr ShyshatskyiandClaude Opus 5 5d7754285e Wipe $MODDIR and extract, instead of pruning by a manifest
The installer deletes /usr/data/anvil outright and extracts into the
empty directory. The installed set is the shipped set by construction,
so a renamed file cannot survive beside its replacement and no list has
to be shipped, read or trusted for that to hold.

What that costs is everything else under $MODDIR, and the audit of what
was actually there is docs/notes/86-wipe-and-extract.md. backup/stock
had no restore path in any script and omitted the one file a restore
would need. .prev-root-hash was already dead state. config-installed
was a twelve-file snapshot serving one md5, for a compare whose stated
rationale -- "there is no include-and-override seam" -- stopped being
true when moonraker-custom.conf became the last include, and which
inverted its own purpose by keeping the webcam block and the API
lockdown off any printer that tripped it. So moonraker.conf is
overwritten like every ff-*.cfg.

HelixScreen's /tmp stash is untouched and is now the only preservation
the installer does, so the gate asserts it with a value that could only
have come from the printer.

Gone with it: both delete passes, the forged-path guard, the rmdir
pass, the pre-manifest branch, the unconditional init.d/anvil-service/
anvil.conf removal, the etc/s6 scandir sweep and the $MODDIR __pycache__
sweep -- the last two existed only because a manifest cannot see paths
made at runtime. firmwareExe already makes the scandir itself.

test_upgrade.py rewritten: the negative control is inverted rather than
deleted, and the legacy fixture goes -- there is one path now.

qa/static green (112). The replica lane needs a package in work/out,
which needs config.env with FF_KEY and STOCK_TGZ; not run here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KXKk3zz8LAUPUDZkVEZ9fR
2026-08-30 15:49:26 +03:00

80 lines
3.8 KiB
Markdown

# Upgrading, and your files
A newer release installs exactly like the first flash: stick in, power on.
Nothing you have set is asked for again. This page is the line between the
files that are yours and the files the mod overwrites without asking, because
that line is what makes an update safe.
---
## Your files and the mod's files
| File | Whose |
|---|---|
| `/usr/data/config/printer.cfg` | **Yours** — never overwritten. Overrides go here, after the includes: restate only what you change, the last value wins. |
| `moonraker-custom.conf` | **Yours** — created once, never rewritten, included last so your settings win. Do not delete it. |
| `ff-*.cfg`, `printer.base.cfg`, `moonraker.conf` | **The mod's** — overwritten on every update; do not edit. |
| `anvil/helixscreen/config/settings.json` | **Yours** — everything you set on the screen. Written by HelixScreen itself; carried across updates along with `helixscreen.env` and its spool map. |
---
## Upgrading
A newer release installs exactly like the first flash: stick in, power on.
Your `printer.cfg` with its saved calibration, `moonraker-custom.conf`, **your
root password** and everything you set on the screen survive; the `ff-*.cfg`
family is replaced. If a release changes `helixscreen.env`, yours is kept and
the new one is left beside it as `helixscreen.env.mod-new`.
---
## The config files in detail
The `.cfg` includes are wired up **for** you: `printer.base.cfg` ends with
the seven `[include ff-*.cfg]` lines, so a flash brings the mod up by itself.
Your `printer.cfg` is not touched. The factory dock and nozzle numbers are
pulled in for you too: on the first boot after the flash, `[ff_legacy]` imports
firmwareExe's per-unit JSON and persists it with its own `SAVE_CONFIG`, so
Klipper restarts once, right after coming up — before the screen is on its
feet. `TOOL_OFFSET_STATUS` afterwards should show a nozzle triple for every
tool and no `NOT CALIBRATED`.
The included files are the mod's, and every update overwrites them without
asking — `ff-*.cfg` and `printer.base.cfg` alike. Do not edit them. Put changes
at the end of `printer.cfg`, restating only the option or macro you are
changing: Klipper merges same-named sections and the last value wins, so
everything you leave out keeps the shipped value and your overrides survive
every flash. Each of those files opens with a header saying as much.
`moonraker.conf` is mod-owned too — it is overwritten on every update, which
is how the `[webcam]` block and the API lockdown reach the printer. Its seam is
`moonraker-custom.conf` beside it: created once, never written again, and
included at the *end* of `moonraker.conf`, so anything you set there wins.
Do not delete it — Moonraker treats an include that matches no file as fatal
and will refuse to start. An empty one is fine.
Editing `moonraker.conf` itself does not survive: the next update overwrites
it, and that is how the `[webcam]` block and the API lockdown reach your
printer. Put the change in `moonraker-custom.conf` instead.
---
## A FlashForge OTA update is a different thing
Everything the mod installs is under `/usr/data/anvil` on the data partition,
the klippy tree and its extras included, so an OTA cannot delete them. What it
does rewrite is `/usr/prog`, and with it the `firmwareExe` the mod boots
from — so re-flash the mod after a firmware update. The `#*#` block in
`printer.cfg` survives either way.
---
## Going back to stock
Flashing the stock FlashForge package for your model is the uninstall — it
installs the same way, and it restores every file the mod touches. The one
thing it cannot bring back is FlashForge's Moonraker, which the stock package
does not carry: the mod's build stays, it works, and Mainsail is happy with
it. The details, and the ladder below it, are in
[Support](support.md).