thingsboard-edge icon indicating copy to clipboard operation
thingsboard-edge copied to clipboard

[Question] Permission denied at installation using docker

Open Xwoder opened this issue 2 years ago • 10 comments

Component

  • Installation

Description Error Message

Error response from daemon: error while creating mount source path '/host_mnt/home/shft/.mytb-edge-data/db': mkdir /host_mnt/home/shft/.mytb-edge-data/db: permission denied

Command in terminal

sudo rm -rf ~/.mytb-edge-data/
sudo rm -rf ~/.mytb-edge-logs/

mkdir -p ~/.mytb-edge-data && sudo chown -R 799:799 ~/.mytb-edge-data
mkdir -p ~/.mytb-edge-logs && sudo chown -R 799:799 ~/.mytb-edge-logs

docker-compose-edge.yml

version: '2.2'
services:
  mytbedge:
    restart: always
    image: "thingsboard/tb-edge:3.4.1EDGE"
    ports:
      - "18080:8080"
      - "11883:1883"
      - "15683-15688:5683-5688/udp"
    environment:
      SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/tb-edge
      CLOUD_ROUTING_KEY: PUT_YOUR_EDGE_KEY_HERE # e.g. 19ea7ee8-5e6d-e642-4f32-05440a529015
      CLOUD_ROUTING_SECRET: PUT_YOUR_EDGE_SECRET_HERE # e.g. bztvkvfqsye7omv9uxlp
      CLOUD_RPC_HOST: PUT_YOUR_CLOUD_IP # e.g. 192.168.1.250 or demo.thingsboard.io
    volumes:
      - ~/.mytb-edge-data:/data
      - ~/.mytb-edge-logs:/var/log/tb-edge
  postgres:
    restart: always
    image: "postgres:12"
    ports:
      - "5432"
    environment:
      POSTGRES_DB: tb-edge
      POSTGRES_PASSWORD: postgres
    volumes:
      - ~/.mytb-edge-data/db:/var/lib/postgresql/data

Environment

  • OS: Ubuntu 22.04.1 LTS
  • ThingsBoard: 3.4.1
  • Browser: Microsoft Edge

Xwoder avatar Aug 25 '22 02:08 Xwoder

@Xwoder please execute next commands and provide your output: ls -lah ~ | grep .mytb ls -lah ~/.mytb-edge-logs/ ls -lah ~/.mytb-edge-data/

You should see something similar: image

volodymyr-babak avatar Aug 25 '22 09:08 volodymyr-babak

@volodymyr-babak

shft@shft-server:~$ ls -lah ~ | grep .mytb
drwxr-xr-x  2  799  799 4.0K  7月 11 12:47 .mytb-data
drwxrwxr-x  2  799  799 4.0K  8月 25 17:26 .mytb-edge-data
drwxrwxr-x  2  799  799 4.0K  8月 25 17:26 .mytb-edge-logs
drwxr-xr-x  2  799  799 4.0K  7月 11 12:47 .mytb-logs
shft@shft-server:~$ ls -lah ~/.mytb-edge-logs/
总用量 8.0K
drwxrwxr-x  2  799  799 4.0K  8月 25 17:26 .
drwxr-x--- 48 shft shft 4.0K  8月 25 17:27 ..
shft@shft-server:~$ ls -lah ~/.mytb-edge-data/
总用量 8.0K
drwxrwxr-x  2  799  799 4.0K  8月 25 17:26 .
drwxr-x--- 48 shft shft 4.0K  8月 25 17:27 ..

Xwoder avatar Aug 25 '22 09:08 Xwoder

Any update on this issue? I'm facing the same error

gustavovelascoh avatar Sep 20 '22 14:09 gustavovelascoh

Hello @gustavovelascoh

Could you please provide your OS and docker versions?

volodymyr-babak avatar Sep 21 '22 14:09 volodymyr-babak

Hi @volodymyr-babak, here is the info

Ubuntu running in a virtual machine:

PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian

Docker

Client: Docker Engine - Community
 Version:           20.10.18
 API version:       1.41
 Go version:        go1.18.6
 Git commit:        b40c2f6
 Built:             Thu Sep  8 23:11:43 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.18
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.6
  Git commit:       e42327a
  Built:            Thu Sep  8 23:09:30 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.8
  GitCommit:        9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Something I noticed is that "docker" group ID is 999, but from the installation guide 799 is used. It might not be relevant, though.

