LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Distributions (https://www.linuxquestions.org/questions/linux-distributions-5/)
-   -   Trying to get MQTT broker on Alpine running => keeps crashing (https://www.linuxquestions.org/questions/linux-distributions-5/trying-to-get-mqtt-broker-on-alpine-running-%3D-keeps-crashing-4175733847/)

Peterken 02-14-2024 04:56 AM

Trying to get MQTT broker on Alpine running => keeps crashing
 
Hi, I'm trying to get Eclipse MQTT broker to work in a Alpine Linux LXC (on Proxmox).

I'm not very skilled with Linux, use it now with a Debian LXC because there is just more information about Debian.
Recently I discovered Alpine, managed to get WireGuard running on it and I'm very surprised of the speed/small footprint.
So now I'm trying to do the same with MQTT but I'm struggling for hours and hours to get it working and cannot find a lot of information about this combo.

Any help to get this working is highly appreciated!
P.

business_kid 02-14-2024 05:04 AM

Ok, I've replied. Now we use the information you provide in most cases to diagnose your problem(s). You've given us nothing, so that ends there.

What's your pc spec & distro? It's on github, so how did the compile go? Errors? What errors (copy & paste message or log snippet)

Peterken 02-14-2024 05:32 AM

Hi, thanks for jumping in!

I do not have much details since I don't know that much about Linux, and even less about Alpine.
Do you think that my HW has a role in this issue?
My Proxmox is up-to-date with Bookworm and the LXC Alpine v3.19.1

As you can see from the link that I posted, there is a package for mosquitto, so I didn't compile it myself.

business_kid 02-14-2024 06:50 AM

What have you done, and what goes wrong? Describe how you got the package installed, and what it said when you tried to run it. What's mosquito? What's Alpine? What installer do they use? I'm going away if I can't get some sense of what your problem. Read post #2 again. Then answer my questions.

Peterken 02-14-2024 05:00 PM

Quote:

Originally Posted by business_kid (Post 6483514)
What have you done,

Installed Eclipse MQTT broker

Quote:

Originally Posted by business_kid (Post 6483514)
and what goes wrong?

From the topic title: Keeps crashing

Quote:

Originally Posted by business_kid (Post 6483514)
Describe how you got the package installed,

'apk add mosquitto'

Quote:

Originally Posted by business_kid (Post 6483514)
and what it said when you tried to run it.

Nothing, just found out that the service has the crashed state

Quote:

Originally Posted by business_kid (Post 6483514)
What's mosquito?

'Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.'

Quote:

Originally Posted by business_kid (Post 6483514)
What's Alpine?

First line of my OP: 'Alpine Linux'

Quote:

Originally Posted by business_kid (Post 6483514)
What installer do they use?

Dunno

Quote:

Originally Posted by business_kid (Post 6483514)
I'm going away if I can't get some sense of what your problem. Read post #2 again. Then answer my questions.

Quote:

Originally Posted by business_kid (Post 6483514)
What's your pc spec & distro? It's on github, so how did the compile go? Errors? What errors (copy & paste message or log snippet)

Pc spec: it's an i5, but since it's a virtual environment I think it's of no importance.
Distro: from my OP, Proxmox (Debian based), Alpine Linux container.

business_kid 02-15-2024 06:28 AM

Don't decide for me what's important or not. In a virtual environment, The assigned cores, ram, swap & disk space could all be important.

Find the main binary or binaries, probably in /usr/bin. Then run
Code:

ldd /path/to/binary |grep found
The correct output shoule be nothing.

Then run the main binary or it's startup script by hand in a terminal, and post any output that comes up.

Peterken 02-16-2024 05:50 AM

So I have nailed it down.

The pid file could not be written because of a directory not being created.
I created it manually with:
Code:

sudo mkdir /var/run/mosquitto/ && sudo chown mosquitto: /var/run/mosquitto
and when I restart the service, everything works!

But, after a reboot this directory gets deleted.
Any idea why this happens?

business_kid 02-16-2024 12:04 PM

Good.

As for the directory, probably everything in /var/run is deleted during shutdown in case there's some stray stuff hanging about. So why not recreate it in rc.local or some other startup script?
Code:

install -o mosquitto -d /var/run/mosquitto
Er, on 2nd thoughts, better create the directory before running mosquitto :redface:


All times are GMT -5. The time now is 11:27 AM.