Skip to content

Restricted platforms

Jammersmurph edited this page Oct 7, 2026 · 2 revisions

Restricted platforms

PackUpdater has three ways to install a pack, because some environments cannot support the normal one. It picks the best available at runtime and never asks.

Engine What runs the install Optional mods
Fork (default) A separate JVM, via the embedded bootstrap Chosen in the installer's window
Fork, filtered A separate JVM, with a rebuilt index Forced to the pack's declared defaults
Direct Inside the game JVM Forced to the pack's declared defaults

Why more than one

The normal path needs a second JVM

PackUpdater extracts an embedded bootstrap jar and runs it in a child process. That child self-updates the PackWiz installer from a GitHub release, then runs it against the game directory. Forking is preferred because it isolates the installer's Kotlin and OkHttp from the game's, and it is the only path where a window can appear outside the game process.

Why forking is impossible on Android launchers

Android launchers such as PojavLauncher, Pojav Glow·Worm, Fold Craft and Zalith run Minecraft inside the launcher's own process rather than executing a separate one. The game's java.home points at a runtime the app is allowed to use but not to execute, so starting one fails immediately:

Cannot run program ".../runtimes/Internal-21/bin/java": Exec failed, error: 13 (Permission denied)

When that happens PackUpdater installs in-process instead.

It cannot simply call the PackWiz installer there. The installer invokes System.exit on nearly every path, including success — its GUI exits 0 when the player declines an update. In the game's JVM that would end Minecraft. Java 21 also refuses to let System.exit be trapped: System.setSecurityManager throws UnsupportedOperationException. So PackUpdater performs the download and verification loop itself.

What the direct engine does:

  • downloads to a temp file and moves it into place atomically, so an interrupted transfer cannot leave a truncated jar where the game expects a complete one
  • verifies the hash algorithm each entry declares rather than assuming SHA-256, because plenty of pack metadata uses SHA-512
  • refuses any index path that resolves outside the game directory, since a pack is remote input
  • removes stale files only when they appear in its own packupdater-manifest.json, never from the installer's packwiz.json, so the two tools cannot fight over what is installed

It keeps its own manifest deliberately. Writing the installer's manifest would make them disagree, and the installer would then undo the work on its next run.

Why a window cannot be shown from a child on some platforms

Some platforms supply AWT to the game from an external jar. The game can open windows, but a forked child cannot, because it does not inherit the parent's system properties or its -Xbootclasspath. The child falls back to the platform's default toolkit and fails with:

java.awt.HeadlessException: No X11 DISPLAY variable was set

PackUpdater detects this by asking a short-lived child JVM whether it can actually open a window, rather than trying to infer it. Two obvious guesses are both wrong on these platforms:

  • GraphicsEnvironment.isHeadless() reports only whether java.awt.headless was set. Launchers set it to false while pointing DISPLAY at a display that does not exist, so it returns false and a window still cannot be opened.
  • The game JVM's AWT toolkit code source is no better. Launchers supply AWT through -Xbootclasspath, and a bootclasspath-loaded class reports a null code source — exactly like a stock JDK toolkit. The two are indistinguishable.

Only building a window exercises the thing that actually fails.

Optional mods are skipped, not installed

There is no window on a restricted platform in which a player could decline an optional mod, and an optional mod is frequently desktop-only: VR mods, shaders, minimap mods. Installing all of them by default is how a phone ends up with a VR modpack.

So the windowless paths apply a stricter rule than "honour default = false":

Situation Optional mods
Restricted platform (Android launcher, anything the game JVM is sandboxed on) None installed unless the mod opted in
Headless server or CI, where the machine is not restricted The pack's declared default is honoured

A mod opts in with a marker in its own metadata:

[option]
optional = true
packupdater-allow-restricted = true

PackWiz ignores unknown keys in a mod file — verified against both packwiz refresh and the real installer — so the marker travels with the mod and survives a refresh, and there is no second list to keep in step with the pack.

On desktop none of this applies: the window appears and the player chooses.

Mods the in-process engine cannot install

The installer resolves some mods through a platform API rather than a direct URL. A mod whose metadata looks like this cannot be installed without a child process:

[download]
hash-format = "sha1"
hash = "f5978bb4..."
mode = "metadata:curseforge"

PackUpdater logs which file it skipped and why, naming packupdater.engine=fork as the way to get it. If a pack depends on such a mod, restricted platforms will be missing it.

Why -g alone is not enough

When PackUpdater falls back to a silent install it does not simply add -g. The installer's CLI path force-enables every optional mod it finds:

iOptionDetails.setOptionValue(true);

So a headless run installs the union of all optional mods, which is wrong for any pack where they are not purely additive.

Instead PackUpdater rebuilds the index without the optional mods the pack explicitly sets default = false, and installs the rest. Optional mods enabled by default are kept, so the installed set matches what a player would have chosen in the window.

Filtering the index rather than deleting files afterwards is deliberate: the installer's manifest caches file hashes, so removing a file post-install makes the next run download it again and remove it again, forever.

An optional mod with an [option] block but no default key is treated as enabled, since the PackWiz spec leaves that case undefined and installing is the less surprising choice.

Controlling it

Key Default Values Purpose
packupdater.compat auto auto, off off disables all detection and fallback.
packupdater.fallback auto auto, never, always always forces the silent filtered install.
packupdater.engine auto auto, fork, direct fork always forks, direct never does.

To restore the original behaviour without replacing the jar:

packupdater.compat=off

Testing these paths yourself

You do not need the affected hardware to exercise either fallback.

Force the silent filtered install:

packupdater.fallback=always

Force the in-process engine, which is the path Android uses:

packupdater.engine=direct

Both are worth running on a desktop before trusting them on a device. Every decision is logged with a [PackUpdater] prefix, so logs/latest.log will say which engine ran and why.

Known limits

The direct engine is a smaller tool than the real installer. It covers the parts of the PackWiz format that packs in this family actually use. If a pack relies on a feature it does not implement, the forked path remains available with packupdater.engine=fork.