I’m trying to update to latest version 1.0.2.
However I am confused howto find the correct ROLE_ID.
Could you please help me out?
Thanks and kind regards,
Wolfgang
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
Nothing in the current docs mentions a ROLE_ID for upgrading, so I’m not sure which one you mean. Updating to 1.0.2 shouldn’t need one.
Going from 1.0.x to 1.0.2 is a patch release, which contains fixes only. You don’t need to look up or set any role ID. How you upgrade depends on your installation:
Script installation: rerun the install script with the same arguments you used originally, such as the prefix directory or --fdb. It replaces the binary, keeps config.json and the environment file, and restarts the service.
Docker: use the stalwartlabs/stalwart:v1 image, or pin v1.0.2. Run docker pull, then recreate the container. With Compose, run docker compose pull && docker compose up -d. Your data and configuration are in volumes, so they are kept.
Windows: stop the service, replace stalwart.exe with the new binary, and start the service again.
If the “role ID” comes from something else, please tell us where you saw it. It could be a step in a guide, a variable in a script, or the STALWART_ROLE environment variable for clustering. It would also help to know your current version and how you installed Stalwart.
If you’re upgrading from 0.16 or earlier, an in-place upgrade isn’t possible. Follow the migration guide: Overview | Stalwart
If you meant the ID of a role object, such as the User role, you can list roles with stalwart-cli query Role. I haven’t confirmed that command in the docs, so treat it as a guess. See Roles | Stalwart for how roles work.
This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.
Confirming this on 1.0.2 (Docker, RocksDB), upgraded from 1.0.1.
The x:Role/set command from the release notes fails when run by an administrator who has the System Administrator role:
"notUpdated": {"e": {"type": "forbidden", "description": "You are not authorized to grant permissions: sysEncryptionGet ..."}}
As far as I can tell from the source (checked in the source only), an account can only grant permissions it already holds (can_grant_permissions). On an upgraded server, no regular account holds the new permissions. So the only way is the recovery admin, which means stopping the server.
What worked for us:
Stop Stalwart.
Start it once with STALWART_RECOVERY_MODE=1, STALWART_RECOVERY_MODE_PORT and STALWART_RECOVERY_ADMIN.
Run x:Role/set as the recovery admin with the 12 permissions.
Start Stalwart normally.
To find the missing permissions, we compare stalwart-cli describe Permission against the role’s enabledPermissions. We leave out the user-only prefixes jmap, imap, pop3, calendar, email, dav and sieve, which matches the superuser defaults in DefaultPermissions::default(). On a database created with 1.0.1, exactly the 12 new permissions were missing.
Suggestions:
Mention in the release notes that the command needs the recovery admin.
Better: on upgrade, add permissions that are new in a release to the default System Administrator role, so future releases don’t need a manual step.
The recovery admin is the step that’s missing from the release notes. A role update can only grant permissions the account making it already holds, and after the upgrade no regular account holds the new ones, so the admin:PASSWORD in that command only works as the recovery admin’s credentials. The steps @chodid and @luckyshell posted are the way to do it on 1.0.2, and e is the right id when b is your User role.
For later releases the next version adds an environment variable, STALWART_UPDATE_ROLE_PERMISSIONS. With it set to true, startup adds to each default role the permissions introduced since 1.0.0 that a new install would give that role, leaving out any listed in the role’s disabledPermissions. Set it for one restart and remove it afterwards, because while it’s set every start puts back a permission you took out on purpose. Anyone who already ran the x:Role/set command doesn’t need it for these 13.