Cannot update snap package of rocketchat-server on ubuntu 20.4 LTS

Description

We have installed rocketchat-server 5.4.5 on Ubuntu 20.04.6 LTS and snap 2.58.
rocketchat-server gives the following errors:

Mai 17 11:00:52 chat kernel: audit: type=1400 audit(1684314051.996:15401): apparmor=“DENIED” operation=“open”
profile=“snap.rocketchat-server.rocketchat-mongo” name=“/proc/3475/mountinfo” pid=3475 comm=“ftdc”
requested_mask=“r” denied_mask=“r” fsuid=0 ouid=0
Mai 17 11:00:52 chat kernel: audit: type=1400 audit(1684314051.996:15402): apparmor=“DENIED” operation=“open”
profile=“snap.rocketchat-server.rocketchat-mongo” name=“/proc/vmstat” pid=3475 comm=“ftdc”
requested_mask=“r” denied_mask=“r” fsuid=0 ouid=0

We solved this by adding lines to /var/lib/snapd/apparmor/profiles/snap.rocketchat-server.rocketchat-mongo

@{PROC}/vmstat r,
@{PROC}/@{pid}/mountinfo r,

and executed:

apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.rocketchat-server.rocketchat-mongo

We had the same errors with netstat, snmp. We cresolved them by add connection to rocketchat:

snap connect rocketchat-server:network-observe

Now we want to upgrade rocketchat-server to 6.x by

snap refresh rocketchat-server --channel=6.x/stable

This cannot be done because during update the rocketchat snap package overrides
/var/lib/snapd/apparmor/profiles/snap.rocketchat-server.rocketchat-mongo with a new generated
version where our added lines for vmstat and mountinfo are missing.
So updates fails because of the same errors we got before.

How can we update the snap package of rocketchat-server?

Server Setup Information

  • Version of Rocket.Chat Server: 5.4.5
  • Operating System: ubuntu 20.4 LTS
  • Deployment Method: snap
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version:
  • MongoDB Version:
  • Proxy:
  • Firewalls involved: