Cannot upload custom image: Errno 13 - Permission denied

Dear sirs,

I set up a lab to test MaaS features. My lab environment is made up by 2 VM:

  • 1 region + rack server: MaaS 2.7.0 (snap install) on Ubuntu 18.04
  • 1 rack server: MaaS 2.7.0 (snap install) on Ubuntu 18.04

I was able to:

  • enlisten, commission and deploy other VM with default Ubuntu image
  • enlisten, commission and deploy a bare-metal HP DL380 G9 with default Ubuntu image
  • upload a custom Ubuntu image to MaaS server (by MaaS cli)

Now I’m experimenting with Windows images. I built one using Windows Openstack Imaging Tools by Cloudbase (https://github.com/cloudbase/windows-openstack-imaging-tools).

The creation of the boot resource failed with the following error:

root@maaslab:~# maas admin boot-resources create name=custom/win2012r2 architecture=amd64/generic content@=./win-image.tar.gz
usage: maas [-h] COMMAND ...

optional arguments:
  -h, --help      show this help message and exit

drill down:
  COMMAND
    login         Log in to a remote API, and remember its description and
                  credentials.
    logout        Log out of a remote API, purging any stored credentials.
    list          List remote APIs that have been logged-in to.
    refresh       Refresh the API descriptions of all profiles.
    init          Initialize controller.
    config        View or change controller configuration.
    status        Status of controller services.
    migrate       Perform migrations on connected database.
    apikey        Used to manage a user's API keys. Shows existing keys unless
                  --generate or --delete is passed.
    configauth    Configure external authentication.
    createadmin   Create a MAAS administrator account.
    changepassword
                  Change a MAAS user's password.
    admin         Interact with http://192.168.92.14:5240/MAAS/api/2.0/

http://maas.io/

[Errno 13] Permission denied: './win-image.tar.gz'

I checked the win image permissions, they’re ok.

root@maaslab:~# ll win-image.tar.gz
-rw-rw-rw- 1 nais nais 4584711754 Apr 24 18:15 win-image.tar.gz
root@maaslab:~#

I did not find anything useful in maas.log, regiond.log and rackd.log. Does anyone have any suggestion?

Thanks in advance,

)+(au

you might try moving the image to the home directory for the owning user? it might not be able to read root…

Hi, Billwear.

Thanks so much for your suggestion.

you might try moving the image to the home directory for the owning user?

It actually is in the owner home dir!
The image I was playing with is chmod 666 (readable and writable by everyone), so there should be no reason (apparently) for root to fail due to a “permission denied” error.

Anyway you pointed me to the right direction. After your post I started reasoning about file ownership. So I tried to run maas-cli as the user owner of the image (not as root) and this time the image start loading. Now I am blocked because of a file-system full, but this is another story.

I learned that:

  • maas-cli commands could be run by any user that is able log into MaaS as admin, not just root
  • for some reason I cannot tell, it is required to run the “maas admin boot-resources create ...” command as the user owner of the image file to upload, does not matter what permission had the file

Is it right?

Regards, )+(auloop

P.S.: in my examples I used “maas admin ...” since admin is the only profile defined in my lab, but probably it should not make difference if working with any other profile

@mauloop, you’re basically right. glad you got it working. and good thinking!