Permission denied error with Docker Update Module

@nishad1092 Check that the file exists and that it has the correct permissions with:

stat /home/mende/.docker/config.json

Hi @lluiscampos,

It is the output from ./docker-artifact-gen -n {ARTIFACT_NAME} -t {DEVICE_TYPE} -o {OUTPUT_PATH} {DOCKER_IMAGES}

and the err msg is:
Error loading config file: /home/mender/.docker/config.json: stat /home/mender/.docker/config.json: permission denied
Error response from daemon: Get https://0.azurecr.io/v2/c/local/manifests/4.0.1: unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.

There is a config.json file in that location and also it has a content which mentions:

{
        "auths": {
                "0.azurecr.io": {
                        "auth": "xxxxxxxxxxxxxxxxxxxx"
                }
        },
        "HttpHeaders": {
                "User-Agent": "Docker-Client/19.03.6 (linux)"
        }
}

And it has root root permission for both user and group

I got:

stat: cannot stat ‘/home/mender/.docker/config.json’: Permission denied

It has root permission, Should I change it to mender perm for user and group?

Change the permissions to what ever user you are running as, e.g you can run:

$ id

To find this out. The docker commands in the script are run as a regular user as you can see here. This is why sudo ./docker-artifact-gen ... does not help

Also it is probably best to update your docker permissions so you do not need sudo (which I think is the root problem),

1 Like

Hi @mirzak, @lluiscampos
I changed the permission of that config.json to the current user i use, and I ran

./docker-artifact-gen -n {ARTIFACT_NAME} -t {DEVICE_TYPE} -o {OUTPUT_PATH} {DOCKER_IMAGES}
but I got this error this time,

./docker-artifact-gen: line 116: meta-data.json: Permission denied

Sure do that… Thanks for the info @mirzak

Hi @mirzak,

Thanks for taking this issue as a seperate branch topic.

So this is what I get now. After giving perm to /home/mender/.docker/config.json, the previous error is gone but got this new permission denied.

First time having perm issue while creating a artifact

@nishad1092 Then just remove the old meta-data file with:

sudo rm meta-data.json 

and try again :slight_smile:

Hi @lluiscampos,

I did this, and I ran it again,:
But I got this again:
4.0.1: Pulling from ca/local
Digest: sha256:6a095669f2819b3dcafe3f5bfe70f72c9338d3da390
Status: Image is up to date for 0.azurecr.io/ca/local:4.0.1

Required flag " f" not set

really didnt understand why is this happening?

@nishad1092 Can you post the full command and the bash variables that you are using?

Hi @lluiscampos
Sure,

ARTIFACT_NAME=“cam-update_1.0”
DEVICE_TYPE=“cam_node”
OUTPUT_PATH=“cam-update-1.0.mender”
DOCKER_IMAGES=“0.azurecr.io/cam/local:4.0
./docker-artifact-gen -n {ARTIFACT_NAME} -t {DEVICE_TYPE} -o {OUTPUT_PATH} {DOCKER_IMAGES}

@nishad1092 Aren’t you missing the $ symbols?

ARTIFACT_NAME=“cam-update_1.0”
DEVICE_TYPE=“cam_node”
OUTPUT_PATH=“cam-update-1.0.mender”
DOCKER_IMAGES=“0.azurecr.io/cam/local:4.0”
./docker-artifact-gen -n ${ARTIFACT_NAME} -t ${DEVICE_TYPE} -o ${OUTPUT_PATH} ${DOCKER_IMAGES}

Hi @lluiscampos,

Sorry, I dont know how that went got away in the previous post, Im giving the and passing the variables:

i pasted right into this box, but after saving my reply, the $ vanishes, Sorry for that, I didn’t pay attn. there.

@nishad1092 Mmm. Which version of mender-artifact are you running? Can you do:

mender-artifact --version

and copy here the output?

@lluiscampos,

This is what I see from the output:
mender-artifact version a530ec0

And I have been using Mender since four months, And I followed this article,
https://docs.mender.io/hosted/downloads
So, It must be new one.

I shall try updating the mender-artifact also then , and I’ll give a try.

But I was using this mender-artifact for all my previous releases, using single file, directory update module.

@nishad1092 That is the problem: you are using a buggy mender-artifact. You must have build it locally or get confused somehow…

I manually built the one you are pointing to (git sha a530ec0) and get the exact same error as you (Required flag " f" not set).

From https://docs.mender.io/hosted/downloads you will always download the latest mender-artifact, and when you run --version on it you must have a tag, not a git hash. For example:

$ mender-artifact --version
mender-artifact version 3.4.0

Please download mender-artifact again and retry.

And for future reference, make sure you use verified versions of our tools.

Sure @lluiscampos ,

I will make sure all versions are correct.
But wondering how the system ended up having buggy mender-artifact, and if that is the case how did it work for this long with other update modules,
See, if it had issues with other modules also, then I would have understood to upgrade the mender-artifact. anyways ill do it asap.

When I deploy the release with the docker module, do I need to docker login to my remote device too?