Skip to content

Diagnosing Issues

Kyle Gabriel edited this page Jan 4, 2018 · 15 revisions

Being experimental software, there may be issues from time to time with the web user interface (frontend) or the daemon (backend). If you are having an issue, such as pages not loading or the daemon not starting, the first thing to do is to look over the logs for anything that resembles an error. Use the timestamps in the logs to identify the spot where the issue occurred. These are the common logs that may give an indication of the issue:

/var/mycodo-root/install/setup.log
/var/log/mycodo/login.log
/var/log/mycodo/mycodo.log
/var/log/apache2/error.log

Next will be to start the frontend and/or the backend in debug mode. This will generate verbose log messages that should give an indication of where the issue is, if not the actual error itself.

Daemon (Backend)

The status of the daemon's service can be checked

sudo service mycodo status

Debug Mode

Ensure the daemon isn't running:

sudo service mycodo stop

Check if the daemon is still running:

ps -C mycodo_daemon.py

If you see the mycodo_daemon.py process running after it was instructed to stop, then we will have to kill it. With the process ID from the ps command, above, enter that number in place of the "0000" in the following command:

sudo kill -9 0000

Execute ps -C mycodo_daemon.py again to verify it has been killed. Remove the lock file:

sudo rm -rf /var/lock/mycodo.pid

Start the daemon in debug mode:

sudo /var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/mycodo_daemon.py --debug

You can monitor the logging output by continuously tailing the log file:

tail -f /var/log/mycodo/mycodo.log

To terminate the daemon, you can use two methods. If the daemon was started with sudo service mycodo start, use sudo service mycodo stop to stop it. If the daemon was started by directly invoking mycodo_daemon.py, as done in the above debug commands, then the following command should be used to terminate the daemon:

/var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/mycodo_client.py --terminate

Flask (Frontend)

If you experience errors while navigating the web interface, you may be presented with a page informing you there's been an error, but not much more information than that. To receive a verbose output that includes a traceback of the error, the web UI will need to be running in debug mode when the error occurs.

Debug Mode

Follow these steps to start the web server in debug mode. Stop nginx that's running the Flask app, which is the web server that hosts the web user interface:

sudo service nginx stop
sudo service mycodoflask stop

Start the web UI in debug mode:

sudo /var/mycodo-root/env/bin/python /var/mycodo-root/mycodo/start_flask_ui.py --debug

The debug log will appear in the terminal. Now attempt to cause the error again, and a more verbose error message should be presented to you.

To stop the web server, use the key combination Ctrl+C in the terminal it is running.