MAAS Build Failed: make snap/sync-dev-snap failed to generate snap metadata in MAAS 3.1.0

Hi Team,

We are using the latest MAAS and tried to build using make snap and sync-dev-snap, both commands failed with the below error.

Failed to generate snap metadata: The specified command ‘bin/maas-power’ defined in the app ‘power’ does not exist.
Ensure that ‘bin/maas-power’ is installed with the correct path.

We could see the power app mentioned under the apps section in snapcraft.yaml file

power:
command: bin/maas-power
plugs:
- network

Could you please check and let us know the reason for the failure and provide a solution or workaround?

Regards,
Rohit

Hi @rkarna,

let’s start checking some common mistakes:

  1. what is the Ubuntu version in the host you are building MAAS? (must be Focal for 3.1)
  2. did you installed the dependencies first? (make install-dependencies)

if the build setup is sane, we need to look at the build logs and check for errors.

Hi Alexsander-souza,

Thanks for the reply. Please find the answers below.

  1. what is the Ubuntu version in the host you are building MAAS? (must be Focal for 3.1)
    rkarna@ubuntu2004:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 20.04.3 LTS
    Release: 20.04
    Codename: focal

  2. did you installed the dependencies first? (make install-dependencies)
    Yes

I am collecting the build logs, will post the errors.

Regards,
Rohit

Hi Alexsander-souza,

I executed make snap and found only the below error at two places
ERROR: launchpadlib 1.10.13 requires testresources, which is not installed.

But the build did not stop there and failed at
Failed to generate snap metadata: The specified command ‘bin/maas-power’ defined in the app ‘power’ does not exist.

If I am not wrong the launchpadlib was expecting testresources already installed in the snap image.

Is the build failed because of the above error?

I want to provide the complete build log, but I don’t see any option to add attachments.

Could you please let me know how to proceed.

Regards,
Rohit

you can use pastebin to share the logs: https://paste.ubuntu.com/

Hi Alexsander-souza,

I have pasted the complete build log in the below link. Could you please have a look and let me know if anything more is required.
https://paste.ubuntu.com/p/PWD2Xqkrpp/

Regards,
Rohit

It seems that snapcraft 6.0 was released recently and it triggered a regression in our build environment. We are working on a fix.

Meanwhile you can revert to the previous snapcraft version:

sudo snap refresh snapcraft --channel=5.x/stable

EDIT: the fix has just landed in the git repository

Hi Alexsander-Souza,

I have reverted to the previous snapcraft version but still encountered the same error.
I have pasted the complete build log in the below link.
https://paste.ubuntu.com/p/SPyBw3Hs3M/

Could you please provide the git repository link which has the fix, I’ll install it and try to build MAAS with snap.

Regards,
Rohit

the fix is in the master branch.

What branch are you using?

I am using master branch, i did git pull before the build, Just now i cross verified and the fix is present in the snapcraft.yaml file. I will delete and download the code and build again.

Hi Alexsander-Souza,

I have the latest code with the fix unfortunately still got the same error.
Could you please confirm if you are able to build?

I tried a change in the snapcrat.yaml file and I am able to build and install.
Here is the change, I commented the PYTHONPATH
# - PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$SNAP/usr/lib/python3.8/dist-packages

Regards,
Rohit

I’m still looking at this. I have found that it fails when PYTHONPATH is defined AND the python3-pip package is installed. In this case pip is not installed in the virtualenv and snapcraft uses the host binary, which installs modules in the wrong path.

I’m discussing with the team what is the best fix for this (removing the path or correcting its definition).

Hi all,

I am having the exact same problem.
Any update on this thread?

I commented out the PYTHONPATH bits and make still fails with the same error:
Failed to generate snap metadata: The specified command ‘bin/maas-power’ defined in the app ‘power’ does not exist.
Ensure that ‘bin/maas-power’ is installed with the correct path.
make: *** [Makefile:406: snap] Error 2

Thanks,
Jay