-
-
Notifications
You must be signed in to change notification settings - Fork 983
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
can not detect EFI environment before pretest #360
Comments
Also, secure boot is off |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it has not had recent activity. This probably means that it is not reproducible or it has been fixed in a newer version. If it’s an enhancement and hasn’t been taken on for so long, then it seems no one has the time to implement this. Please reopen if you still encounter this issue with the latest stable version. You can also contribute directly by providing a pull request. Thank you! |
I have this issue right now, any news? |
I today installed a clean install of Win11_23H2_EnglishInternational_x64v2.iso, I had put it to an usb stick with rufus-4.5.exe to install a laptop in UEFI mode, then after succesful installation I installed all the latest updates for the Windows and it was working perfectly. Then Veracrypt 64 bit latest version: VeraCrypt Setup 1.26.7.exe which installed normally. I had disabled secureboot and fast boot both from Windows and Bios. Type of System Encryption - Normal, Encrypt the Windows system partition (chose that because whole drive option was grayed out for some reason?) "can not detect EFI enviroment. Source: VeraCrypt::EfiBoot::DeleteStartExec2642" And I can only press "OK" Word "can" is written like that, not starting on capital letters, thats strange also. After pressing "OK" second error: "can not detect EFI enviroment. Source: VeraCrypt::EfiBoot::DeleteStartExec2691" After pressing again "OK": Cannot initiate the system encryption pretest." Then I am back to the System Encryption Pretest screen and if I press "Test" button again, the errors come again. Since I have the latest and the most official version of Windows 11 and the latest version of Veracrypt, I can confirm, this has not been repaired! It is not working, at all on some configurations. I don't have any firewall etc software installed, just Windows. Registry has not been edited or anything else. Just clean installation of windows. My user account is local and has admin rights. I also tried to run Veracrypt rightclicking as admin, the same problem. I also tried to then enable secureboot, just to test and clear secureboot keys. But those also did not help. What should I try next? Only the Veracrypt is the problem the windows otherwise is working perfect, even the hard drive is brand new, so indeed this is a software bug. Previously I have had Windows 7 Pro and Truecrypt installed on the same laptop without problems but then the boot order was legacy and not UEFI. I changed to UEFI setting before the W11 installation. |
Thank you for sharing all these datails. The error message you shared indicates that the failure is caused by the fact that VeraCrypt is unable to read UEFI environment variables using a standard Windows function. As you can see in the code screenshot above, it is the function For some reason, the function There two possibilities:
So basically, it is either a EFI firmware issue or a Windows issue. You can check first if there is an update of the firmware of your laptop ( can also be called BIOS). On my side, I will modify the code to display the |
Thank you for the swift reply! I agree, it could be something with the firmware. The laptop HP Elitebook 8570w has the "latest" firmware, but of course it is an old model already, no new updates in years. But since it was a very powerful machine when new, it is still working fine in a normal use (for example the 4K youtube vids play smooth). When I give the MSInfo32 command, I get the System Information screen that shows If I go to System Configuration and Boot, it also shows the normal: "Windows 11 (C:\WINDOWS) : Current OS; Default OS" I also checked folder C:\Windows\Boot\EFI\ and a 1636 KB file "bootmgr.efi" was there, so at least that is not missing. I also googled and found this: "Firmware variables are not supported on a legacy BIOS-based system. The GetFirmwareEnvironmentVariable function will always fail on a legacy BIOS-based system, or if Windows was installed using legacy BIOS on a system that supports both legacy BIOS and UEFI." Well at least that mistake I did not do, since I did not install Windows with the legacy setting on. And UEFI is still on, I just now checked from BIOS just in case: "UEFI Native (Without CSM)." Looking forward for the new version, we will try it for sure when you have it ready. Thanks! |
Thank you for all these details. I have prepared installers for version 1.26.13 that include the changes I mentioned above. The installers are available at https://sourceforge.net/projects/veracrypt/files/VeraCrypt%20Nightly%20Builds/Windows/ Let me know how things go and please share full error message in case of failure (or screenshot of messagebox). |
I uninstalled Veracrypt and then downloaded your zip, installed that version and it immediately worked perfect, computer rebooted like it should, and then after that: "The pretest has been succesfully completed." I pressed "Encrypt", "OK" and the encryption started. There were no error messages at all. :) |
Thank you for the feedback; I'm glad it worked. In addition to adding a more verbose error message, I also modified the code logic as follows:
I believe what fixed the issue is that the code now accepts an empty Thank you again for your help in addressing this issue and validating the fix. |
You're welcome. It is nice to see this machine now encrypted with Veracrypt, since back in the day when it was new, I used to deliver hundreds of laptops with the same model to customers and I actually equipped them with Truecrypt in the process. Probably worldwide there are still thousands and thousands of old computers that this fix might help at some point. |
BTW, my notebook also is an old HP model. Edit: Error 0xCB is ERROR_ENVVAR_NOT_FOUND. So the call to GetFirmwareEnvironmentVariable is valid, but there is no such variable. This could be HP specific. Is the content of the "BootOrder" actually used anywhere in VeraCrypt? Maybe there is another solution? |
This was partly mentioned in an earlier comment. So the error code could be used to decide if the system is installed under UEFI or not (it is ERROR_INVALID_FUNCTION then). Maybe this is a better strategy? |
I managed to add the missing "BootOrder" variable in my system using Windows' SetFirmwareEnvironmentVariable API. VeraCrypt is working now. This is a hack I cannot recommend to the average user, so the underlying bug in VeraCrypt should be fixed in any case. There is a new, unrelated problem which I will post in another existing issue. |
@kriegste Thank you for the detailed and helpful feedback. The issue is indeed caused by the empty "BootOrder" variable in your HP PC. The method To support cases like yours, I have modified the logic in the I will prepare a build that includes this change so that others affected by the issue can use it as well. |
Thanks! Now, if IsEfiBoot() is false, that means GetLastError() is ERROR_INVALID_FUNCTION any way, so this part can be cleaned up:
Lines 2654 and 2723. |
Good point! |
fix included in 1.26.18 release. |
Veracrypt 1.22 was working fine for me. After doing a BIOS update, it failed to boot, and windows automatic repair starts trying to fix it. I found Windows boot manager was currently the first boot option in the BIOS now, so I changed it to the VeraCrypt Boot option and Veracrypt would succeed loading Windows, but on every reboot, it would change back to windows boot manager (and try automatic repair).
I decided to permanently decrypt so I could start fresh. I even uninstalled and reinstalled Veracrypt, but now when I go to encrypt again, I get these errors when it goes to do the pretest, before rebooting. (note: I tried 1.22 and also 1.23BETA8, they are the same messages, but just in case the numbers like 2642 are LOC numbers, these messages are from 1.23BETA8):
can not detect EFI environment
Source: VeraCrypt::EfiBoot::SetStartExec:2642
can not detect EFI environment
Source: VeraCrypt::EfiBoot::DeleteStartExec:2593
An exception occurred in the service when handling the control request.
Source::VeraCrypt::Elevator::RestoreEfiSystemLoader:573
An exception occurred in the service when handling the control request.
Source: VeraCrypt::Elevator::InstallEfiBootLoader:544
Cannot initiate the system encryption pretest.
Note: MSinfo32.exe tells me my BIOS mode is UEFI
The text was updated successfully, but these errors were encountered: