ct-Open-Source / ct-Open-Source/tuya-convert

Docker issue, possibly "address already in use"

Open
#570 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
5.1k
Forks
523
PR merge metrics
No merged PRs in 30d

Description

My iPhone and iPad can't connect to vtrust-flash and I'm seeing DNSMASQ errors. The install is via docker. I do have other things running in Docker so there's possibly a port conflict.

Any help appreciated.

smarthack-wifi.log
```
System info
===========
31856ad
Linux Burbank 5.3.0-40-generic #32-Ubuntu SMP Fri Jan 31 20:24:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
OpenSSL 1.1.1 11 Sep 2018
Dnsmasq version 2.79 Copyright (c) 2000-2018 Simon Kelley
Compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify

This software comes with ABSOLUTELY NO WARRANTY.
Dnsmasq is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License, version 2 or 3.
hostapd v2.6
User space daemon for IEEE 802.11 AP management,
IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
Copyright (c) 2002-2016, Jouni Malinen and contributors
Python 3.6.9
===========
Configuring AP interface...
RTNETLINK answers: File exists
RTNETLINK answers: File exists
Starting DNSMASQ server...

dnsmasq: failed to create listening socket for 10.42.42.1: Address already in use
Starting AP on wlp0s20f3...
Configuration file: /dev/stdin
Using interface wlp0s20f3 with hwaddr 04:d3:b0:15:26:38 and ssid "vtrust-flash"
wlp0s20f3: interface state UNINITIALIZED->ENABLED
wlp0s20f3: AP-ENABLED
wlp0s20f3: AP-STA-CONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-DISCONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-CONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-CONNECTED f4:5c:89:79:d2:eb
wlp0s20f3: AP-STA-DISCONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-CONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-DISCONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-CONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-CONNECTED b8:5d:0a:67:92:c4
wlp0s20f3: AP-STA-DISCONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-CONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-DISCONNECTED b8:5d:0a:67:92:c4
wlp0s20f3: AP-STA-DISCONNECTED f4:5c:89:79:d2:eb
wlp0s20f3: AP-STA-DISCONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-CONNECTED d8:f1:5b:92:fa:cf
wlp0s20f3: AP-STA-CONNECTED b8:5d:0a:67:92:c4
wlp0s20f3: AP-STA-DISCONNECTED b8:5d:0a:67:92:c4
```
smarthack-udp.log
```
Listening for Tuya broadcast on UDP 6666
Listening for encrypted Tuya broadcast on UDP 6667
```

smarthack-psk.log
```
Traceback (most recent call last):
File "./psk-frontend.py", line 113, in
main()
File "./psk-frontend.py", line 99, in main
proxies = [PskFrontend(gateway, 443, gateway, 80), PskFrontend(gateway, 8886, gateway, 1883)]
File "./psk-frontend.py", line 46, in __init__
self.server_sock = listener(listening_host, listening_port)
File "./psk-frontend.py", line 17, in listener
sock.bind((host, port))
OSError: [Errno 98] Address already in use
```

smarthack-mqtt.log
```
1584422260: mosquitto version 1.4.15 (build date Tue, 18 Jun 2019 11:42:22 -0300) starting
1584422260: Using default config.
1584422260: Opening ipv4 listen socket on port 1883.
1584422260: Error: Address already in use

```

smarthack-web.log
```
Could not start server on port 80
Close the process on this port and try again
```

EDIT: And here's the command line:
```
root@Burbank:/usr/bin/tuya-convert# ./start_flash.sh
tuya-convert v2.4.3
Checking for network interface wlp0s20f3... Found.
Checking UDP port 53... Available.
Checking UDP port 67... Available.
Checking TCP port 80... Available.
Checking TCP port 443... Available.
Checking UDP port 6666... Available.
Checking UDP port 6667... Available.
Checking TCP port 1883... Available.
Checking TCP port 8886... Available.
sudo: ufw: command not found
======================================================
Starting AP in a screen
Starting web server in a screen
Starting Mosquitto in a screen
Starting PSK frontend in a screen
Starting Tuya Discovery in a screen

======================================================

IMPORTANT
1. Connect any other device (a smartphone or something) to the WIFI vtrust-flash
This step is IMPORTANT otherwise the smartconfig may not work!
2. Put your IoT device in autoconfig/smartconfig/pairing mode (LED will blink fast). This is usually done by pressing and holding the primary button of the device
Make sure nothing else is plugged into your IoT device while attempting to flash.
3. Press ENTER to continue

======================================================
Starting smart config pairing procedure
Waiting for the device to install the intermediate firmware
Put device in EZ config mode (blinking fast)
Sending SSID vtrust-flash
Sending wifiPassword
Sending token 00000000
Sending secret 0101
................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
..................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
.................
SmartConfig complete.
Resending SmartConfig Packets
............
Device did not appear with the intermediate firmware
Check the *.log files in the scripts folder
Do you want to try flashing another device? [y/N] n
======================================================
Cleaning up...
No screen session found.
No screen session found.
No screen session found.
Closing AP
Exiting...
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Docker installation with ./start_flash.sh and read smarthack-wifi.log, smarthack-psk.log, smarthack-mqtt.log, and smarthack-web.log alongside the port-check output. Trace why services report ports 53, 80, 1883, and 443 as available before startup but then fail to bind; done means the services start without address-in-use errors and the device appears with intermediate firmware.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.