EMQ fails to start if run under a different linux user than that which first ran it #842

Open
marriotb opened this Issue Jan 2, 2017 · 1 comment

Projects

None yet

3 participants

@marriotb
marriotb commented Jan 2, 2017

Environment

  • OS: Linux: Ubuntu 16.04 LTS (Xenial Xerus)
  • Erlang/OTP: 7.3
  • EMQ: 2.0.5

Description

Context

I installed EMQ on Ubuntu 16.04 successfully from the 2.0.5 download zip file. It ran fine in both console mode and daemon (./bin/emqttd start) mode, using my normal working Linux userid, and responded appropriately to ./bin/emqttd stop command. So I set up a dedicated linux userid for the daemon to run under and changed the permissions of the emqttd directory appropriately.

Error

I could not get it to start under that userid. It would run in console mode but not as a daemon😖.

Diagnostic information

No error messages were being logged to the ./log directory, and the only process that would start was ./erts-7.3/bin/epmd -daemon. A status query via ./bin/emqttd_ctl simply reported that it wasn't responding to pings.

Initial Resolution

I eventually located a permissions error being logged to the syslog. (run_erl[nnn]: errno=13 'Permission denied'#012Cannot create FIFO /tmp/erl_pipes/emqttd@127.0.0.1/erlang.pipe.2.r for writing.)
Attempts to open files in /tmp/erl_pipes/emqttd@127.0.0.1/ were failing, as this directory existed and was owned by the userid that I had initially used to test-run the software.

Removing that directory provides a work-around for the issue😌.

Suggested enhancement

It looks to me as if ./erts-7.3/bin/run_erl is creating the FIFO directory, but not removing it on exit. This may be by design, as a start-up efficiency measure, or by accident, simply being missed in the clean-up code.

If the latter, the fix is obvious. If the former, it may be enough to catch the error on creation of the FIFO and report it into the crash.log. The frequency of occurrence isn't such that it requires significant coding effort, but some guidance to the user would avoid significant waste of time when it does occur.

Regards
Brian Marriott

@emqplus
Member
emqplus commented Jan 3, 2017

@marriotb Thanks for the detailed issue report. We will improve the installation and release deb and rpm packages later.

@emqplus emqplus changed the title from Emqttd fails to start if run under a different linux user than that which first ran it to EMQ fails to start if run under a different linux user than that which first ran it Jan 11, 2017
@turtleDeng turtleDeng was assigned by emqplus Jan 11, 2017
@emqplus emqplus added BUG Task labels Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment