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

particle update (v1.43) is failing to complete dfu, new bootloader method presumed at fault #498

Closed
markterrill opened this issue Jul 15, 2019 · 6 comments · Fixed by #499

Comments

@markterrill
Copy link
Contributor

I posted an issue against device-os as it seems to be a combination of 1.2.1 new bootloader process and particle-cli 'particle update'

https://github.com/particle-iot/device-os/issues/1856

Note the 'cannot read property 'code' of undefined.

Marks-2017MBP:sdb-firmwareflash markterrill$ particle update

Your device is ready for a system update.
This process should take about 30 seconds. Here it goes!

! An error occurred while attempting to update the system firmware of your device:

dfu-util:
File too short for DFU suffix
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!

dfu-util:
Error during download get_status

Please visit our community forums for help with this error:
https://community.particle.io/
Cannot read property 'code' of undefined

@busticated
Copy link
Contributor

ah, sorry about that. i'll investigate ASAP. thanks for the report 👍

@markterrill
Copy link
Contributor Author

@technobly / @busticated

I'm getting near identical symptoms with what seems to be a corrupted P1 board.

particle-cli 1.52.0 using node 10.16 (and tried 8.6)

Marks-2017MBP:particle-cli markterrill$ particle update

> Your device is ready for a system update.
> This process should take about 30 seconds. Here it goes!


! An error occurred while attempting to update the system firmware of your device:

dfu-util: File too short for DFU suffix
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!

dfu-util: Error during download get_status


> Please visit our community forums for help with this error:
https://community.particle.io/
Cannot read property 'code' of undefined

The device afterwards hangs on a solid yellow light. If you run particle update again, it actually comes out with an interesting javascript error:

Marks-2017MBP:particle-cli markterrill$ particle update
/Users/markterrill/.nvm/versions/node/v10.16.0/lib/node_modules/particle-cli/dist/lib/utilities.js:217
      defer.reject(msg);
            ^

TypeError: defer.reject is not a function
    at Timeout.setTimeout [as _onTimeout] (/Users/markterrill/.nvm/versions/node/v10.16.0/lib/node_modules/particle-cli/dist/lib/utilities.js:217:13)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)

@busticated
Copy link
Contributor

hi @markterrill sorry to hear you are hitting issues again. i know it's not very comforting but we're unable to reproduce the issue over here. the solid yellow led on the device indicates dfu-util stopped sending new data in the middle of the transfer. you'd be surprised how often it turns out to be due to a bad usb cable.

if you are still hitting issues, do you mind opening a new issue here (as opposed to discussing it in this closed one). you can always link over here for context and be sure to provide the troubleshooting info we ask for in the issue template. thanks 🙏

@markterrill
Copy link
Contributor Author

Hi, USB cable? Srly?

To me it's the same issue, that is repeating like a bad curry.

If you'd like to open a new case for the javascript error then you're welcome to. I'm spending enough of my time debugging faulty Particle software and hardware, ie this one https://github.com/particle-iot/device-os/issues/1958 has cost us significant delays and staff labour during the busiest retail time of the year.

@markterrill
Copy link
Contributor Author

Note, that USB cable has been reflashing boards all week to remediate boards corrupted by the #1958 issue.

USB cable. Funny stuff.

@markterrill
Copy link
Contributor Author

markterrill commented Dec 2, 2019

@busticated flicked through github responses today and nothing, but I was curious as to whether it was a wrong library or silly mistake that wasn't tested.

dfu.util

const temp = require('temp');
....
listDFUDevices() {
    const _module$exports = module.exports,
          getCommand = _module$exports.getCommand,
          _dfuIdsFromDfuOutput = _module$exports._dfuIdsFromDfuOutput,
          _missingDevicePermissions = _module$exports._missingDevicePermissions;
    return new Promise((resolve, reject) => {
      let failTimer = utilities.timeoutGenerator('listDFUDevices timed out', temp, 6000);
      let cmd = getCommand() + ' -l';
      childProcess.exec(cmd, (error, stdout, stderr) => {
        clearTimeout(failTimer);

        if (error) {
          return reject(error);
        }

rightio, so timeoutGenerator is being called with a library used to create temporary files. That's odd isn't it.

let's take a look at utilities.js

timeoutGenerator(msg, defer, delay) {
    return setTimeout(() => {
      defer.reject(msg);
    }, delay);
  },

rightio. So we pass a full library (used for temporary files) as a parameter to a function that is only used once in the entire program and then call a method (.reject) that doesn't exist. Seems like they tried to reject the promise inside the function but failed to get close. As there is a return reject(error), maybe they thought it was job done?

Testing and code review score: 0

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

Successfully merging a pull request may close this issue.

2 participants