gustavovelascoh avatar Sep 21 '22 14:09 gustavovelascoh

@Xwoder @gustavovelascoh I updated my laptop ubuntu from 20.04 to 22.04 and I am still not able to reproduce this issue. The docker version is 20.10.18, so the same as yours. I suspect that problem is somewhere in the file system permissions. I'm going to try to do the same by installing VirtualBox and setup there Ubuntu 22.04.

@Xwoder do you use a virtual machine for Ubuntu 22.04? If yes, please provide next additional information:

  • What is your host operations system?
  • what virtual machine software are you using - VirtualBox or some other? Please provide a version of the software as well.
  • Please provide a screenshot of your virtual machine configuration for the Ubuntu 22.04 image.

@gustavovelascoh please provide the next additional information:

  • What is your host operations system?
  • what virtual machine software are you using - VirtualBox or some other? Please provide a version of the software as well.
  • Please provide a screenshot of your virtual machine configuration for the Ubuntu 22.04 image.

Thanks

volodymyr-babak avatar Sep 24 '22 14:09 volodymyr-babak

@Xwoder @gustavovelascoh I updated my laptop ubuntu from 20.04 to 22.04 and I am still not able to reproduce this issue. The docker version is 20.10.18, so the same as yours. I suspect that problem is somewhere in the file system permissions. I'm going to try to do the same by installing VirtualBox and setup there Ubuntu 22.04.

@Xwoder do you use a virtual machine for Ubuntu 22.04? If yes, please provide next additional information:

  • What is your host operations system?
  • what virtual machine software are you using - VirtualBox or some other? Please provide a version of the software as well.
  • Please provide a screenshot of your virtual machine configuration for the Ubuntu 22.04 image.

@gustavovelascoh please provide the next additional information:

  • What is your host operations system?
  • what virtual machine software are you using - VirtualBox or some other? Please provide a version of the software as well.
  • Please provide a screenshot of your virtual machine configuration for the Ubuntu 22.04 image.

Thanks

@akseerali could you please follow up with @volodymyr-babak on the info required?

gustavovelascoh avatar Sep 26 '22 11:09 gustavovelascoh

@volodymyr-babak

Host operations system

  • Device specifications image

  • Windows specifications image

Virtual machine software: Oracle VirtualBox image

Virtual machine configuration image

image

image

image

image

image

akseerali avatar Sep 26 '22 12:09 akseerali

@akseerali Thanks for the screenshots. Could you please provide screenshots for Storage and Shared Folders as well?

volodymyr-babak avatar Sep 26 '22 12:09 volodymyr-babak

@volodymyr-babak,

Update

I have found that our issue is different from the issue specified on this thread. The TB Edge instance was unable to access the PostgreSQL container. Everything was working fine few days ago until it started giving the following errors:

Screenshot from 2022-09-26 13-28-00

Screenshot from 2022-09-26 13-25-35

In my first testing, I was using the static IP address by configuring in the docker compose file that was working fine; however, I am not sure why it's no longer working. I tried to remove the static IP configuration but didn't work.

Now, after creating the containers from scratch and removing the IP configuration, everything seems to work fine. Though I am still unable to use the static IP configuration and receiving the same error in the second screenshot. Please find below the configuration I used while testing with static network configuration. Right now, I have just excluded the configuration for IP and everything is working fine.

`version: '2.2' services: mytbedge: restart: always image: "thingsboard/tb-edge:3.4.0EDGE" ports: - "18080:8080" - "11883:1883" - "15683-15688:5683-5688/udp" environment: SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/tb-edge CLOUD_ROUTING_KEY: # insert routing key CLOUD_ROUTING_SECRET: # e.g. bztvkvfqsye7omv9uxlp CLOUD_RPC_HOST: demo.thingsboard.io volumes: - ~/.mytb-edge-data:/data - ~/.mytb-edge-logs:/logs networks: customnetwork: ipv4_address: 172.25.25.5

postgres: restart: always image: "postgres:12" ports: - "5432" environment: POSTGRES_DB: tb-edge POSTGRES_PASSWORD: postgres volumes: - ~/.mytb-edge-data/db:/var/lib/postgresql/data networks: customnetwork: ipv4_address: 172.25.25.6 networks: customnetwork: driver: bridge ipam: config: - subnet: 172.25.25.0/24 gateway: 172.25.25.1`

akseerali avatar Sep 26 '22 13:09 akseerali