Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Unable to open password file #3022

Open
Luky12568 opened this issue Mar 22, 2024 · 9 comments
Open

Error: Unable to open password file #3022

Luky12568 opened this issue Mar 22, 2024 · 9 comments

Comments

@Luky12568
Copy link

So i tried running sudo docker run eclipse-mosquitto:2 mosuitto_passwd -b ~/chirpstack-docker/configuration/mosquitto/config/passwd (username) (passwd) and it throws Error: Unable to open password file /home/(user)/chirpstack-docker/configuration/mosquitto/config/passwd. No such file or directory. Is there any easy fix? I am runninng it on docker with chirpstack on Fedora. Any help appreciated

@hardillb
Copy link
Contributor

It's unlikely that path exists inside the container. That path is likely mapped to /mosquitto/config/passwd inside the container

@Luky12568
Copy link
Author

Luky12568 commented Mar 28, 2024

I am using docker-compose up and everything else reads fine from there, i can nano to it

@Daedaluz
Copy link
Contributor

Can you post compose file?

@Luky12568
Copy link
Author

How?

@hardillb
Copy link
Contributor

Copy and paste the content on the file

Wrap the pasted text in triple back ticks e.g.

```
version: 3.1
...
```

@Luky12568
Copy link
Author

version: "3"

services:
  chirpstack:
    image: chirpstack/chirpstack:4
    command: -c /etc/chirpstack
    restart: unless-stopped
    volumes:
      - ./configuration/chirpstack:/etc/chirpstack
      - ./lorawan-devices:/opt/lorawan-devices
    depends_on:
      - postgres
      - mosquitto
      - redis
    environment:
      - MQTT_BROKER_HOST=192.168.180.23
      - REDIS_HOST=redis
      - POSTGRESQL_HOST=postgres
    ports:
      - 8080:8080

  chirpstack-gateway-bridge:
    image: chirpstack/chirpstack-gateway-bridge:4
    restart: unless-stopped
    ports:
      - 1700:1700/udp
    volumes:
      - ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
    environment:
      - INTEGRATION__MQTT__EVENT_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/event/{{ .EventType }}
      - INTEGRATION__MQTT__STATE_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/state/{{ .StateType }}
      - INTEGRATION__MQTT__COMMAND_TOPIC_TEMPLATE=eu868/gateway/{{ .GatewayID }}/command/#
    depends_on:
      - mosquitto

  chirpstack-gateway-bridge-basicstation:
    image: chirpstack/chirpstack-gateway-bridge:4
    restart: unless-stopped
    command: -c /etc/chirpstack-gateway-bridge/chirpstack-gateway-bridge-basicstation-eu868.toml
    ports:
      - 3001:3001
    volumes:
      - ./configuration/chirpstack-gateway-bridge:/etc/chirpstack-gateway-bridge
    depends_on:
      - mosquitto

  chirpstack-rest-api:
    image: chirpstack/chirpstack-rest-api:4
    restart: unless-stopped
    command: --server chirpstack:8080 --bind 0.0.0.0:8090 --insecure
    ports:
      - 8090:8090
    depends_on:
      - chirpstack

  postgres:
    image: postgres:14-alpine
    restart: unless-stopped
    volumes:
      - ./configuration/postgresql/initdb:/docker-entrypoint-initdb.d
      - postgresqldata:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=root

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    command: redis-server --save 300 1 --save 60 100 --appendonly no
    volumes:
      - redisdata:/data

  mosquitto:
    image: eclipse-mosquitto:2
    restart: unless-stopped
    ports:
      - 1883:1883
      - 8883:8883
    volumes:
      - ./configuration/mosquitto/config/:/mosquitto/config/

volumes:
  postgresqldata:
  redisdata:

@Luky12568
Copy link
Author

chirpstack_as:g9nJcDXPgMs3Bf

@Luky12568
Copy link
Author

  1. docker-compose.yml
  2. passwd file

@hardillb
Copy link
Contributor

hardillb commented Apr 1, 2024

OK, as I mentioned the path you passed to the command is the path on the host machine, not inside the running container. The command you should actually be running is going to be something like

docker run -it chirpstack-docker-mosquitto-0 mosquitto_passwd -b  /mosquitto/config/passwd [username] [password]

This breaks down to

  • -it tells docker to assign an interactive terminal to the command
  • -chirpstack-docker-mosquitto-0 the name of the running instance of the container (I've assumed you didn't use the -p option when running docker compose up
  • mosquitto_passwd the command to run
  • /mosquitto/config/passwd the path to the file inside the container. This is because ./configuration/mosquitto/config/ is mounted on path /mosquitto/config/ from the volumes section of the mosquitto section of the docker-compose.yml file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants