Repository navigation
Description
Summary
With MTProxyMax v1.4.2-LTS, updating the pinned telemt engine from 3.5.14 to 3.5.16-84e5b82 fails when the pre-built image is unavailable and the script falls back to building from source.
The failure is deterministic and occurs before Rust compilation. The Dockerfile uses Bash-only substring expansion under Docker's default /bin/sh shell.
Steps to reproduce
- Run the MTProxyMax engine update (or Proxy Management → Start proxy) when the exact
ghcr.io/samnet-dev/mtproxymax-telemt:3.5.16-84e5b82image cannot be pulled. - The script prints
Pre-built image not available, compiling from source.... - The generated Dockerfile fails at the commit verification step.
Actual output
[i] Pulling pre-built telemt v3.5.16-84e5b82...
[!] Pre-built image not available, compiling from source...
[i] Compiling from source (first build takes a few minutes)...
=> ERROR [builder 5/6] RUN git checkout --detach "${TELEMT_COMMIT}" && test "$(git rev-parse HEAD | cut -c1-7)" = "${TELEMT_COMMIT:0:7}"
HEAD is now at 84e5b82 Merge pull request #964 from telemt/flow/3.5.16
/bin/sh: 1: Bad substitution
ERROR: failed to build: ... exit code: 2
[✗] Source build failed — ensure Docker has enough memory (2GB+)
[✗] Failed to build telemt image
Root cause
In build_telemt_image(), the generated Dockerfile contains:
RUN git checkout --detach "${TELEMT_COMMIT}" && test "$(git rev-parse HEAD | cut -c1-7)" = "${TELEMT_COMMIT:0:7}"${TELEMT_COMMIT:0:7} is Bash-specific; RUN executes via /bin/sh -c by default (Debian's dash), which reports Bad substitution.
Suggested fix
Use POSIX-compatible syntax, for example:
RUN git checkout --detach "${TELEMT_COMMIT}" && \
test "$(git rev-parse HEAD | cut -c1-7)" = "$(printf '%.7s' "$TELEMT_COMMIT")"The error message about insufficient RAM is misleading for this failure mode; compilation never starts.
Impact
On the affected server, following the attempted update, the mtproxymax container was absent, the telemt listening port was unavailable, and the HAProxy backend reported no available server. Service was restored manually using the previously saved telemt 3.5.14 image and existing configuration.
It would also be helpful for the update/start workflow to retain or restore the previous working container/image if image retrieval/build fails, instead of leaving the service unavailable.
Expected: source fallback builds the pinned commit successfully, or safely aborts without disrupting the currently working proxy.
Activity
mozgu13 commentedon Nov 3, 2026
I also had a problem with updating using AI. I restored functionality. Before compiling, you need to disable autoreset in the bot and on the server itself.
Wyatt-Dian commentedon Nov 5, 2026
is there a way to fix it for people who are not an expert ?
I am facing the same issue with several servers. I am installing it for the first time.
Should we wait for the owner to fix the code?
fix(engine): POSIX commit check in Dockerfile and safeguard running p…
SamNet-dev commentedon Nov 8, 2026
Hello @Krezi-777, @mozgu13, @Wyatt-Dian,
Thank you for the detailed report and root-cause analysis!
What Happened
During source-build fallback, the generated
DockerfileexecutedRUN ... test ... = "${TELEMT_COMMIT:0:7}". Because Docker executesRUNsteps using Debian's/bin/sh(dash), the Bash-only parameter expansion${var:0:7}failed immediately with/bin/sh: Bad substitutionbefore Rust compilation could begin.When
build_telemt_imagefailed during an update,self_update()did not guard the subsequent container restart, causingrestart_proxy_containerto stop and remove the existing working proxy container before verifying that the new engine image was ready.Fixes Applied (Commit
981bb80):Replaced
${TELEMT_COMMIT:0:7}with the POSIX-compliant builtin$(printf '%.7s' "${TELEMT_COMMIT}")in bothmtproxymax.shand.github/workflows/build-engine.yml. This works seamlessly across/bin/sh(dash),ash,bash, andbusybox.Added strict status checks in
self_update(),rebuild,engine rebuild, and the TUI menu. If engine image acquisition or compilation fails, the update safely aborts with an error while leaving your current running proxy container and port listeners untouched.Replaced the speculative memory-limit error message with guidance directing operators to the actual
docker buildlogs and prerequisites.Dispatched GitHub Actions workflow run to compile and publish
ghcr.io/samnet-dev/mtproxymax-telemt:3.5.16-84e5b82andlatest. Once published,mtproxymax updatewill pull the pre-built multi-arch binary in seconds without needing local compilation.Closing this issue as resolved. To update your installation: