MySensors GW on rpi3



  • I have installed a new image on a rpi3 and followed the installation guide for getting the GW installed - ethernet selected.
    When I run "sudo ./bin/mysgw" i receive these messages:

    Sep 28 13:14:14 ERROR accept: Bad file descriptor
    Sep 28 13:14:14 ERROR accept: Bad file descriptor
    Sep 28 13:14:14 ERROR accept: Bad file descriptor
    Sep 28 13:14:14 ERROR accept: Bad file descriptor
    Sep 28 13:14:14 ERROR accept: Bad file descriptor

    What does this mean?


  • Mod

    @Kurtsejr what configure command did you use?
    Were there any warnings or errors during make?
    What image are you using?



  • I used the "Raspberry pi OS (32 bit) from 2022-09-22

    on configure I used
    sudo ./configure --my-gateway=ethernet
    could see that port 5003 and rf24 was default

    My controller is HA, but the error messages was of cause from



  • Used --rf24 I get:

    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=BCM2837, Type=rpi3, CPU=armv7l.
    [SECTION] Detecting SPI driver.
    [OK] SPI driver detected:BCM.
    [SECTION] Gateway configuration.
    [OK] Type: ethernet.
    [OK] Transport: rf24.
    [OK] Signing: Disabled.
    [OK] Encryption: Disabled.
    [OK] CPPFLAGS: -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI
    [OK] CXXFLAGS: -std=c++11
    [SECTION] Detecting init system.
    [OK] Init system detected: systemd.
    [SECTION] Saving configuration.
    [OK] Saved.
    [SECTION] Cleaning previous builds.
    [OK] Finished.

    Seems fine for me



  • Sorry one more:

    pi@MySensor-GW:~/MySensors $ sudo make
    pi@MySensor-GW:~/MySensors $ sudo make install
    Installing bin/mysgw to /usr/local/bin
    install -m0644 initscripts/mysgw.systemd /etc/systemd/system/mysgw.service
    systemctl daemon-reload
    MySensors gateway has been installed, to add to the boot run:
    sudo systemctl enable mysgw.service
    To start the gateway run:
    sudo systemctl start mysgw.service
    pi@MySensor-GW:~/MySensors $ sudo systemctl enable mysgw.service
    pi@MySensor-GW:~/MySensors $

    So no warnings or errors on make and make install, seens to be ok.

    Then a "sudo reboot"


  • Mod

    @Kurtsejr did you reboot befor running sudo ./bin/mysgw?
    If that’s the case my guess is that the gateway was already started automatically at boot. When you tried to start another instance, the tcp port was already in use.



  • Yes I made a reboot, just made a new reboot - same result 😞


  • Mod

    @Kurtsejr yes the gateway will start automatically at each boot, unless automatic start is disabled.


  • Mod

    To check if the gateway has started automatically, run sudo systemctl enable mysgw.service


  • Mod

    @Kurtsejr I tested the gateway on a spare raspberry pi and it does indeed print lots of ERROR accept: Bad file descriptor when more than one instance of the gateway is started. The solution is easy: don't start two instances at the same time.

    The reason is actually printed in the log: ERROR bind: Address already in use but is easy to miss due to the many ERROR accept: Bad file descriptor

    INFO  Starting gateway...
    INFO  Protocol version - 2.4.0-alpha
    DEBUG MCO:BGN:INIT GW,CP=R-NGL---,FQ=NA,REL=0,VER=2.4.0-alpha
    ERROR bind: Address already in use
    ERROR Failed to bind!
    DEBUG MCO:BGN:STP
    DEBUG MCO:REG:NOT NEEDED
    DEBUG MCO:BGN:INIT OK,TSP=NA
    ERROR accept: Bad file descriptor
    ERROR accept: Bad file descriptor
    ERROR accept: Bad file descriptor
    ERROR accept: Bad file descriptor
    


  • @mfalkvidd said in MySensors GW on rpi3:

    sudo systemctl enable mysgw.service

    Thanks for your reply

    I have run the command, result:

    pi@MySensor-GW:~ $ sudo systemctl enable mysgw.service
    pi@MySensor-GW:~ $

    How do I remove if more that one instance is started? - I will try to google it. Perhaps it's easier to start from beginning again



  • @mfalkvidd I decided to reinstall, start from scratch by installing a new pi image om my SDHC disk, but trying to install the GW software I get this message:

    pi@MySensor-GW:~ $ pwd
    /home/pi
    pi@MySensor-GW:~ $ sudo git clone https://github.com/mysensors/MySensors.git --branch development
    Cloning into 'MySensors'...
    fatal: unable to access 'https://github.com/mysensors/MySensors.git/': Couldn't connect to server
    pi@MySensor-GW:~ $ sudo git clone https://github.com/mysensors/MySensors.git --branch master
    Cloning into 'MySensors'...
    fatal: unable to access 'https://github.com/mysensors/MySensors.git/': Couldn't connect to server
    pi@MySensor-GW:~ $

    Has something changed? or is it github that does not response?


  • Mod

    @Kurtsejr said in MySensors GW on rpi3:

    Has something changed? or is it github that does not response?

    The Raspberry Pi probably doesn't have the right settings for connecting to Internet. What happens if you run ping google.com for example? You should get something like this:

    ping google.com
    PING google.com (142.250.179.142) 56(84) bytes of data.
    64 bytes from ams17s10-in-f14.1e100.net (142.250.179.142): icmp_seq=1 ttl=58 time=33.3 ms
    64 bytes from ams17s10-in-f14.1e100.net (142.250.179.142): icmp_seq=2 ttl=58 time=33.4 ms
    

    If you don't get any replies, the raspberry pi doesn't have a working internet connection.


  • Mod

    @Kurtsejr said in MySensors GW on rpi3:

    How do I remove if more that one instance is started? - I will try to google it. Perhaps it's easier to start from beginning again

    sudo systemctl stop mysgw.service will stop the gateway service if it is currently running. It will start automatically again after reboot (unless disabled).

    sudo systemctl disable mysgw.service will disable autostart, but will keep the service running if it has already been started.

    https://www.linuxtrainingacademy.com/systemd-cheat-sheet/ can be a good place to start



  • @mfalkvidd You are right, no network connection - strange I will investigate, thanks!



  • @Kurtsejr Now I have network connection, made an update and upgrade, and now I can install from github. Changed to rf24 radio, and could see that ethernet was default.

    pi@MySensor-GW:~/MySensors $ sudo ./configure --my-transport=rf24
    [SECTION] Detecting target machine.
    [OK] machine detected: SoC=BCM2837, Type=rpi3, CPU=armv7l.
    [SECTION] Detecting SPI driver.
    [OK] SPI driver detected:BCM.
    [SECTION] Gateway configuration.
    [OK] Type: ethernet.
    [OK] Transport: rf24.
    [OK] Signing: Disabled.
    [OK] Encryption: Disabled.
    [OK] CPPFLAGS: -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloa t-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX _ARCH_RASPBERRYPI
    [OK] CXXFLAGS: -std=c++11
    [SECTION] Detecting init system.
    [OK] Init system detected: systemd.
    [SECTION] Saving configuration.
    [OK] Saved.
    [SECTION] Cleaning previous builds.
    [OK] Finished.

    Next was to do a make, result:

    pi@MySensor-GW:~/MySensors $ sudo make
    g++ -MT build/hal/architecture/Linux/drivers/core/interrupt.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/interrupt.cpp -o build/hal/architecture/Linux/drivers/core/interrupt.o
    hal/architecture/Linux/drivers/core/interrupt.cpp:33:10: fatal error: stropts.h: No such file or directory
    33 | #include <stropts.h>
    | ^~~~~~~~~~~
    compilation terminated.
    make: *** [Makefile:99: build/hal/architecture/Linux/drivers/core/interrupt.o] Error 1
    pi@MySensor-GW:~/MySensors $

    So it seems that something is missing, something linux basic ....


  • Mod

    Nice work on the internet connectivity @Kurtsejr

    It is an issue on some (newer?) linux versions. It has been fixed in the development version of MySensors. You can switch to the development version, or add the fix yourself.

    See https://github.com/mysensors/MySensors/issues/1431 and https://github.com/mysensors/MySensors/pull/1446/files

    Sorry for the inconvenience.



  • @Kurtsejr Thanks a lot!
    I removed the entry in the interrupt.cpp fil, and was then able to do a make , "make" - with some warnings, but make ended up writing this to me:

    /home/pi/MySensors/./hal/architecture/Linux/drivers/core/config.h:39: multiple d efinition of `conf'; build/hal/architecture/Linux/drivers/core/config.o:/home/pi /MySensors/hal/architecture/Linux/drivers/core/config.h:39: first defined here
    collect2: error: ld returned 1 exit status
    make: *** [Makefile:80: bin/mysgw] Error 1
    pi@MySensor-GW:~/MySensors $
    pi@MySensor-GW:~/MySensors $ sudo ./bin/mysgw -c
    sudo: ./bin/mysgw: command not found

    This means that I do not have a mysgw file in "bin" - bin dir is empty



  • @Kurtsejr Thanks
    Everything seems to be working, used the "dev version" - thanks for helping, I started with a new image.


  • Mod

    Nice work @Kurtsejr, thanks for reporting back


Log in to reply
 

Suggested Topics

63
Online

11.4k
Users

11.1k
Topics

112.7k
Posts