Skip to content

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

Description

@williamz64

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions