Evok Web does not Start



  • Hi all,

    I own a Neuron M103 and had it up and running as a test some months ago. Now I was going to update everything and start over.

    So I uninstalled existing Evok (dunno which version it was), updated Debian and installed current Evok version.
    I did (as root):

    wget https://github.com/UniPiTechnology/evok/archive/master.zip
    unzip master.zip
    cd evok-master
    ./install-evok.sh
    

    I answered the queations properly and made sure I entered port 80 and port 8080 so there is no conflict.

    I rebooted my Neuron and it appears Evok was installed, but is running only partially. I cannot access the web interface on port 80.

    root@zentrale:~/evok-master# netstat -anp|grep LIST
    tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      432/python
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      566/sshd
    tcp        0      0 0.0.0.0:502             0.0.0.0:*               LISTEN      438/neuron_tcp_serv
    tcp6       0      0 :::8080                 :::*                    LISTEN      432/python
    tcp6       0      0 :::22                   :::*                    LISTEN      566/sshd
    

    I checked evok.log but there is nothing in it which helps me to figure out what is going wrong.

    Traceback (most recent call last):
      File "/opt/evok/neuron.py", line 217, in scan_boards
        yield self.modbus_cache_map.do_scan()
    AttributeError: 'NoneType' object has no attribute 'do_scan'
    2017-11-20 12:27:10,385 - evok - ERROR - 'NoneType' object has no attribute 'do_scan'
    Traceback (most recent call last):
      File "/opt/evok/neuron.py", line 217, in scan_boards
        yield self.modbus_cache_map.do_scan()
    

    Anyone having an idea what is wrong here?

    Thanks!


  • administrators

    Could you please post the content of your

    sudo cat /boot/config.txt
    

    ,

    sudo lsmod
    

    ,

    sudo i2cdetect 1
    

    and

    sudo cat /sys/bus/i2c/devices/1-0057/eeprom
    

    ?

    It looks like the installation did not succeed for some reason; using a clean image should fix it, but if that's not an option we can try and fix it manually.

    It's likely that some remaining files prevent the i2c EEPROM from working properly.



  • Hi,

    sorry for the delay. I will use a fresh image and retry.

    But so far the content you asked for:

    # For more options and information see
    # http://rpf.io/configtxtreadme
    # Some settings may impact device functionality. See link above for details
    
    # uncomment if you get no picture on HDMI for a default "safe" mode
    #hdmi_safe=1
    
    # uncomment this if your display has a black border of unused pixels visible
    # and your display can output without overscan
    #disable_overscan=1
    
    # uncomment the following to adjust overscan. Use positive numbers if console
    # goes off screen, and negative if there is too much border
    #overscan_left=16
    #overscan_right=16
    #overscan_top=16
    #overscan_bottom=16
    
    # uncomment to force a console size. By default it will be display's size minus
    # overscan.
    #framebuffer_width=1280
    #framebuffer_height=720
    
    # uncomment if hdmi display is not detected and composite is being output
    #hdmi_force_hotplug=1
    
    # uncomment to force a specific HDMI mode (this will force VGA)
    #hdmi_group=1
    #hdmi_mode=1
    
    # uncomment to force a HDMI mode rather than DVI. This can make audio work in
    # DMT (computer monitor) modes
    #hdmi_drive=2
    
    # uncomment to increase signal to HDMI, if you have interference, blanking, or
    # no display
    #config_hdmi_boost=4
    
    # uncomment for composite PAL
    #sdtv_mode=2
    
    #uncomment to overclock the arm. 700 MHz is the default.
    #arm_freq=800
    
    # Uncomment some or all of these to enable the optional hardware interfaces
    #dtparam=i2c_arm=on
    #dtparam=i2s=on
    #dtparam=spi=on
    
    # Uncomment this to enable the lirc-rpi module
    #dtoverlay=lirc-rpi
    
    # Additional overlays and parameters are documented /boot/overlays/README
    
    # Enable audio (loads snd_bcm2835)
    dtparam=audio=on
    
    #Enable i2c bus 1
    device_tree_param=i2c1=on
    
    #Enable UniPi Neuron SPI overlay
    dtoverlay=neuron-spi
    

    lsmod:

    Module                  Size  Used by
    bnep                   12051  2
    hci_uart               20020  1
    btbcm                   7916  1 hci_uart
    bluetooth             365511  22 hci_uart,bnep,btbcm
    brcmfmac              222874  0
    brcmutil                9092  1 brcmfmac
    cfg80211              543027  1 brcmfmac
    rfkill                 20851  4 bluetooth,cfg80211
    snd_bcm2835            24427  0
    snd_pcm                98501  1 snd_bcm2835
    spidev                  7373  4
    snd_timer              23968  1 snd_pcm
    snd                    70032  3 snd_timer,snd_bcm2835,snd_pcm
    i2c_bcm2835             7167  1009
    spi_bcm2835             7596  0
    bcm2835_gpiomem         3940  0
    uio_pdrv_genirq         3923  0
    fixed                   3285  0
    uio                    10204  1 uio_pdrv_genirq
    rtc_ds1307             13908  0
    hwmon                  10552  1 rtc_ds1307
    at24                    7587  0
    nvmem_core             13774  1 at24
    i2c_bcm2708             5994  0
    i2c_dev                 6913  2018
    fuse                   99603  1
    ipv6                  408971  32
    

    i2cdetect

    WARNING! This program can confuse your I2C bus, cause data loss and worse!
    I will probe file /dev/i2c-1.
    I will probe address range 0x03-0x77.
    Continue? [Y/n]
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 6f
    70: -- -- -- -- -- -- -- --
    

    cat

    cat /sys/bus/i2c/devices/1-0057/eeprom
    cat: /sys/bus/i2c/devices/1-0057/eeprom: File or Directory not found
    


  • I'm having similar issues with a fresh install of UniPian-Neuron-OS-2017-11-21.zip from https://files.unipi.technology/s/public?path=%2FSoftware%2FOpen-Source Images . UniPi control panel does not diplay devices and the log of evok starting shows this:

    2017-11-27 06:33:51,904 - evok - ERROR - 'NoneType' object has no attribute 'do_scan'
    Traceback (most recent call last):
    File "/opt/evok/neuron.py", line 217, in scan_boards
    yield self.modbus_cache_map.do_scan()
    AttributeError: 'NoneType' object has no attribute 'do_scan'
    2017-11-27 06:33:52,407 - evok - ERROR - 'NoneType' object has no attribute 'do_scan'
    Traceback (most recent call last):
    File "/opt/evok/neuron.py", line 217, in scan_boards
    yield self.modbus_cache_map.do_scan()
    AttributeError: 'NoneType' object has no attribute 'do_scan'

    I found an similar issue from here:

    https://forum.unipi.technology/topic/99/evok-service-startup-problem-during-cold-boot

    Also similar issue here:

    https://forum.unipi.technology/topic/488/internal-error-500-after-fresh-evok-installation/8

    If I do an restart of the service evok right after Pi boots (with service evok restart), then it will not work, it does not recognice inputs and outputs. If I wait for a while and then do an restart, then it works ?


  • administrators

    @Henkka
    Hi Henkka!

    The error you are seeing (which is indeed unfortunately very common) is due to missing I2C drivers - this then prevents EVOK from recognising the Neuron (hence the none error, the error message has been improved in the latest Master/2.0.1 release). Unfortunately the only solution is to install a newer image.

    I have just now tested again the 11/24 image on Neuron, and it should have the correct drivers installed; we have deleted the other images from our public downloads server. Apologies for any confusion.



  • @tomas_knot Hi,

    Thanks for reply!

    Is there any way to upgrade existing previous image installation, even by hand installing packages or getting an new evok from git etc. ? We have quite a few other packages installed and configured already to our device that should be soon in production and it would be great if there is an way to upgrade without re-install.


  • administrators

    The following conditions must be met in order for EVOK to work:

    1. The neurontcp service must be running and not failing (systemctl status neurontcp)
    2. /boot/config.txt must contain the following commands:
    #Enable i2c bus 1
    device_tree_param=i2c1=on
    dtoverlay=i2c-rtc,mcp7941x
    dtoverlay=unipiee
    dtoverlay=neuronee
    
    1. /etc/modules must contain the following line:
    i2c-dev
    
    1. OWFS must be installed and enabled
    2. the correct overlays must be present in /boot/overlays ( the overlays are listed here)
    3. NGINX must be running and configured correctly
    4. Finally the evok service must be running and have a correct configuration file (the default one should work fine)

    It's possible that one of the above steps has been interfered with somehow. The 11/21 image shouldn't be particularly different from the 11/24 one, the only changes really concern CODESYS.

    It's difficult to know what exactly has gone wrong; if you provide the additional debug information requested above we might be able to figure what exactly it is. The only thing that the error messages says is that the I2C drivers are not loaded correctly, which can be caused by any number of things, usually the I2C being misconfigured somehow (I2C-dev being turned off is the most common culprit).

    The error has nothing to do with the EVOK application, and using any other version will not help. (though the very latest version has a shorter and more specific error message) The issue lies in system configuration, which is unfortunately rather fragile.



  • @tomas_knot
    Hi, thanks for the reply

    1. check, ok.
    2. I'm missing device_tree_param. I have only lines below active, this is standard from evok-installation sd-image, from what I can recall we haven't modified this file.
    /boot/config.txt active lines:
    
    gpu_mem=32
    dtparam=i2c_arm=on,watchdog=on
    dtoverlay=i2c-rtc,mcp7941x
    dtoverlay=neuron-spi-new
    dtoverlay=neuronee
    core_freq=250
    dtoverlay=pi3-disable-bt
    

    For me, it is working if we restart the evok service but not directly after reboot of the pi.


  • administrators

    @Henkka

    The device_tree_param is equivalent to "dtparam=i2c_arm=on", so that should work fine.

    It's possible that the I2C module gets loaded after EVOK starts. This may be caused by the startup workload changing significantly. One option would be setting a delay for the EVOK systemctl script, i.e. by adding

      [Service]
      ExecStartPre=/bin/sleep 15
    

    to it (/etc/systemd/system/evok.service).

    Otherwise your config file looks fine.

    @knebb
    It seems that your config file is missing the EEPROM overlays.



  • @tomas_knot

    Hello, thanks for the reply.

    Still no luck but few logbook entries what I have tried so far.

    This is now my /etc/systemd/system/evok.service:

    [Unit]
    Description=Evok Modbus/Websocket/Rpc Server
    #Requires=pigpio.service
    Requires=neurontcp.service
    
    [Service]
    ExecStartPre=/bin/sleep 15
    Type=simple
    ExecStart=/usr/bin/python /opt/evok/evok.py
    TimeoutStopSec=3
    SyslogLevel=debug
    SyslogIdentifier=evok
    StandardOutput=null
    WorkingDirectory=/opt/evok
    
    #User=evok
    #Group=evok
    
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
    #Alias=evok.service
    
    

    but still no luck, it still doesn't want to start the evok web-configuration and/or evok software at the boot of the pi.

    I then added even more time, 30 seconds, and logged into Pi right after boot via ssh. From logs I can definitely verify that evok is trying to start after 30 seconds and this is what we get as a first rows in evok.log:

    2017-11-27 15:42:19,697 - evok - ERROR - 'model'
    Traceback (most recent call last):
      File "/opt/evok/neuron.py", line 180, in readboards
        yield board.parse_definition(self.hw_dict, i)
      File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run
        value = future.result()
      File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result
        raise_exc_info(self._exc_info)
      File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 307, in wrapper
        yielded = next(result)
      File "/opt/evok/neuron.py", line 560, in parse_definition
        if defin and defin['type'] in config.globals['model']:
    KeyError: 'model'
    
    

    I tried to restart evok service but it didn't this time help either.

    So I went on to check other services you mentioned and saw that every time I try to restart evok service, I get following lines to nginx error.log:

    2017/11/27 15:51:35 [error] 587#587: *22 connect() failed (111: Connection refused) while connecting to upstream, client: 10.73.73.205, server: _, request: "GET /ws HTTP/1.1", upstream: "http://[::1]:8080/ws", host: "10.73.73.237"
    2017/11/27 15:51:35 [error] 587#587: *22 connect() failed (111: Connection refused) while connecting to upstream, client: 10.73.73.205, server: _, request: "GET /ws HTTP/1.1", upstream: "http://127.0.0.1:8080/ws", host: "10.73.73.237"
    2017/11/27 15:51:36 [error] 587#587: *25 no live upstreams while connecting to upstream, client: 10.73.73.205, server: _, request: "GET /ws HTTP/1.1", upstream: "http://localhost/ws", host: "10.73.73.237"
    2017/11/27 15:51:37 [error] 587#587: *26 connect() failed (111: Connection refused) while connecting to upstream, client: 10.73.73.205, server: _, request: "GET /ws HTTP/1.1", upstream: "http://127.0.0.1:8080/ws", host: "10.73.73.237"
    2017/11/27 15:51:37 [error] 587#587: *26 connect() failed (111: Connection refused) while connecting to upstream, client: 10.73.73.205, server: _, request: "GET /ws HTTP/1.1", upstream: "http://[::1]:8080/ws", host: "10.73.73.237"
    2017/11/27 15:51:38 [error] 587#587: *29 no live upstreams while connecting to upstream, client: 10.73.73.205, server: _, request: "GET /ws HTTP/1.1", upstream: "http://localhost/ws", host: "10.73.73.237"
    

    Don't know if this matters or not.

    Finally, I managed to get it running again by restarting nginx and restarting evok. I can certainly test any other remedies you come up if needed.


  • administrators

    The thing that seems the most odd is that restarting helps - the error message really just indicates that EVOK couldn't read the I2C EEPROM, which is done via SYSFS (i.e. simply opening and reading the file referenced below). As for the network errors, they simply mean that NGINX cannot connect to EVOK.

    Could you try to see if the file

    /sys/bus/i2c/devices/1-0057/eeprom
    

    exists?



  • @tomas_knot

    Hi,

    Thanks, I think now it's clear.

    Right after boot I tried multiple times same command, with only few seconds in between;

    Results are somehow changing;

    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    Binary file /sys/bus/i2c/devices/1-0057/eeprom matches
    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    Binary file /sys/bus/i2c/devices/1-0057/eeprom matches
    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    Binary file /sys/bus/i2c/devices/1-0057/eeprom matches
    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    

    See how last 3 lines there is suddenly no eeprom available ? So something fishy about i2c bus perhaps.

    I then went on to think about connecting oscilloscope to see what's going on and what we have done so far. When thinking about where to connect it, it hit me - we have an external 7" Pi LCD connected to Raspberry Pi Display connector and it has those 2 extra SDA and SCL pins... Could they be reason for this... They are there for A and B model Pi's that don't have these integrated to display-cable and as this is version 3 Pi, they should not be connected as those are routed via display cable. So I disconnected them and after boot so far it has performed flawlessly!

    Below are results of the same "test" as above, this time results are all predictable and ok, every time there is an eeprom device on the bus.

    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    Binary file /sys/bus/i2c/devices/1-0057/eeprom matches
    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    Binary file /sys/bus/i2c/devices/1-0057/eeprom matches
    pi@f:~ $ sudo grep M503 /sys/bus/i2c/devices/1-0057/eeprom
    Binary file /sys/bus/i2c/devices/1-0057/eeprom matches
    

    So, this was my error, not thinking that connection of LCD could anyway be in part of this... Sorry about that.

    But many thanks for your excellent support! For me at least, I think the issue is now solved (fingers crossed...).