Couldn't create a symlink '/dev/ttyMySensorsGateway' to PTY! (17) File exists

  • Hi,
    I have an RPi3 with nrf24l01+ directly attached and mysgw 2.2.0-beta.....

    It works for a while (ofetn more than a week), but then crashed and a reboot won't help.
    msygw -d reports...

     $ mysgw -d
    mysgw: Starting gateway...
    mysgw: Protocol version - 2.2.0-beta
    mysgw: Couldn't create a symlink '/dev/ttyMySensorsGateway' to PTY! (17) File exists
    mysgw: Failed to open serial port.

    Not really sure how to get this working again? Any ideas out there please?

  • Anyway, today brings a new mystery for me as I did the following.....

    sudo systemctl daemon-reload
    sudo systemctl restart mysgw.service
    sudo systemctl stop mysgw.service
    sudo systemctl start mysgw.service

    Then to see what was going on....
    tail -f /var/log/syslog

    This showed data, so I connected to the web server (running MyController on the same pi as the MYSGW) and graphs were showing of data received since last night.... It looks like it's all back to normal, except it isn't as I still get exactly the same error message from mysgw -d.

    Weirder still!

  • Mod

    @skywatch sounds like you are trying to start two instances of mysgw at the same time. The first is started automatically at boot, and when you run sudo systemctl start mysgw.service. Then you try to start one more instance with sudo mysgw -d. The new instance can't create /dev/ttyMySensorsGateway because /dev/ttyMySensorsGateway already exists (it was created by the first instance of mysgw).

  • Aha! - Ok that does make sense 🙂

    I was mistaken in that I believed that mysgw -d enabled debug, but now realise that in order to do this it starts a new instance of mysgw.

    What I still can't get to the bottom of is what caused the problems in the first place. I suddenly loose all data from nodes but not from internal pi mqtt metrics.

    Over on MyController they think it is because I have nrf24l01+ attached directly to the pi and that people that use an additional arduino to attach the radio module and then HW serial to the pi have not had such problems. Does this seem likely in your experience?

    Thanks 🙂

  • Mod

    @skywatch the Arduino-based serial gateways are more proven. They have been around for a longer time so more people have tried them.

    But the Raspberry Pi gateway should work. May I suggest that you enable debug logging on the gateway using these instructions? You should then be able to get a clue in /var/log/syslog when/if the gateway stops working again.

Log in to reply

Suggested Topics

  • 3
  • 3
  • 2
  • 2
  • 2
  • 1