Internal Server Error (Error 500) in the Monitoring tool panel

Dear community,

I am new to YunoHost application and really enjoy it so far. It allows me to use and learn quite much on many different aspects namely OS and web app based on the use of a VPS.

I have an Internal Server Error (Error 500), displayed on the overlayed console panel in the YunoHost administration interface, when trying to reach the Monitoring tool panel.

I may have broken some configuration while trying things with Docker, that I installed, removed, reinstalled, as well as created images and deleting them (I tried other web apps that are not packed for YunoHost so far, and also wanted to learn more about Docker). However my knowledge of nginx and both YunoHost and Docker is very limited so far, that’s why I am asking you for help (but I am eager to learn, really).

Here is the output of the Diagnosis tool:

{
    "host": "Debian 8.5",
    "kernel": "3.16.0-4-amd64",
    "packages": {
        "yunohost": "2.4.0.7",
        "yunohost-admin": "2.4.0.1",
        "moulinette": "2.4.0.1",
        "ssowat": "2.6.0"
    },
    "system": {
        "disks": {
            "vda1": "Mounted on /, 19.7GiB (15.9GiB free)"
        },
        "memory": {
            "ram": "3.8GiB (3.3GiB free)",
            "swap": "0B (0B free)"
        }
    },
    "services": {
        "udisks2": "inactive (not-found)",
        "supervisor": "running (enabled)",
        "nsswitch": "inactive (not-found)",
        "fail2ban": "running (enabled)",
        "yunohost-api": "running (enabled)",
        "mysql": "running (enabled)",
        "glances": "running (enabled)",
        "rspamd": "running (enabled)",
        "transmission-daemon": "running (enabled)",
        "rmilter": "running (enabled)",
        "shellinabox": "running (enabled)",
        "avahi-daemon": "running (enabled)",
        "dovecot": "running (enabled)",
        "php5-fpm": "running (enabled)",
        "nslcd": "running (enabled)",
        "ssl": "inactive (not-found)",
        "ssh": "running (enabled)",
        "redis-server": "running (enabled)",
        "metronome": "running (enabled)",
        "nginx": "running (enabled)",
        "postfix": "running (enabled)",
        "yunohost-firewall": "running (disabled)",
        "container-dockerrstudio": "inactive (not-found)",
        "dnsmasq": "running (enabled)",
        "docker": "running (enabled)",
        "slapd": "running (enabled)"
    },
    "applications": {
        "dockerui": "DockerUI",
        "transmission": "Transmission",
        "jirafeau": "Jirafeau",
        "strut": "Strut",
        "ttrss": "Tiny Tiny RSS",
        "zerobin": "Zerobin",
        "owncloud": "OwnCloud",
        "shellinabox": "Shell In A Box",
        "kanboard": "Kanboard",
        "wallabag": "Wallabag",
        "dockerrstudio": "RStudio Container"
    }
}

Please let me know what type of information would be helpful to fix the issue.

Thanks,

I have checked the network connections and routing tables for the port 6787 with netstat -lapute | grep 6787 and obtained that python is incriminated with a PID leading to the yunohost-api binary.
In /var/log/yunohost/yunohost-api.log, this is confirmed with the following entries:

2016-07-12 17:50:22,266 INFO     moulinette.actionsmap process - processing action [14032.371]: yunohost.user.list
2016-07-12 17:50:22,268 INFO     geventwebsocket.handler log_request - 127.0.0.1 - - [2016-07-12 17:50:22] "GET /users?locale=en HTTP/1.1" 200 375 0.017174
2016-07-12 17:50:29,190 INFO     moulinette.actionsmap process - processing action [14032.372]: yunohost.service.status
2016-07-12 17:50:29,226 INFO     geventwebsocket.handler log_request - 127.0.0.1 - - [2016-07-12 17:50:29] "GET /services/glances?locale=en HTTP/1.1" 200 182 0.051073
2016-07-12 17:50:29,289 INFO     moulinette.actionsmap process - processing action [14032.373]: yunohost.monitor.system
2016-07-12 17:50:29,557 INFO     geventwebsocket.handler log_request - 127.0.0.1 - - [2016-07-12 17:50:29] "GET /monitor/system?locale=en HTTP/1.1" 500 901 0.288725

Then, firstly stopped the yunohost-api service manually (instead of killing the process since the api would restart automatically), secondly I restarted with the debug option, and finally I reproduced the error on the YunoHost web interface by going to Tools, Monitoring. Here is the debug output:

# yunohost-api --debug
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/lib/python2.7/dist-packages/bottle.py", line 1729, in wrapper
    rv = callback(*a, **ka)
  File "/usr/lib/python2.7/dist-packages/moulinette/interfaces/api.py", line 672, in wrapper
    return callback(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/moulinette/interfaces/api.py", line 258, in wrapper
    return callback((request.method, context.rule), params)
  File "/usr/lib/python2.7/dist-packages/moulinette/interfaces/api.py", line 380, in process
    ret = self.actionsmap.process(arguments, route=_route)
  File "/usr/lib/python2.7/dist-packages/moulinette/actionsmap.py", line 467, in process
    return func(**arguments)
  File "/usr/lib/moulinette/yunohost/monitor.py", line 286, in monitor_system
    result[u] = (str(datetime.now() - datetime.fromtimestamp(psutil.BOOT_TIME)).split('.')[0])
AttributeError: 'module' object has no attribute 'BOOT_TIME'

In fact, the above python error can also obtained directly with following commands:

  • # yunohost monitor system
  • # yunohost monitor update-stats 'day'

I hope these complementary information can help solving the problem!

Regards

I have finally edited line 286 in /usr/lib/moulinette/yunohost/monitor.py, changing psutil.BOOT_TIME to psutil.boot_time(), as documented on the python psutil package documentation.

This fixes the error after restarting the yunohost-api service.

I don’t know why this error suddenly occurred. Maybe the psutil package – or moulinette – got updated, into a version which supports the function psutil.boot_time() rather than the attribute psutil.BOOT_TIME. Currently on my VPS, Python 2.7.9 runs psutil 4.1.0.

Problem solved!