Cannot connect to MQTT after installation #1137

Closed
opened 2026-02-04 23:16:18 +03:00 by OVERLORD · 7 comments
Owner

Originally created by @larsony99 on GitHub (Jun 21, 2025).

Have you read and understood the above guidelines?

yes

📜 What is the name of the script you are using?

MQTT

📂 What was the exact command used to execute the script?

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/mqtt.sh)"

⚙️ What settings are you using?

  • Default Settings
  • Advanced Settings

🖥️ Which Linux distribution are you using?

Debian 12

📝 Provide a clear and concise description of the issue.

Hello all. I am unable to connect to MQTT after installation (from a remote machine). I think it has something to do with the configuration file (/etc/mosquitto/conf.d/default.conf) and the passwd file and/or directory. I'll preface this next part with the fact that I'm pretty new to all of this, so I don't quite understand how we get from A to B, but...

I've found in the actual MQTT installation script that it writes the following to the default.conf file:

cat <<EOF >/etc/mosquitto/conf.d/default.conf
allow_anonymous false
persistence true
password_file /etc/mosquitto/passwd
listener 1883

However, I can see that nothing exists at /etc/mosquitto/passwd:

root@mqtt:/etc/mosquitto# ls
ca_certificates certs conf.d mosquitto.conf

I found passwd in /etc, so I modified the default.conf to that location. I also changed allow_anonymous to true and I added 0.0.0.0 after listener 1883:

allow_anonymous true
persistence true
password_file /etc/passwd
listener 1883 0.0.0.0

