Error: snap "maas" is not available on ... but is available to install on the following

I have MaaS 2.7 installed and want to upgrade it. How to upgrade a snap to MAAS 3.2 says sudo snap refresh --channel=3.2 maas should do it. But that command does not work:

root@bds-maas:~# snap refresh --channel=3.2 maas
error: snap "maas" is not available on 3.2/stable but is available to install on the following
       channels:

       3.2/candidate  snap refresh --channel=3.2/candidate maas
       3.2/beta       snap refresh --channel=3.2/beta maas
       3.2/edge       snap refresh --channel=3.2/edge maas

       Please be mindful pre-release channels may include features not completely tested or
       implemented. Get more information with 'snap info maas'.

Ok, let’s see what versions are available:

root@bds-maas:~# snap info maas
name:      maas
summary:   Metal as a Service
publisher: Canonical✓
store-url: https://snapcraft.io/maas
contact:   https://discourse.maas.io/
license:   unset
description: |
  Total automation of your physical servers for amazing data center operational efficiency.
commands:
  - maas
services:
  maas.supervisor: simple, enabled, active
snap-id:      shY22YTZ3RhJJDOj0MfmShTNZTEb1Jiq
tracking:     2.7/stable/ubuntu-20.04
refresh-date: today at 13:00 +07
channels:
  3.2/stable:       3.2.2-12005-g.f0f96fa78        2022-08-08 (23178) 147MB -
  3.2/candidate:    ↑                                                       
  3.2/beta:         3.2.0~beta6-11974-g.58f181df4  2022-06-06 (21449) 147MB -
  3.2/edge:         3.2.2-12005-g.f0f96fa78        2022-08-08 (23178) 147MB -
  latest/stable:    –                                                       
  latest/candidate: –                                                       
  latest/beta:      –                                                       
  latest/edge:      3.3.0~alpha1-12504-g.d0ebf6fb3 2022-08-08 (23186) 128MB -
  3.1/stable:       3.1.0-10901-g.f1f8f1505        2022-04-13 (19835) 144MB -
  3.1/candidate:    3.1.0-10901-g.f1f8f1505        2022-08-09 (23190) 144MB -
  3.1/beta:         ↑                                                       
  3.1/edge:         3.1.0-10907-g.3d0a11b51        2022-07-12 (22645) 145MB -
  3.0/stable:       3.0.0-10029-g.986ea3e45        2022-01-27 (18309) 142MB -
  3.0/candidate:    3.0.0-10029-g.986ea3e45        2022-08-09 (23191) 143MB -
  3.0/beta:         ↑                                                       
  3.0/edge:         3.0.0-10038-g.034590735        2021-11-03 (17223) 142MB -
  2.9/stable:       2.9.2-9165-g.c3e7848d1         2021-04-16 (12555) 149MB -
  2.9/candidate:    ↑                                                       
  2.9/beta:         2.9.3~beta2-9199-g.6e6ee4dcd   2021-09-02 (16249) 143MB -
  2.9/edge:         2.9.3~beta2-9200-g.43e4a0607   2021-09-06 (16325) 143MB -
  2.8/stable:       2.8.7-8610-g.4a04daa43         2021-09-16 (16381) 135MB -
  2.8/candidate:    2.8.7-8610-g.4a04daa43         2021-09-16 (16381) 135MB -
  2.8/beta:         ↑                                                       
  2.8/edge:         2.8.8-8612-g.1cff37b3c         2022-03-30 (19459) 136MB -
  2.7/stable:       2.7.3-8290-g.ebe2b9884         2020-08-21  (8724) 144MB -
  2.7/candidate:    ↑                                                       
  2.7/beta:         ↑                                                       
  2.7/edge:         2.7.3-8297-g.68a767295         2021-02-16 (11806) 143MB -
installed:          2.7.3-8290-g.ebe2b9884                     (8724) 144MB -

Weird, 3.2/stable should be available. Well, 3.2/edge is the same version as 3.2/stable and 3.2/edge shows up in the list of the first command, so let’s try that:

root@bds-maas:~# snap refresh --channel=3.2/edge maas
error: snap "maas" is not available on 3.2/edge but is available to install on the following
       tracks:

       latest/candidate  snap refresh --candidate maas
       latest/beta       snap refresh --beta maas
       latest/edge       snap refresh --edge maas
       3.1/stable        snap refresh --channel=3.1 maas
       3.1/candidate     snap refresh --channel=3.1/candidate maas
       3.1/beta          snap refresh --channel=3.1/beta maas
       3.1/edge          snap refresh --channel=3.1/edge maas
       3.0/stable        snap refresh --channel=3.0 maas
       3.0/candidate     snap refresh --channel=3.0/candidate maas
       3.0/beta          snap refresh --channel=3.0/beta maas
       3.0/edge          snap refresh --channel=3.0/edge maas
       2.9/stable        snap refresh --channel=2.9 maas
       2.9/candidate     snap refresh --channel=2.9/candidate maas
       2.9/beta          snap refresh --channel=2.9/beta maas
       2.9/edge          snap refresh --channel=2.9/edge maas
       2.8/stable        snap refresh --channel=2.8 maas
       2.8/candidate     snap refresh --channel=2.8/candidate maas
       2.8/beta          snap refresh --channel=2.8/beta maas
       2.8/edge          snap refresh --channel=2.8/edge maas
       2.7/stable        snap refresh --channel=2.7 maas
       2.7/candidate     snap refresh --channel=2.7/candidate maas
       2.7/beta          snap refresh --channel=2.7/beta maas
       2.7/edge          snap refresh --channel=2.7/edge maas

       Please be mindful that different tracks may include different features. Get more information
       with 'snap info maas'.

Now all the 3.2 versions are missing from the output.

What am I doing wrong? I tried to search for that "error: snap "maas" is not available onbut is available to install on the following" error message but couldn’t find the solution.

I’ve also tried refresh with --stable, that did not work either:

root@bds-maas:~# snap refresh --stable maas 
maas (2.7/stable) 2.7.3-8290-g.ebe2b9884 from Canonical✓ refreshed

Hi @tobias.pal,

It seems the snapd database is stale or somewhat corrupted. The snap info maas output also shows some strange values, like the unset license instead of the usual AGPL-3.0

what’s the output of snap version ?

@alexsander-souza @tobias.pal , I had similar issues upgrading from 2.8, I ended up installing a fresh ubuntu 22.04 box and installed 3.2. I don’t think I tried step wise upgrades, ie. going from 2.7 to 2.8 to 2.9 to … perhaps you’ll have luck with that. It appears though that some people might be having issues on 3.2 (I know I am and I’ve seen at least one other issue in the forums as well, plus a critical bug fixed recently), so you may want to stay at 3.0 or 3.1 and avoid 3.2 for now. I was running 3.0 without issues but snap auto-upgraded me to 3.2.1 6 days ago and 3.2.2 today.

root@bds-maas:~# snap version
snap    2.56.2
snapd   2.56.2
series  16
ubuntu  20.04
kernel  5.4.0-122-generic

I ran into something similar when I installed maas using sudo apt install maas.

My resolution was to uninstall everything (I took a backup first) then reinstall using the snap method, then I was able to get maas 3.2 working. I also didn’t reload the backup because I’d done some stuff wrong in the first place, so a fresh start was called for.

Now things are working well on the latest MAAS for me.

I hope that helps.

Thnaks

~~ Charles

I have the same problem with another maas deployment, upgrading 2.9 to 3.2. Same snap version as above with a slightly newer kernel:

kernel 5.4.0-125-generic

I was able to upgrade on Ubuntu 18 from 2.9 to 3.1 without issues. Then I upgraded my OS to 20.04 and tried to issue another upgrade from 3.1 to 3.2 and it is failing due to the age of the database

$ sudo snap refresh --channel=3.2/stable maas
Setup snap "maas" (23425) security profiles                                                                                                                                                                /Setup snap "maas" (23425) security profiles                                                                                                                                                                -
error: cannot perform the following tasks:
- Run post-refresh hook of "maas" snap if present (run hook "post-refresh":
-----
Traceback (most recent call last):
  File "/snap/maas/23425/bin/maas-region", line 8, in <module>
    sys.exit(run())
  File "/snap/maas/23425/lib/python3.8/site-packages/maasserver/region_script.py", line 77, in run
    run_django(is_snap, is_devenv)
  File "/snap/maas/23425/lib/python3.8/site-packages/maasserver/region_script.py", line 66, in run_django
    management.execute_from_command_line()
  File "/snap/maas/23425/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/snap/maas/23425/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/snap/maas/23425/usr/lib/python3/dist-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/snap/maas/23425/usr/lib/python3/dist-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/snap/maas/23425/lib/python3.8/site-packages/maasserver/management/commands/dbupgrade.py", line 110, in handle
    raise UnsupportedDBException(pg_ver)
maasserver.plugin.UnsupportedDBException: Unsupported postgresql server version (100006) detected
Traceback (most recent call last):
  File "/snap/maas/23425/bin/maas", line 8, in <module>
    sys.exit(main())
  File "/snap/maas/23425/lib/python3.8/site-packages/maascli/__init__.py", line 39, in main
    options.execute(options)
  File "/snap/maas/23425/lib/python3.8/site-packages/maascli/snap.py", line 448, in __call__
    raise exc
  File "/snap/maas/23425/lib/python3.8/site-packages/maascli/snap.py", line 445, in __call__
    self.handle(options)
  File "/snap/maas/23425/lib/python3.8/site-packages/maascli/snap.py", line 943, in handle
    sys.exit(migrate_db())
  File "/snap/maas/23425/lib/python3.8/site-packages/maascli/snap.py", line 353, in migrate_db
    subprocess.check_call(
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/snap/maas/23425/bin/maas-region', 'dbupgrade']' returned non-zero exit status 1.
-----)

Hey, @james-o-benson,

Based on the error message you provided in that last post, it seems that the upgrade from MAAS 3.1 to 3.2 is failing due to an unsupported version of the PostgreSQL server. And, of course, by now, we’re on 3.3; sorry so long getting back to you, maybe this will still help.

The error message indicates – of course – that the detected PostgreSQL server version is 100006, which is not supported by MAAS 3.2. To proceed with the upgrade, you will need to upgrade the PostgreSQL server to a supported version.

To upgrade the PostgreSQL server, you probably know the drill:

  1. Backup your MAAS database to ensure you have a safe copy of your data.
  2. Check the official PostgreSQL documentation or relevant resources for instructions on upgrading your PostgreSQL server to a supported version.
  3. Once the PostgreSQL server is upgraded, you can attempt the MAAS upgrade to version 3.2 using the following command:
sudo snap refresh --channel=3.2/stable maas

This command will attempt to upgrade the MAAS snap to version 3.2.

Please note that upgrading the PostgreSQL server can be a complex process, and it’s essential to have proper backups and follow the documentation and guidelines provided by the PostgreSQL community.

If you encounter any specific issues or need further assistance during the PostgreSQL upgrade or MAAS upgrade process, please provide more details, and I’ll be glad to help you further. Also tell me if you got it resolved: I hate when these posts hang out there for months at a time. :slight_smile: Good luck!