Corrupt file stops boot

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
simonmcc
Posts: 12
Joined: Fri May 11, 2018 5:21 pm

Corrupt file stops boot

Post by simonmcc » Fri Jul 19, 2019 6:49 am

I have two D1 minis running a lightswitch for me, one is the sender and one the receiver. The receiver runs picoweb, and waits on /on or /off http requests to turn the lights on or off
It stopped working recently, and when I went to investigate I saw that the program file had been corrupted, it looks like the first part of it is gone:

How it should look:

Code: Select all

import picoweb
import os
import network

gc.collect()
import uasyncio as asyncio
How it actually looks:

Code: Select all

 os
import network

gc.collect()
import uasyncio as asyncio
And when I reboot it, I see this:

Code: Select all

MPY: soft reboot
Traceback (most recent call last):
  File "main.py", line 1, in <module>
  File "<string>", line 2, in <module>
ImportError: no module named 'pcoweb'
MicroPython v1.11-72-g9cebead27-dirty on 2019-06-28; ESP module with ESP8266
Type "help()" for more information.
>>> 
>>> 
I reloaded the original file to it, rebooted it and now it works fine.

My question is, what could have went wrong, and could it happen again? Is it bad flash, or a bad D1? Should I 'retire' it and try another one?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Corrupt file stops boot

Post by jimmo » Fri Jul 19, 2019 7:07 am

Does your code write to the filesystem during normal operation? Was there possibly a power outage (or if it's battery powered, a low battery state) that coincides with the corruption?

simonmcc
Posts: 12
Joined: Fri May 11, 2018 5:21 pm

Re: Corrupt file stops boot

Post by simonmcc » Fri Jul 19, 2019 7:21 am

I have a config module which allows the mode (transmitter/receiver) and wifi details etc to be configured, but these are not normally written unless someone clicks 'save' on the gui.

I don't think there was any power outage, our house alarm normally notifies us of something like that :)

It is currently powered from a Raspberry Pi, as I wanted to keep an eye on the console, so I used USB on the pi so I can watch the console (piped to a file on the pi)

Apart from that it just sits and waits for incoming requests for /on and /off

Post Reply