However, it still refuses to connect. It does, however, at least start/restart the MQTT service after making the change to the password_file location (before it crashed attempting to read the non-existent /etc/mosquitto/passwd.

I also tried installing MQTT using the default settings, and I'm getting the same results.

I feel like I'm close(?) to figuring out the issue, but can't quite get it. All help is very much appreciated!

🔄 Steps to reproduce the issue.

  • Run the command bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/mqtt.sh)"
  • Attempt to connect from external machine to the server URL (in my case it's 10.69.20.21:1883).

Paste the full error output (if available).

From browser:

This site can’t be reached
The connection was reset.
Try:

ERR_CONNECTION_RESET

🖼️ Additional context (optional).

I've also verified that the port is open:

[user]@Mac ~ % nc -zv 10.69.20.21 1883
Connection to 10.69.20.21 port 1883 [tcp/ibm-mqisdp] succeeded!

Originally created by @larsony99 on GitHub (Jun 21, 2025). ### ✅ Have you read and understood the above guidelines? yes ### 📜 What is the name of the script you are using? MQTT ### 📂 What was the exact command used to execute the script? bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/mqtt.sh)" ### ⚙️ What settings are you using? - [ ] Default Settings - [x] Advanced Settings ### 🖥️ Which Linux distribution are you using? Debian 12 ### 📝 Provide a clear and concise description of the issue. Hello all. I am unable to connect to MQTT after installation (from a remote machine). I think it has something to do with the configuration file (/etc/mosquitto/conf.d/default.conf) and the passwd file and/or directory. I'll preface this next part with the fact that I'm pretty new to all of this, so I don't quite understand how we get from A to B, but... I've found in the actual MQTT installation script that it writes the following to the default.conf file: `cat <<EOF >/etc/mosquitto/conf.d/default.conf` `allow_anonymous false` `persistence true` `password_file /etc/mosquitto/passwd` `listener 1883` However, I can see that nothing exists at /etc/mosquitto/passwd: `root@mqtt:/etc/mosquitto# ls` `ca_certificates certs conf.d mosquitto.conf` I found passwd in /etc, so I modified the default.conf to that location. I also changed `allow_anonymous` to `true` and I added `0.0.0.0` after `listener 1883`: `allow_anonymous true` `persistence true` `password_file /etc/passwd` `listener 1883 0.0.0.0` However, it still refuses to connect. It does, however, at least start/restart the MQTT service after making the change to the `password_file` location (before it crashed attempting to read the non-existent `/etc/mosquitto/passwd`. I also tried installing MQTT using the default settings, and I'm getting the same results. I feel like I'm close(?) to figuring out the issue, but can't quite get it. All help is very much appreciated! ### 🔄 Steps to reproduce the issue. - Run the command `bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/mqtt.sh)"` - Attempt to connect from external machine to the server URL (in my case it's 10.69.20.21:1883). ### ❌ Paste the full error output (if available). From browser: This site can’t be reached The connection was reset. Try: - Checking the connection - [Checking the proxy and the firewall](chrome-error://chromewebdata/#buttons) ERR_CONNECTION_RESET ### 🖼️ Additional context (optional). I've also verified that the port is open: `[user]@Mac ~ % nc -zv 10.69.20.21 1883` `Connection to 10.69.20.21 port 1883 [tcp/ibm-mqisdp] succeeded!`
OVERLORD added the bug label 2026-02-04 23:16:18 +03:00
Author
Owner

@MickLesk commented on GitHub (Jun 21, 2025):

Do you read the linked Post Install Guide? It doesn't look like it.

https://github.com/community-scripts/ProxmoxVE/discussions/782

@MickLesk commented on GitHub (Jun 21, 2025): Do you read the linked Post Install Guide? It doesn't look like it. https://github.com/community-scripts/ProxmoxVE/discussions/782
Author
Owner

@larsony99 commented on GitHub (Jun 21, 2025):

Do you read the linked Post Install Guide? It doesn't look like it.

#782

Yes, I read that. Like I said, /etc/mosquitto/passwd doesn't exist. I don't know enough about Linux/Proxmox to know if I should use that same command with /etc/passwd?

I've tried the following, and this is the output. This link is obviously outdated, and I don't know what to do to fix it.

root@mqtt:~# mosquitto_passwd -c /etc/passwd mosquitto
Password: 
Reenter password: 
Warning: File /etc/passwd has world readable permissions. Future versions will refuse to load this file.
To fix this, use `chmod 0700 /etc/passwd`.Warning: File /etc/passwd owner is not root. Future versions will refuse to load this file.To fix this, use `chown root /etc/passwd`.Warning: File /etc/passwd group is not root. Future versions will refuse to load this file.root@mqtt:~# chmod 0770 /etc/passwd
root@mqtt:~# chown mosquitto:mosquitto /etc/passwd
chown: invalid user: ‘mosquitto:mosquitto’
root@mqtt:~# chown root:mosquitto /etc/passwd
root@mqtt:~# chmod 0640 /etc/passwd
root@mqtt:~# mosquitto_passwd -c /etc/passwd mosquitto
Password: 
Reenter password: 
Warning: File /etc/passwd group is not root. Future versions will refuse to load this file.root@mqtt:~# su mosquitto
su: user mosquitto does not exist or the user entry does not contain all the required fields
root@mqtt:~# systemctl restart mosquitto
Job for mosquitto.service failed because the control process exited with error code.
See "systemctl status mosquitto.service" and "journalctl -xeu mosquitto.service" for details.
root@mqtt:~# lsof -i -P -n | grep LISTEN
systemd   1 root   39u  IPv6 3122621      0t0  TCP *:22 (LISTEN)
sshd    135 root    3u  IPv6 3122621      0t0  TCP *:22 (LISTEN)
master  281 root   13u  IPv4 3123112      0t0  TCP 127.0.0.1:25 (LISTEN)
master  281 root   14u  IPv6 3123113      0t0  TCP [::1]:25 (LISTEN)
root@mqtt:~# systemctl status mosquitto.service
× mosquitto.service - Mosquitto MQTT Broker
     Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sat 2025-06-21 12:33:15 EDT; 5min ago
   Duration: 2h 56min 2.321s
       Docs: man:mosquitto.conf(5)
             man:mosquitto(8)
    Process: 328 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS)
    **Process: 329 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=1/FAILURE)
        CPU: 2ms**

Jun 21 12:33:15 mqtt systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5.
Jun 21 12:33:15 mqtt systemd[1]: Stopped mosquitto.service - Mosquitto MQTT Broker.
Jun 21 12:33:15 mqtt systemd[1]: mosquitto.service: Start request repeated too quickly.
Jun 21 12:33:15 mqtt systemd[1]: mosquitto.service: Failed with result 'exit-code'.
Jun 21 12:33:15 mqtt systemd[1]: Failed to start mosquitto.service - Mosquitto MQTT Broker.
root@mqtt:~# sudo groupadd mosquitto
groupadd: group 'mosquitto' already exists
root@mqtt:~# sudo useradd mosquitto
useradd: group mosquitto exists - if you want to add this user to that group, use -g.
root@mqtt:~# sudo usermod -a -G mosquitto mosquitto
usermod: user 'mosquitto' does not exist
root@mqtt:~# sudo adduser mosquitto mosquitto
adduser: The user `mosquitto' does not exist.
root@mqtt:~# sudo useradd mosquitto
useradd: group mosquitto exists - if you want to add this user to that group, use -g.

I've tried everything I could find on Google to add a user, and the above is what I'm getting^

@larsony99 commented on GitHub (Jun 21, 2025): > Do you read the linked Post Install Guide? It doesn't look like it. > > [#782](https://github.com/community-scripts/ProxmoxVE/discussions/782) Yes, I read that. Like I said, `/etc/mosquitto/passwd` doesn't exist. I don't know enough about Linux/Proxmox to know if I should use that same command with `/etc/passwd`? I've tried the following, and this is the output. This link is obviously outdated, and I don't know what to do to fix it. ``` root@mqtt:~# mosquitto_passwd -c /etc/passwd mosquitto Password: Reenter password: Warning: File /etc/passwd has world readable permissions. Future versions will refuse to load this file. To fix this, use `chmod 0700 /etc/passwd`.Warning: File /etc/passwd owner is not root. Future versions will refuse to load this file.To fix this, use `chown root /etc/passwd`.Warning: File /etc/passwd group is not root. Future versions will refuse to load this file.root@mqtt:~# chmod 0770 /etc/passwd root@mqtt:~# chown mosquitto:mosquitto /etc/passwd chown: invalid user: ‘mosquitto:mosquitto’ root@mqtt:~# chown root:mosquitto /etc/passwd root@mqtt:~# chmod 0640 /etc/passwd root@mqtt:~# mosquitto_passwd -c /etc/passwd mosquitto Password: Reenter password: Warning: File /etc/passwd group is not root. Future versions will refuse to load this file.root@mqtt:~# su mosquitto su: user mosquitto does not exist or the user entry does not contain all the required fields root@mqtt:~# systemctl restart mosquitto Job for mosquitto.service failed because the control process exited with error code. See "systemctl status mosquitto.service" and "journalctl -xeu mosquitto.service" for details. root@mqtt:~# lsof -i -P -n | grep LISTEN systemd 1 root 39u IPv6 3122621 0t0 TCP *:22 (LISTEN) sshd 135 root 3u IPv6 3122621 0t0 TCP *:22 (LISTEN) master 281 root 13u IPv4 3123112 0t0 TCP 127.0.0.1:25 (LISTEN) master 281 root 14u IPv6 3123113 0t0 TCP [::1]:25 (LISTEN) root@mqtt:~# systemctl status mosquitto.service × mosquitto.service - Mosquitto MQTT Broker Loaded: loaded (/lib/systemd/system/mosquitto.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Sat 2025-06-21 12:33:15 EDT; 5min ago Duration: 2h 56min 2.321s Docs: man:mosquitto.conf(5) man:mosquitto(8) Process: 328 ExecStartPre=/bin/mkdir -m 740 -p /var/log/mosquitto (code=exited, status=0/SUCCESS) **Process: 329 ExecStartPre=/bin/chown mosquitto:mosquitto /var/log/mosquitto (code=exited, status=1/FAILURE) CPU: 2ms** Jun 21 12:33:15 mqtt systemd[1]: mosquitto.service: Scheduled restart job, restart counter is at 5. Jun 21 12:33:15 mqtt systemd[1]: Stopped mosquitto.service - Mosquitto MQTT Broker. Jun 21 12:33:15 mqtt systemd[1]: mosquitto.service: Start request repeated too quickly. Jun 21 12:33:15 mqtt systemd[1]: mosquitto.service: Failed with result 'exit-code'. Jun 21 12:33:15 mqtt systemd[1]: Failed to start mosquitto.service - Mosquitto MQTT Broker. root@mqtt:~# sudo groupadd mosquitto groupadd: group 'mosquitto' already exists root@mqtt:~# sudo useradd mosquitto useradd: group mosquitto exists - if you want to add this user to that group, use -g. root@mqtt:~# sudo usermod -a -G mosquitto mosquitto usermod: user 'mosquitto' does not exist root@mqtt:~# sudo adduser mosquitto mosquitto adduser: The user `mosquitto' does not exist. root@mqtt:~# sudo useradd mosquitto useradd: group mosquitto exists - if you want to add this user to that group, use -g. ``` I've tried everything I could find on Google to add a user, and the above is what I'm getting^
Author
Owner

