RocketChat / server-snap

Rocket.Chat server snap
MIT License
18 stars 17 forks source link

Snap update 4.2.2 to 4.3.1 failed #35

Closed CvH closed 2 years ago

CvH commented 2 years ago

I tried to update from 4.2.2 to 4.3.1 (current latest in 4.x train)

snap refresh rocketchat-server

root@chat:~# snap refresh rocketchat-server
error: cannot perform the following tasks:
- Run pre-refresh hook of "rocketchat-server" snap if present (run hook "pre-refresh":
-----
WARNING: cgroup v2 is not fully supported yet, proceeding with partial confinement
/snap/rocketchat-server/1502/migrations/feature_compatibility/pre_adopt_version.sh: line 6: mongo_version_excluding_patch: command not found
jq: error: Could not open file command: No such file or directory
jq: error: Could not open file argument.: No such file or directory
jq: error: Could not open file Expected: No such file or directory
jq: error: Could not open file '3.6': No such file or directory
jq: error: Could not open file or: No such file or directory
jq: error: Could not open file '3.4',: No such file or directory
jq: error: Could not open file found: No such file or directory
jq: error: Could not open file in:: No such file or directory
jq: error: Could not open file {: No such file or directory
jq: error: Could not open file setFeatureCompatibilityVersion:: No such file or directory
jq: error: Could not open file \"\",: No such file or directory
jq: error: Could not open file lsid:: No such file or directory
jq: error: Could not open file {: No such file or directory
jq: error: Could not open file id:: No such file or directory
jq: error: Could not open file UUID(\"1fddb401-9697-47e4-a087-3dcacd06a62f\"): No such file or directory
jq: error: Could not open file },: No such file or directory
jq: error: Could not open file $clusterTime:: No such file or directory
jq: error: Could not open file {: No such file or directory
jq: error: Could not open file clusterTime:: No such file or directory
jq: error: Could not open file Timestamp(1641794704,: No such file or directory
jq: error: Could not open file 1),: No such file or directory
jq: error: Could not open file signature:: No such file or directory
jq: error: Could not open file {: No such file or directory
jq: error: Could not open file hash:: No such file or directory
jq: error: Could not open file BinData(0,: No such file or directory
jq: error: Could not open file 0000000000000000000000000000000000000000),: No such file or directory
jq: error: Could not open file keyId:: No such file or directory
jq: error: Could not open file 0: No such file or directory
jq: error: Could not open file }: No such file or directory
jq: error: Could not open file },: No such file or directory
jq: error: Could not open file $db:: No such file or directory
jq: error: Could not open file \"admin\": No such file or directory
jq: error: Could not open file }.: No such file or directory
jq: error: Could not open file See: No such file or directory
jq: error: Could not open file http://dochub.mongodb.org/core/3.6-feature-compatibility.","code":2,"codeName":"BadValue","$clusterTime":{"clusterTime":{"$timestamp":{"t":1641794704,"i":1}},"signature":{"hash":{"$binary":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","$type":"00"},"keyId":{"$numberLong":"0"}}}}: No such file or directory
jq: error: Could not open file command: No such file or directory
jq: error: Could not open file argument.: No such file or directory
jq: error: Could not open file Expected: No such file or directory
jq: error: Could not open file '3.6': No such file or directory
jq: error: Could not open file or: No such file or directory
jq: error: Could not open file '3.4',: No such file or directory
jq: error: Could not open file found: No such file or directory
jq: error: Could not open file in:: No such file or directory
jq: error: Could not open file {: No such file or directory
jq: error: Could not open file setFeatureCompatibilityVersion:: No such file or directory
jq: error: Could not open file \"\",: No such file or directory
jq: error: Could not open file lsid:: No such file or directory
jq: error: Could not open file {: No such file or directory
jq: error: Could not open file id:: No such file or directory
jq: error: Could not open file UUID(\"1fddb401-9697-47e4-a087-3dcacd06a62f\"): No such file or directory
jq: error: Could not open file },: No such file or directory
jq: error: Could not open file $clusterTime:: No such file or directory
jq: error: Could not open file {: No such file or directory
jq: error: Could not open file clusterTime:: No such file or directory
jq: error: Could not open file Timestamp(1641794704,: No such file or directory
jq: error: Could not open file 1),: No such file or directory
jq: error: Could not open file signature:: No such file or directory
jq: error: Could not open file {: No such file or directory
jq: error: Could not open file hash:: No such file or directory
jq: error: Could not open file BinData(0,: No such file or directory
jq: error: Could not open file 0000000000000000000000000000000000000000),: No such file or directory
jq: error: Could not open file keyId:: No such file or directory
jq: error: Could not open file 0: No such file or directory
jq: error: Could not open file }: No such file or directory
jq: error: Could not open file },: No such file or directory
jq: error: Could not open file $db:: No such file or directory
jq: error: Could not open file \"admin\": No such file or directory
jq: error: Could not open file }.: No such file or directory
jq: error: Could not open file See: No such file or directory
jq: error: Could not open file http://dochub.mongodb.org/core/3.6-feature-compatibility.","code":2,"codeName":"BadValue","$clusterTime":{"clusterTime":{"$timestamp":{"t":1641794704,"i":1}},"signature":{"hash":{"$binary":"AAAAAAAAAAAAAAAAAAAAAAAAAAA=","$type":"00"},"keyId":{"$numberLong":"0"}}}}: No such file or directory
[ERROR] JSON.stringify(db.adminCommand({ setFeatureCompatibilityVersion: "" })) command failed
[ERROR] pre refresh migration "adopt_version.sh" run failed
-----)

current setup

root@chat:~# snap info rocketchat-server
name:      rocketchat-server
summary:   Rocket.Chat server
publisher: Rocket.Chat (rocketchat*)
store-url: https://snapcraft.io/rocketchat-server
contact:   https://open.rocket.chat/channel/ubuntu-snap
license:   unset
description: |
  Have your own Slack like online chat, built with Meteor. https://rocket.chat/
commands:
  - rocketchat-server.backupdb
  - rocketchat-server.mongo
  - rocketchat-server.restoredb
services:
  rocketchat-server.rocketchat-caddy: simple, enabled, inactive
  rocketchat-server.rocketchat-mongo: forking, enabled, active
  rocketchat-server:                  simple, enabled, active
snap-id:      wdBUbiEuMNHmAHLBCXQXOcXaOCvbWS1e
tracking:     4.x/stable
refresh-date: 24 days ago, at 06:59 CET
channels:
  3.x/stable:       3.18.3 2021-11-28 (1491) 289MB -
  3.x/candidate:    3.18.3 2021-11-28 (1491) 289MB -
  3.x/beta:         3.18.3 2021-11-28 (1491) 289MB -
  3.x/edge:         3.18.3 2021-11-28 (1491) 289MB -
  latest/stable:    3.18.3 2021-12-06 (1491) 289MB -
  latest/candidate: 3.18.3 2021-12-06 (1491) 289MB -
  latest/beta:      3.18.3 2021-12-06 (1491) 289MB -
  latest/edge:      4.1.2  2021-12-06 (1497) 285MB -
  4.x/stable:       4.3.1  2022-01-09 (1505) 238MB -
  4.x/candidate:    4.3.1  2022-01-09 (1505) 238MB -
  4.x/beta:         4.3.1  2022-01-09 (1505) 238MB -
  4.x/edge:         4.3.1  2022-01-09 (1505) 238MB -
  2.x/stable:       2.4.14 2020-12-23 (1453) 267MB -
  2.x/candidate:    2.4.14 2020-12-23 (1453) 267MB -
  2.x/beta:         2.4.14 2020-12-23 (1453) 267MB -
  2.x/edge:         ^
installed:          4.2.2             (1502) 255MB -
debdutdeb commented 2 years ago

Can you please show me stat /snap/rocketchat-server/1502/migrations/feature_compatibility/pre_adopt_version.sh

CvH commented 2 years ago
root@chat:~# stat /snap/rocketchat-server/1502/migrations/feature_compatibility/pre_adopt_version.sh
  File: /snap/rocketchat-server/1502/migrations/feature_compatibility/pre_adopt_version.sh
  Size: 165             Blocks: 0          IO Block: 131072 regular file
Device: 44h/68d Inode: 3365539693  Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-12-02 11:47:55.000000000 +0100
Modify: 2021-12-02 11:47:55.000000000 +0100
Change: 2021-12-02 11:47:55.000000000 +0100
 Birth: -

root@chat:~# cat /snap/rocketchat-server/1502/migrations/feature_compatibility/pre_adopt_version.sh
#!/bin/bash

source $SNAP/helpers/mongo.sh

start() {
    local v=$(mongo_version_excluding_patch)
    is_feature_compatibility $v || set_feature_compatibility $v
}
debdutdeb commented 2 years ago

Hmm,

[debdut@Rocket tmp]$ stat $_
  File: /snap/rocketchat-server/1502/migrations/feature_compatibility/pre_adopt_version.sh
  Size: 165         Blocks: 1          IO Block: 1024   regular file
Device: 7,17    Inode: 5690        Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2021-12-02 16:17:55.000000000 +0530
Modify: 2021-12-02 16:17:55.000000000 +0530
Change: 2021-12-02 16:17:55.000000000 +0530
 Birth: -

This file, shouldn't run :(

Do you mind running

find /snap/rocketchat-server/1502/migrations/ -executable -type f
CvH commented 2 years ago
root@chat:~# find /snap/rocketchat-server/1502/migrations/ -executable -type f
/snap/rocketchat-server/1502/migrations/feature_compatibility/post_confirm_mongo_startup.sh
/snap/rocketchat-server/1502/migrations/feature_compatibility/pre_adopt_version.sh
/snap/rocketchat-server/1502/migrations/post_new_snap_initializations.sh
debdutdeb commented 2 years ago

Which distribution are you in? -executable should only spit out executable files. But as you can see above not all of them are executable

debdutdeb commented 2 years ago

mine

[debdut@Rocket tmp]$ find /snap/rocketchat-server/1502/migrations/ -executable -type f
/snap/rocketchat-server/1502/migrations/post_new_snap_initializations.sh
debdutdeb commented 2 years ago

Hmm, that flag doesn't seem to be much reliable. I'll push a fix asap. Need to just match the epochs. should be fun.

CvH commented 2 years ago

Thats an LXC running Ubuntu 20.04 since ~2years. nothing special and no manual changes at snap.

root@chat:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
root@chat:~# ll /snap/rocketchat-server/1502/migrations/feature_compatibility/*
-rw-r--r-- 1 root root 305 Dec 14 19:55 /snap/rocketchat-server/1502/migrations/feature_compatibility/post_confirm_mongo_startup.sh
-rw-r--r-- 1 root root 165 Dec  2 11:47 /snap/rocketchat-server/1502/migrations/feature_compatibility/pre_adopt_version.sh

root@chat:~# ll /snap/rocketchat-server/1502/migrations/*
-rwxr-xr-x 1 root root 1771 Dec 15 11:32 /snap/rocketchat-server/1502/migrations/post_new_snap_initializations.sh*

I'll push a fix asap

tx

debdutdeb commented 2 years ago

@CvH at the moment, you should still be able to update to latest. Just do these

sudo snap set rocketchat-server ignore-errors=true
sudo snap refresh rocketchat-server

Please make sure you back up the data first.

debdutdeb commented 2 years ago

Please let me know when you start the process, I'll be online just in case.

CvH commented 2 years ago

image

looks working, tx

debdutdeb commented 2 years ago

Great! Please reset the ignore-errors value. That's just a failsafe for situations like these.

sudo snap set rocketchat-server ignore-errors=false
CvH commented 2 years ago

uff tx for reminding 👍

Zwiggelino commented 2 years ago

hi, I use a raspberry pi 4 with RaspberryOS 64bit (Buster) . With the command: sudo snap refresh rocketchat-server --channel=4.x/stable I updated yesterday from 3.18.2 to version 4.1.2. But MongoDB is still version 3.6.23. With the refresh command, no newer version than 4.1.2 is displayed to me. I also get the deprecaded message. How can I update the MongoDB version? Will ARM computers get the update later? Many thanks for your help! Sorry for my bad english.

debdutdeb commented 2 years ago

Hey @Zwiggelino Yes arm updates are seperate, nd will start next week. You can create a seperate issue on that.

I'm closing this now since this is fixed.