Cannot start mosquitto with config file

Asked by kamakhyarjun Mishra on 2018-05-09

Hi,

The mosquitto broker 0.15-2ubuntu1.2 works fine with default configuration. However when trying to start the server with config file with command mosquitto -c /etc/mosquitto/mosquitto.conf , we get an error :

(Config file says to log it to the location mentioned below)

Error: Invalid log_dest value (/var/log/mosquitto/mosquitto.log).
Error: Unable to open configuration file.

As it seems to be a permission issues we went ahead and uninstalled the package completely using below commands as a quick fix.

sudo apt-get remove --auto-remove mosquitto

sudo apt-get purge --auto-remove mosquitto

removing all the dependencies and files. Then again installed the package however, this time there was not entries made in var/log directory as there were with the first installation as /var/log/mosquitto/mosquitto.log.

We then manually created the directory and assigned it to the user mosquitto.

At this point there was no group under the name mosquitto, so we created a group mosquitto and assigned the mosquitto user to it, and assigned the /var/log/mosquitto/mosquitto.log directory mosquitto as user and group with commond

sudo chown mosquitto:mosquitto /var/log/mosquitto/mosquitto.log

however we still get the same error :

Error: Invalid log_dest value (/var/log/mosquitto/mosquitto.log).
Error: Unable to open configuration file.

One more thing that i would like to bring to your notice is that is another stand by server we have a fully functioning mosquitto broker running with a conf file.

The output to the command :

find / -group mosquitto

results in below output:

/proc/19211
/proc/19211/task
/proc/19211/task/19211
/proc/19211/task/19211/attr
/proc/19211/net
/proc/19211/attr
find: `/proc/22393/task/22393/fd/5': No such file or directory
find: `/proc/22393/task/22393/fdinfo/5': No such file or directory
find: `/proc/22393/fd/5': No such file or directory
find: `/proc/22393/fdinfo/5': No such file or directory
/var/lib/mosquitto/mosquitto.db
/var/log/mosquitto/mosquitto.log

however on the main server with problem,it give result with nothing in proc directory, as below:

find: `/proc/13525/task/13525/fd/5': No such file or directory
find: `/proc/13525/task/13525/fdinfo/5': No such file or directory
find: `/proc/13525/fd/5': No such file or directory
find: `/proc/13525/fdinfo/5': No such file or directory
/var/log/mosquitto/mosquitto.log
/var/lib/mosquitto/mosquitto.db

Can anyone tell where we messed up even more in order to fix thing.

Regards,

Kamakhyajrun Mishra

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu mosquitto Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

lsb_release -a; uname -a; apt-cache policy mosquitto

Thanks

Revision history for this message
kamakhyarjun Mishra (kamakhyarjun) said :
#2

lsb_release -a; uname -a; apt-cache policy mosquitto results in below:

ubuntu@ip-172-31-20-104:/home/qwerty$ lsb_release -a; uname -a; apt-cache policy mosquitto
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
Linux ip-172-31-20-104 3.13.0-110-generic #157-Ubuntu SMP Mon Feb 20 11:54:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
mosquitto:
  Installed: 0.15-2ubuntu1.2
  Candidate: 1.4.15-0mosquitto1~trusty4
  Version table:
     1.4.15-0mosquitto1~trusty4 0
        500 http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu/ trusty/main amd64 Packages
 *** 0.15-2ubuntu1.2 0
        500 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
        100 /var/lib/dpkg/status
     0.15-2ubuntu1 0
        500 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Then you are using a PPA. I suggest you contact the maintainer and report the issue to them. You aren't using the version from the official Ubuntu repository so we don't know what compile options have been used.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#4

Alternatively, remove the application and the PPA and install the official package. Does that work OK?

Revision history for this message
kamakhyarjun Mishra (kamakhyarjun) said :
#5

Hi , i choose the alternative path and removed the ppa using below command:

sudo ppa-purge ppa:mosquitto-dev/mosquitto-ppa

then removed mosquitto:

sudo apt-get remove --auto-remove mosquitto

sudo apt-get purge --auto-remove mosquitto

then again installed it :

sudo apt-get update
sudo apt-get install mosquitto

Still when running the broker using conf file got the same error:

Error: Invalid log_dest value (/var/log/mosquitto/mosquitto.log).
Error: Unable to open configuration file.

Now running : lsb_release -a; uname -a; apt-cache policy mosquitto, gives below :

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
Linux ip-172-31-20-104 3.13.0-110-generic #157-Ubuntu SMP Mon Feb 20 11:54:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
mosquitto:
  Installed: 0.15-2ubuntu1.2
  Candidate: 0.15-2ubuntu1.2
  Version table:
 *** 0.15-2ubuntu1.2 0
        500 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
        100 /var/lib/dpkg/status
     0.15-2ubuntu1 0
        500 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#6

What is the output of:

cat /var/log/mosquitto/mosquitto.log

Thanks

Revision history for this message
kamakhyarjun Mishra (kamakhyarjun) said :
#7

Hi ,

It empty.

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#8

Does the init script state where the config script is

Revision history for this message
kamakhyarjun Mishra (kamakhyarjun) said :
#9

Hi,

Yes it does, running the mosquitto server with command : sudo /etc/init.d/mosquitto start works fine with log location as none.

to confirm that it ran using the conf file, below is the output of htop:

23834 ? Ss 0:00 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Thanks

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#10

Look in

/etc/mosquitto/mosquitto.conf

Look online for example files and configurations. See how the official packages work. This is more likely than if you use random PPAs

Revision history for this message
kamakhyarjun Mishra (kamakhyarjun) said :
#11

Hi,

For ubuntu it si mentioned on https://mosquitto.org/download/ that "If you are on an earlier version of Ubuntu or want a more recent version of mosquitto, add the mosquitto-dev PPA to your repositories list".

I actually uninstalled everything and installed using ppa and it solved my problem.

now running lsb_release -a; uname -a; apt-cache policy mosquitto gives below result:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
Linux ip-172-31-20-104 3.13.0-110-generic #157-Ubuntu SMP Mon Feb 20 11:54:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
mosquitto:
  Installed: 1.4.15-0mosquitto1~trusty4
  Candidate: 1.4.15-0mosquitto1~trusty4
  Version table:
 *** 1.4.15-0mosquitto1~trusty4 0
        500 http://ppa.launchpad.net/mosquitto-dev/mosquitto-ppa/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status
     0.15-2ubuntu1.2 0
        500 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
     0.15-2ubuntu1 0
        500 http://ap-southeast-1.ec2.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

The difference between earlier and this times result is that installed and candidate both are "1.4.15-0mosquitto1~trusty4", earlier
installed was "0.15-2ubuntu1.2".

I dont know how this is working or why the earlier one was not working, if you can add something please do, and thank you for your prompt responses.

Reards

Can you help with this problem?

Provide an answer of your own, or ask kamakhyarjun Mishra for more information if necessary.

To post a message you must log in.