RocketChat / RocketChat/Rocket.Chat

Snap upgrade from 7.13.5 (rev 1785) to 8.x/stable fails in pre-refresh hook 00-adopt_version.sh

Open Beginner friendly
#41,023 13 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

Description:

Upgrading Rocket.Chat Snap from 7.13.5 (rev 1785) to 8.x/stable (rev 1788) consistently fails during the pre-refresh hook.

The upgrade never reaches the installation phase of the new revision because the pre-refresh migration script exits with an error.

While investigating, I found what appears to be a typo in the migration script:

is_mongod_running && stop_monngod

The helper function actually present in the snap package is:

stop_mongod()

I am not certain this is the root cause, but it appears suspicious because the failing hook exits immediately after running this script.

Steps to reproduce:
  1. Install Rocket.Chat Snap 7.13.5 (rev 1785)
  2. Verify MongoDB is running with FCV 7.0
  3. Run:
sudo snap refresh rocketchat-server --channel=8.x/stable
  1. Observe the upgrade failure during pre-refresh hook execution
Expected behavior:

The snap should successfully upgrade from 7.13.5 to 8.x/stable.

Actual behavior:

Upgrade fails before revision 1788 is installed.

Output:

error: cannot perform the following tasks:
- Run pre-refresh hook of "rocketchat-server" snap if present

Additional output from:

sudo snap tasks <change-id>
[ERROR] pre refresh migration script
/snap/rocketchat-server/1785/migrations/pre_refresh/feature_compatibility/00-adopt_version.sh
Server Setup Information:
  • Version of Rocket.Chat Server: 7.13.5
  • License Type: Community
  • Number of Users: N/A
  • Operating System: Ubuntu 24.04 LTS
  • Deployment Method: Snap
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: Managed by Snap package
  • MongoDB Version: 7.0.31
Client Setup Information
  • Desktop App or Browser Version: N/A
  • Operating System: N/A
Additional context

Current snap version:

Name               Version  Rev   Tracking
rocketchat-server  7.13.5   1785  7.x/stable

Target version:

8.x/stable (rev 1788)

MongoDB version:

7.0.31

Feature Compatibility Version:

7.0

Replica set is healthy and PRIMARY.

The following script appears to be the failing migration:

/snap/rocketchat-server/1785/migrations/pre_refresh/feature_compatibility/00-adopt_version.sh

Script content:

#!/bin/bash

source $SNAP/helpers/mongo.sh

start() {
    local v
    { is_mongod_running || start_mongod; } && is_mongod_ready && v=$(mongod_fcv) && is_mongod_primary && { is_feature_compatibility $v || set_feature_compatibility $v; } && stop_mongod
    is_mongod_running && stop_monngod
}

Searching for the typo-like function:

grep -R "stop_monngod" /snap/rocketchat-server/1785

returns:

/snap/rocketchat-server/1785/migrations/pre_refresh/feature_compatibility/00-adopt_version.sh:
    is_mongod_running && stop_monngod

Searching for the actual helper:

grep -R "stop_mongod()" /snap/rocketchat-server/1785/helpers

returns:

/snap/rocketchat-server/1785/helpers/mongo.sh:stop_mongod() {
Relevant logs:
2026-06-20T08:14:53+08:00 ERROR run hook "pre-refresh":

[ERROR] pre refresh migration script
/snap/rocketchat-server/1785/migrations/pre_refresh/feature_compatibility/00-adopt_version.sh

I am happy to run additional diagnostics or test a patched revision if needed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with migrations/pre_refresh/feature_compatibility/00-adopt_version.sh and helpers/mongo.sh, then reproduce the pre-refresh hook using the documented snap refresh command. Verify the migration's MongoDB stop path against the helper functions and inspect the hook output. Done means the upgrade from revision 1785 to 1788 completes successfully without the pre-refresh error.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, mongodb
Domain
devops, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.