Reputation: 71
I have a weird problem with mosquitto_sub 1.6.14 running on xubuntu 20.02. Everything works fine as long as I don't use certificate files. When using certificate files, I am getting "Error: Problem setting TLS options: File not found." every time. I am using the following commandline:
mosquitto_sub -h test.mosquitto.org -p 8884 -t tengo/bravo --cafile ~/test/mosquitto.org.crt --cert ~/test/returned.crt --key ~/test/client.key
When using the same command line with the same files on a fedora33 machine, everything works fine.
Can anybody help me? Please!
Upvotes: 4
Views: 3723
Reputation: 11
You should manually connect the mosquitto:home plug to snapd home slot, using below command.
sudo snap connect mosquitto:home snapd:home
Upvotes: 1
Reputation: 3241
For me when this error shows up, the problem usually is that I do not have read access to any one of the --cafile, --cert or --key files. Sometimes I have scripts that generate these files in a docker container, with a mounted drive and permissions don't align.
This error is returned when any of these files couldn't be opened. Have a look at the source code here:
https://github.com/eclipse/mosquitto/blob/master/apps/mosquitto_ctrl/options.c#L599 https://github.com/eclipse/mosquitto/blob/master/lib/options.c#L128
Upvotes: 0
Reputation: 71
The root-cause of the problem seems to be the installation via snap. I followed the primary suggestion on https://mosquitto.org/download/ to install via snap, having the mentioned problems.
I found a post in ask-ubuntu where someone had a similar problem, where mosquito worked initially after installing with apt, but did not work anymore when reinstalling with snap.
So I tried to remove the snap installation and followed the secondary installation hints on https://mosquitto.org/download/ to install via apt.
Surprise surprise ... now it works.
Upvotes: 3