@MickLesk commented on GitHub (Jun 21, 2025):

The File will be generated after First command, my LXC work fine.

Maybe because you use mosquitto. My User is mqtt / mqtt_admin and mqtt_watcher

@MickLesk commented on GitHub (Jun 21, 2025): The File will be generated after First command, my LXC work fine. Maybe because you use mosquitto. My User is mqtt / mqtt_admin and mqtt_watcher
Author
Owner

@larsony99 commented on GitHub (Jun 21, 2025):

The File will be generated after First command, my LXC work fine.

Maybe because you use mosquitto. My User is mqtt / mqtt_admin and mqtt_watcher

Nope, I'm still getting the invalid user error now:

root@mqtt:~# mosquitto_passwd -c /etc/mosquitto/passwd mosquitto
Password: 
Reenter password: 
root@mqtt:~# chown mosquitto:mosquitto /etc/mosquitto/passwd
chown: invalid user: ‘mosquitto:mosquitto’
root@mqtt:~# mosquitto_passwd -c /etc/mosquitto/passwd mqtt
Password: 
Reenter password: 
root@mqtt:~# chown mqtt:mosquitto /etc/mosquitto/passwd
chown: invalid user: ‘mqtt:mosquitto’
root@mqtt:~# 
root@mqtt:~# mosquitto_passwd -c /etc/mosquitto/passwd mqtt_admin
Password: 
Reenter password: 
root@mqtt:~# chown mqtt_admin:mosquitto /etc/mosquitto/passwd
chown: invalid user: ‘mqtt_admin:mosquitto’
root@mqtt:~# 
@larsony99 commented on GitHub (Jun 21, 2025): > The File will be generated after First command, my LXC work fine. > > Maybe because you use mosquitto. My User is mqtt / mqtt_admin and mqtt_watcher Nope, I'm still getting the invalid user error now: ``` root@mqtt:~# mosquitto_passwd -c /etc/mosquitto/passwd mosquitto Password: Reenter password: root@mqtt:~# chown mosquitto:mosquitto /etc/mosquitto/passwd chown: invalid user: ‘mosquitto:mosquitto’ root@mqtt:~# mosquitto_passwd -c /etc/mosquitto/passwd mqtt Password: Reenter password: root@mqtt:~# chown mqtt:mosquitto /etc/mosquitto/passwd chown: invalid user: ‘mqtt:mosquitto’ root@mqtt:~# root@mqtt:~# mosquitto_passwd -c /etc/mosquitto/passwd mqtt_admin Password: Reenter password: root@mqtt:~# chown mqtt_admin:mosquitto /etc/mosquitto/passwd chown: invalid user: ‘mqtt_admin:mosquitto’ root@mqtt:~# ```
Author
Owner

@MickLesk commented on GitHub (Jun 21, 2025):

Can you try with sudo?

Or maybe recreate the LXC?

@MickLesk commented on GitHub (Jun 21, 2025): Can you try with sudo? Or maybe recreate the LXC?
Author
Owner

@larsony99 commented on GitHub (Jun 22, 2025):

Can you try with sudo?

Or maybe recreate the LXC?

I'm already root user; I can try to recreate it, but I'm not sure it will be any different.

root@mqtt:~# sudo mosquitto_passwd -c /etc/mosquitto/passwd mosquitto
Password: 
Reenter password: 
root@mqtt:~# sudo chown mosquitto:mosquitto /etc/mosquitto/passwd
chown: invalid user: ‘mosquitto:mosquitto’
root@mqtt:~# chown mosquitto:mosquitto /etc/mosquitto/passwd
chown: invalid user: ‘mosquitto:mosquitto’
root@mqtt:~# sudo mosquitto_passwd -c /etc/mosquitto/passwd mqtt_admin
Password: 
Reenter password: 
Error: Passwords do not match.
root@mqtt:~# sudo mosquitto_passwd -c /etc/mosquitto/passwd mqtt_admin
Password: 
Reenter password: 
root@mqtt:~# chown mqtt_admin:mosquitto /etc/mosquitto/passwd
chown: invalid user: ‘mqtt_admin:mosquitto’
root@mqtt:~# chown mosquitto :mosquitto /etc/mosquitto/passwd
chown: invalid user: ‘mosquitto’
@larsony99 commented on GitHub (Jun 22, 2025): > Can you try with sudo? > > Or maybe recreate the LXC? I'm already root user; I can try to recreate it, but I'm not sure it will be any different. ``` root@mqtt:~# sudo mosquitto_passwd -c /etc/mosquitto/passwd mosquitto Password: Reenter password: root@mqtt:~# sudo chown mosquitto:mosquitto /etc/mosquitto/passwd chown: invalid user: ‘mosquitto:mosquitto’ root@mqtt:~# chown mosquitto:mosquitto /etc/mosquitto/passwd chown: invalid user: ‘mosquitto:mosquitto’ root@mqtt:~# sudo mosquitto_passwd -c /etc/mosquitto/passwd mqtt_admin Password: Reenter password: Error: Passwords do not match. root@mqtt:~# sudo mosquitto_passwd -c /etc/mosquitto/passwd mqtt_admin Password: Reenter password: root@mqtt:~# chown mqtt_admin:mosquitto /etc/mosquitto/passwd chown: invalid user: ‘mqtt_admin:mosquitto’ root@mqtt:~# chown mosquitto :mosquitto /etc/mosquitto/passwd chown: invalid user: ‘mosquitto’ ```
Author
Owner

@MickLesk commented on GitHub (Jun 23, 2025):

so ive tested it with an new proxmox VM:

Image

mosquitto_passwd -c /etc/mosquitto/passwd test_user
PW
PW

=> Done

Image

@MickLesk commented on GitHub (Jun 23, 2025): so ive tested it with an new proxmox VM: ![Image](https://github.com/user-attachments/assets/161d6a60-8ac1-4b0b-858c-85ae699d8393) mosquitto_passwd -c /etc/mosquitto/passwd test_user PW PW => Done ![Image](https://github.com/user-attachments/assets/11a02293-f6e2-4ced-8a7a-35833d30d0eb)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ProxmoxVE#1137