Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mirobo update-firmware to Roborock is unsuccessful due to Broken pipe, Got a request, should be downloading now. #1154

Closed
martin-kokos opened this issue Oct 5, 2021 · 3 comments · Fixed by #1155
Labels

Comments

@martin-kokos
Copy link
Contributor

Describe the bug
Firmware update fails with python error Broken pipe, after various progress, sometimes almost immediately, sometimes after +20% uploaded.

Version information (please complete the following information):

  • OS: Linux
  • python-miio: 0.5.8

Device information:

  • Model: Roborock Gen 2

To Reproduce
Steps to reproduce the behavior:

  1. mirobo --token XXXXX --ip 192.168.8.1 update-firmware firmware.pkg

Expected behavior
Complete firmware updage

Console output

 File "/Users/XXXXXX/flasher/venv/lib/python3.9/site-packages/miio/updater.py", line 30, in handle_one_request
    self.wfile.write(self.payload)
  File "/usr/local/bin/python-3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 826, in write
    self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe

also followed by message as file is rerequested:
Got a request, should be downloading now.

Probable cause
Since official firmware is based on Ubuntu 14, the python version is python 2. I have encountered this count of error when python 2 socket is talking to python 3 socket. I don't know the exact bug or how it happens.

Solution
Serve the firmware file from different webserver such as python 2 (most linux distributions don't use it by default now, but usually still present):

  • run from directory where file is to start webserver to serve the file: python2 -m SimpleHTTPServer
  • optionally check with your browser the webserver is ready to serve the file by going to http://<your ip address>:8000/
  • get MD5 checksum of your firmware file: md5sum firmware.pkg
  • the update-firmware can take http url instead of path to firmware file mirobo --token XXXX --ip 192.168.8.1 update-firmware http://<your ip address>:8000/firmware.pkg <md5 checksum>
@rytilahti
Copy link
Owner

Glad you got it working for you, would you mind creating a PR to add a note about possibility to use any http server for hosting to https://github.com/rytilahti/python-miio/blob/master/docs/device_docs/vacuum.rst#firmware-update ?

Low-level socket accesses are hard to debug, that broken pipe comes from the fact that the socket gets closed by the remote (for reason or another). This may very well be something python and/or osx specific.

@martin-kokos
Copy link
Contributor Author

I put it here for searchability when someone encounters the problem, but I am not sure of the cause and my solution is not a good solution for everybody.

@rytilahti
Copy link
Owner

@martin-kokos I think adding a hint like this to the documentation could be helpful:

Instead of using the built-in HTTP server which may not work on all circumstances, you can host the firmware file anywhere that is accessible by the device some details how to do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants