mon5termatt / medicat_installer

Medicat Installer Repo
https://medicatusb.com
GNU General Public License v3.0
1.59k stars 120 forks source link

Crashes at 4b1d5ec11b2b5db046233a28dba73b83 was unexpected at this time. #49

Closed WittyAdrian closed 1 year ago

WittyAdrian commented 1 year ago

I've used the Medicat installer (version 21.12) a number of times now on various USB drives, absolutely love it. However I wanted to do another install today and suddenly the same installer that worked totally fine before is giving me an error before exiting the script. After you're prompted to wait for 5 seconds and then press any key, I get shown this before it stops working:

Downloading Initial Files, Please wait.
1/12  [====                                                ]
4b1d5ec11b2b5db046233a28dba73b83 was unexpected at this time.

Maybe I'm just doing something wrong, in which case I'd love some direction. Thanks for the help in any case!

Rooyca commented 1 year ago

Are you running it as admin? Is Defender active?

WittyAdrian commented 1 year ago

Yes, it prompts me to run it as admin right at the very start, before the red wait-for-5-seconds window even pops. I've also got real-time protection turned off and have the root folder where everything is located added as an exception.

All things I already did before and what made my last 3 installs work perfectly fine. That's the part I don't understand. I've had this working before, multiple times, no issues. But now suddenly I get this error.

WittyAdrian commented 1 year ago

Alright, did some digging and discovered that the 4b1d5ec11b2b5db046233a28dba73b83 hash belongs to the first program that's being installed (QuickSFV). Also found a few more errors with a similar message stemming from using CertUtil. So as a temporary fix I just disabled all of the hash verification in the installer bat script and that "fixed" the issue. Obviously it's not the actual fix, but it's a way for me to run the installer now without it crashing at the first check.

For the record I ran the CertUtil command manually that's also being used in the install script and the hash corresponds to the one being checked in the script just fine. So it doesn't seem like there's anything wrong on that front. I did notice that regardless of what commands I ran, the tmpfile was not being populated by any data, so maybe something went wrong there?

Rooyca commented 1 year ago

the tmpfile was not being populated by any data, so maybe something went wrong there?

Yes, it looks like the path is not working (./bin/QuickSFV.exe) if you remove the ./bin/ part you should get the hash. Maybe the script is not creating the ./bin/ folder?

WittyAdrian commented 1 year ago

No, that also went fine. Basically the bin folder gets created and it also downloads QuickSFV.exe just like it was intended, but after that it just crashes at the point of checking the hash using the CertUtil command.

I did a little debugging and the exact line that's causing it to crash is the following:

if %hash% NEQ 4b1d5ec11b2b5db046233a28dba73b83 (goto hasherror)

From my limited knowledge it seems like the CertUtil command isn't populating the tmpfile correctly, causing the hash variable to not be set to any value, which in turn causes the if statement to go belly up.

Rooyca commented 1 year ago

Yes, I was debugging yesterday too and found the same thing. When I removed the ./bin/ part the CertUtil command worked correctly.

And you have not tried to do the installation on another computer?

WittyAdrian commented 1 year ago

I tried removing the ./bin/ part from a few different places, but it doesn't seem to make a difference for me. All of my installations have been done from the same computer, although the one thing that did change is I updated a bunch of drivers. Although I'm unsure of that caused any of the weird behavior I've been seeing.

Rooyca commented 1 year ago

It would be a good idea to try the installation on another computer or in a VM to check that it is not something with the system.

WittyAdrian commented 1 year ago

I tried the specific commands in question on a VPS of mine and they worked perfectly fine. So it does seem like it's something to do with my system, maybe the driver updates messed something up. Specifically what's going wrong is the following line:

CertUtil -hashfile  "./bin/QuickSFV.exe" md5 | findstr -vrc:"[^0123-9aAb-Cd-EfF ]" > tmpfile

While just the first part is working fine when I execute it manually (CertUtil -hashfile "./bin/QuickSFV.exe" md5). The second part that is supposed to populate the tmpfile just doesn't do anything. Well, technically it does create the tmpfile, but just leaves it completely empty. Compared to the VPS where I did the same command manually and there it works just fine. Grabs the hash and stores it in the tmpfile just like you would expect.

I can personally avoid the errors simply by editing the script where it checks the hash, so I'm not too bothered by it, but it is weird why this suddenly started happening. Since I've executed the script previously on the same system multiple times with no issues whatsoever.

Rooyca commented 1 year ago

Yes, it is quite strange. Good thing you found a workaround. Although it would be nice to know why the error occurs in the first place, hopefully someone can take us out of the doubt.

WittyAdrian commented 1 year ago

Agreed, I'd like to know it as well. I'll leave the issue/question open for anyone to find, maybe we'll get an answer in the future. For now I'll use the workaround for any future installs.

v3DJG6GL commented 1 year ago

I have the same problem on a newly installed Windows 11 Pro. I will try other computers today. Maybe it is also somehow related to computer specific configurations....

Rooyca commented 1 year ago

I will try other computers today.

Please try it and let us know.

v3DJG6GL commented 1 year ago

Just had time to try it: It's the same behavior on my laptop with Windows 10 Pro.

v3DJG6GL commented 1 year ago

Tried it again with Windows Sandbox on the PC with Win11 Pro: Within Windows Sandbox, it works! But not on the host OS. FWIW, here are the system informations:

Windows Sandbox (VM, Windows 11 Enterprise - working): image

Windows 10 Pro (Host OS - not working): image

Rooyca commented 1 year ago

Did you upgrade the system in the VM? If you didn't, maybe the error is generated by some update... (?) Another thing, I don't know if it works (right now I don't have Windows to try it), what happens if you change / for \ in CertUtil -hashfile "./bin/QuickSFV.exe" md5 | findstr -vrc:"[^0123-9aAb-Cd-EfF ]" > tmpfile?

mon5termatt commented 1 year ago

Why am I just now seeing this issue

mon5termatt commented 1 year ago

Let me work on it this weekend

mon5termatt commented 1 year ago

i have changed the method in Version 3511

Please verify the issue is not happening anymore

WittyAdrian commented 1 year ago

I just ran the installer again, it updated to the latest version and it works fine now. Thanks for your help!

v3DJG6GL commented 1 year ago

Sorry I had no time to test it again until now. Now it's also working for me with the newest version :)