Remove mosquitto


#1

Hi,

I would like to remove the Mosquito suite: sudo hassbian-config remove mosquitto
It says: Remove function not avaialable for this suite.

How can I remove it?


#2

As user pi

sudo apt remove mosquitto

should do the job


#3

You may also want to remove the clients to mosquitto-clients


#4

No it doesn’t work. The script install tha HA mqtt version to the virtualenv (if I’m right).
I would like to use the apt mosquitto (sudo apt install mosquitto)


#5

Sorry, I don’t understand it.
I would like to remove the broker.


#6

the script does not install to virtualenv it basically uses sudo apt install mosquitto


#7

The virtual environment is a method to ensure all the python packages for a python program match its requirements.

mosquitto is not a python program, so the virtual environment has no effect.

As @ludeeus says, the hassbian script does an apt install and sets up some configuration to avoid you having to do that.


#8

OK.
I read this about embedded broker: https://www.home-assistant.io/docs/mqtt/broker/
I thought this HA own broker inside virtualenv.

Thanks for you fast help.


#9

It is, but sudo hassbian install mosquitto and the embedded broker is not the same thing :slight_smile:


#10

I understand, but not :slight_smile:

In the /etc/apt/sources.list is only deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
If I install with apt install then it us the raspbian repo.
If install with hassbian-config what repo used? (you said " the hassbian script does an apt install")


#11

Both are using the same repo


#12

But something is wrong.
mosquitto -v:
1541609917: mosquitto version 1.5.3 starting
1541609917: Using default config.
1541609917: Opening ipv4 listen socket on port 1883.
1541609917: Error: Address already in use


#13

Most likely you have this in your config with no broker defined:

mqtt:

That will enable the embedded broker.


#14

You probably have another broker running - it may be the HA embedded broker if you have set that up.

And the script hassbian-config uses to install mosquitto is at /opt/hassbian/suites/mosquitto.sh. I just had a look on mine (which is rather old) and it looks like it gets it from the mosquitto.org repository, rather than the debian one. This was necessary at one point, because the raspbian repository was very old, but I’m surprised if it is still being done.


#15

I have no mqtt: in config.yaml


#16

Yes, I think this is the problem.
mosquitto -v: mosquitto version 1.5.3 starting
systemctl status mosquitto: mosquitto.service - LSB: mosquitto MQTT v3.1 message broker


#17

Hassbian-script still uses the mosquitto repo https://github.com/home-assistant/hassbian-scripts/blob/dev/package/opt/hassbian/suites/mosquitto.sh#L53-L60 I though that was changed :thinking:


#18

I removed (apt purge) mosquitto and mosquitto client.

Then:
sudo hassbian-config install mosquitto: mosquitto is already installed or install script is not available…

But I don’t see mosquitto is running.
sudo lsof -i TCP:1883 (not open the port)
systemctl status mosquitto: Unit mosquitto.service could not be found.


#19

sudo hassbian-config install mosquitto --force


#20

It installed, but:
systemctl status mosquitto:
mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
Loaded: loaded (/etc/init.d/mosquitto; generated; vendor preset: enabled)
Active: active (running) since Wed 2018-11-07 18:36:24 CET; 51s ago
Docs: man:systemd-sysv-generator(8)
Process: 3772 ExecStop=/etc/init.d/mosquitto stop (code=exited, status=0/SUCCESS)
Process: 3779 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mosquitto.service
└─3785 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

mosquitto -v:
1541612277: mosquitto version 1.5.3 starting
1541612277: Using default config.
1541612277: Opening ipv4 listen socket on port 1883.
1541612277: Error: Address already in use