Etcher: Error: 'MySQL' is not recognised as an internal or external command

Created on 13 Jan 2017  Â·  25Comments  Â·  Source: balena-io/etcher

mysqlerror_etcher

  • 1.0.0-beta 17
  • Windows 10 Pro 64-bit
windows bug

Most helpful comment

Ok thanks; it's looking fine. MySQL error message disappeared.
Next week, I will start flashing some images. Great work!

All 25 comments

We've previously seen something very similar to this on Gitter https://gitter.im/resin-io/etcher?at=582a14e945c9e3eb4339d229
I didn't realise we didn't have a Github issue for it yet.

@jviotti Did we ever get any ideas what might be causing this?

@RobertLutken Would you be willing to help us debug this? Do you currently have MySQL installed on your PC, or have you had it installed previously?

@lurch I do indeed have MySQL installed, well MySQL workbench.
A little bit of digging seems to refer to "A key is a string specified in the Add method that uniquely identifies a specific member of a collection." MSDN
I'll have a dig around and try setup some different environment variables.
Happy to help!

Hey there @RobertLutken !

Thanks a lot for reporting! We've very recently fixed the Microsoft VBScript runtime error: This key is already associated with an element of this collection error (see https://github.com/resin-io-modules/drivelist/pull/130).

Regarding the MySQL error, I think its simply output coming from your environment every time you type a command, and should be safely ignored by our drive detection parser (see https://github.com/resin-io-modules/drivelist/pull/99).

So just to confirm the issue is gone, can you try the following bat scripts on your computer, and report back the results?

Also, can you open cmd.exe and try typing some commands on it? I want to check if those MySQL warnings you get get printed every time you write a command there, independently on what they are. You can try wmic diskdrive list brief for instance.

Hello

Same error message, in French this time :-)

Etcher-1.0.0-beta.18-win32-x64
Windows 7, 64 bits Edition Familiale Premium

Anything I can do to help?

Hi @daturach ,

Can you try running the .bat scripts I linked to in my previous comment?

Also, what happens if you any command on cmd.exe? Do you get the MySQL warning as well?

For this user, it seems to happen everytime a cmd.exe window is opened. Maybe its the same thing?

e8b8q

Hi @daturach ,

Can you also paste a screenshot of the error dialog?

Hello @jviotti

Thanks for your quick answer.
This is the error message I get when starting etcher:
etcher_mysql_error

As a side note, this dialog box is not even supporting accented chars...:-(

Running win32.bat before the fix:
before_bat

This MySQL error message is displayed only once. Other commands run into the same cmd.exe does not show this message anymore.

Running win32.bat after the fix displays the list of devices as above but without the error message if run in the same session.

Command wmic diskdrive list brief shows list of devices but never displays the error message.

Hope that helps!
Thanks

I think I have a theory about this. While our YAML parser will ignore invalid keys (https://github.com/resin-io-modules/drivelist/pull/99), the JavaScript code that executes the .bat script as a child process will blow up with an error if the stderr from the child process is not empty:

// See https://github.com/resin-io-modules/drivelist/blob/master/lib/scripts.js
if (stderr.trim().length) {
    return callback(new Error(stderr));
}

This seems to be what's happening given that the error contains both MySQL warning instead of just one (if the YAML parser would have been complaining about this, it would have complained about the first warning only, and we would have a YAML related stack trace).

I'm not very sure about what to do here. We can of course ignore stderr completely, but we might be hiding real errors accidentally, which is definitely not good.

I guess another way to go about it would be to only omit warning messages that match certain patterns, although I worry we will be maintaining a huge list of warnings (in multiple languages).

@lurch What do you think?

In the mid-time, in order to validate this theory, I'll produce a custom Windows build that logs a warning instead of throwing an error if the child process includes stderr output.

Hmmm, given that we've _only_ ever seen this error for MySQL (for a still-unknown reason) but for multiple times, I'd be tempted to filter out only any stderr messages starting with 'MySQL' which matches both the English and French errors above.

Also, should there be a separate issue for the French error-dialog not correctly showing accented characters?

Hmmm, given that we've only ever seen this error for MySQL (for a still-unknown reason)

It seems to be a MySQL %PATH% configuration issue. Try googling the warning, the error seems to be well known. The reason why we see it here is that when you execute cmd.exe, it tries to run some MySQL command by default, and thus we get it on every new cmd.exe instance, including the one that triggers the drive detection script.

I'd be tempted to filter out only any stderr messages starting with 'MySQL' which matches both the English and French errors above.

Yeah, maybe, although the fact that a similar error might be reported in the future makes me feel a bit uncomfortable.

I have an alternative solution: What about allowing the drivelist client to pass a function to handler stderr from the scripts? We can throw by default, but Etcher could silently print them in DevTools (and we'll see it if a user has any problems and we ask him to send us the DevTools output), and send them to TrackJS.

A similar approach would be to allow some option in drivelist to print stderr output to stderr instead of throwing (basically proxying the output). Since in Etcher we send any stderr output to TrackJS, we accomplish the same thing automatically.

It seems to be a MySQL %PATH% configuration issue. Try googling the warning, the error seems to be well known.

I googled, and as expected the first few results are from people actually trying to run mysql (which we aren't). But then I found https://github.com/cmderdev/cmder/issues/443 which has lots of great info, especially https://github.com/cmderdev/cmder/issues/443#issuecomment-150202124 which suggests that using double-quotes is the way to fix this problem, i.e. maybe we simply need to change https://github.com/resin-io-modules/drivelist/blob/master/scripts/win32.bat#L6 to

set "PATH=%PATH%;%SYSTEMROOT%\System32"

:-D

@lurch, jviotti

Running win32.bat with the PATH between "" does not produce any MySQL error.

Amazing discovery! This might indeed be the reason! I'm uploading a custom build with these changes and we'll see how it goes :)

@daturach Can you try the following custom build as well just to confirm? https://drive.google.com/open?id=0B7tkbonGU-RyNTRxdlBhRVgwQnc.

Thanks
What's the process? unzip and run Etcher.exe?
I get the following:
etcher_test1

Let me try here. I might have messed something up when editing the files straight in the asar archive.

Try this one: https://drive.google.com/open?id=0B7tkbonGU-RyUnJxbm5WeVpSM1U. Indeed messed up the previous one, sorry about that :)

Ok thanks; it's looking fine. MySQL error message disappeared.
Next week, I will start flashing some images. Great work!

Woohoo! Thanks a lot for the help on this issue. I'll send a patch to apply this fix!

All the credit to @lurch and his amazing observations of course \o/

should we just be double-quoting everything-in-general and get it over
with? it seems so many issues end with "use double quotes"

--

Alexandros Marinos

Founder & CEO, Resin.io

+1 206-637-5498

@alexandrosm

On Fri, Jan 27, 2017 at 1:47 PM, Juan Cruz Viotti notifications@github.com
wrote:

All the credit to @lurch https://github.com/lurch and his amazing
observations of course \o/

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/resin-io/etcher/issues/1025#issuecomment-275783810,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABLUCGjBlkP2d2KwzOBiuX8iYBWNrbR5ks5rWmXUgaJpZM4Li2lr
.

I'll definitely check if we can use double quotes elsewhere. At least in the Windows script, everything else is quoted already.

I've sent two PRs addressing issues highlighted by shellcheck, a shell script linter, for both the GNU/Linux and OS X scripts:

This tool, among other improvements, highlighted all the places where we should quote for safety purposes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

m-p-3 picture m-p-3  Â·  5Comments

mwiegant picture mwiegant  Â·  5Comments

Deej0406 picture Deej0406  Â·  4Comments

robmcc1983 picture robmcc1983  Â·  5Comments

zamber picture zamber  Â·  5Comments