Repository navigation
Description
Affected component(s) or functionality
The component or functionality of TrenchBoot that is not working as expected.
AEM
Brief summary
A clear and concise summary of the bug.
AEM does not boot on this platform in UEFI mode.
Version
The version of the component or feature if available, otherwise NA.
v0.5.0-rc3
To Reproduce
Steps to reproduce the behavior:
- Install AEM v0.5.0 under Qubes OS for legacy and UEFI
- Try to boot with AEM enabled
Expected behavior
A clear and concise description of what you expected to happen.
System boots normally.
Actual behavior
What actually happened (instead of what you expected to happen).
Platform reboots around the time when Xen is supposed to jump to slaunch stub in GRUB, no TXT error is produced. With additional debug enabled in GRUB (set debug=linux,relocator,multiboot,multiboot_loader,slaunch,chainloader), the platform hangs instead.
Screenshots
If applicable, add screenshots to help explain your problem.
Test 3501 on our internal openQA.
Additional context
Add any other context about the problem here.
Boot log with debug in GRUB: aem.log. No additional lines appear after adding debug options to xen-4.17.5.cfg.
Solutions you've tried
If applicable, any solutions or workarounds you've already tried.
- Booting AEM entry with
slaunchandslaunch_moduleremoved: system boots, complaining about PCRs being all Fs, which is expected - Booting non-AEM entry with
slaunchadded: platform reboots, TXT reports error0xc0140431- I wasn't able to decode this particular minor number, but it has major type ofERR_BASIC_RANGE_CHECK - The same AEM version in legacy mode also reboots without the fix for AEM not booting on Intel legacy boot xen#22.
Relevant documentation you've consulted
A list of links to any relevant documentation you have consulted.
Related, non-duplicate issues
A list of links to other bug reports, feature requests, or tasks in the
trenchboot-issues tracker (or "none" if you didn't find any). Do not describe
any other unreported bugs, features, or tasks here.
Activity
SergiiDmytruk commentedon Apr 9, 2025
There seems to be something about
grub_dprintf()that doesn't work when GRUB continues execution like that. Replacing such calls withgrub_printf()helps to avoid the hang.SergiiDmytruk commentedon Apr 10, 2025
This seems to be the same issue as TrenchBoot/xen#22 and fix for that issue makes AEM work here in legacy mode. The platform has some really weird problems with Qubes ISO on PiKVM, so I had to make network boot work for legacy and UEFI cases to be able to test. Need to get firmware with TPM1.2 fix as I ran openQA on the version without the fix and it couldn't clear TPM.
krystian-hebel commentedon Apr 11, 2025
SeaBIOS doesn't support composite USB devices, it breaks out of loop on first supported interface. Luckily, the first one is keyboard, otherwise none of our tests would work. UEFI works with the PiKVM ISO just fine for me.
I worked around this by plugging in physical USB stick with Qubes OS installer (platform with asset ID 105), but it fails to boot the installer most of the times in legacy mode:
dmesg shows some disturbing errors, not sure if they are related:
I tried with different USB sticks in different ports, although always on the front panel, it didn't change the outcome. I was able to boot to the first GUI screen of the installer once by choosing
kernel-latest, but I wasn't able to repeat it later.SergiiDmytruk commentedon Apr 11, 2025
I haven't actually tried it because I incorrectly assumed a hardware-related issue. Network boot for UEFI doesn't work as expected though, openQA sends F12 too late for it to have an effect as if it used to boot slower or maybe something adds an extra delay now. I ended up making network boot the first boot option.
SergiiDmytruk commentedon Apr 11, 2025
And only in legacy mode. UEFI fails before reaching Xen's code which restores MTRRs.
SergiiDmytruk commentedon Apr 12, 2025
Tried adjusting some alignment/range-related things in GRUB, but Slaunch boot still fails with
0xc0140431. It's the same error I saw on an OptiPlex earlier and suspected it to be firmware related, tried to flash original firmware and got a brick, so I don't want to repeat the test.I did, however, try with tboot and got the same error code, so assuming tboot does everything right for the platform either DRTM doesn't work on OptiPlex with Dasharo+UEFI or it doesn't work on OptiPlex with UEFI (need a firmware test).
ERR_BASIC_RANGE_CHECKis described as "One of ranges in array failed the check: alignment is incorrect top address is below base Range placement is incorrect as required by its attributes" (original punctuation preserved). Possible minor errors (array elements?):ERR_DMAR_TABERR_OSSINIT_TABERR_LAPICERR_PMRERR_PRIMARYERR_SECONDARYERR_VTD_IA_EXCERR_VTD_GT_EXCERR_ACPI_TABERR_MLE_PD_PAGE1ERR_MLE_PD_PAGE2ERR_MLE_PT_PAGEERR_MLE_PAGEThis looks like SINIT can potentially dislike placement of ACPI tables, although since TXT works for UEFI on VP4670 maybe that's not the issue (EDK2 should behave similarly on both platforms unless coreboot causes variance). Also, the list above is incomplete and meaning of some of the fields isn't clear, so it's hard to say what SINIT could be checking.
krystian-hebel commentedon Apr 23, 2025
I was convinced we had a positive test results for UEFI, but there are no such results in openQA, I must be imagining things. It is interesting that tboot has the same problem.
They have different ACMs, with different bugs and quirks, they may behave differently. On top of that, VP4670 has TPM2.0, and while it probably isn't the direct cause (there is a dedicated class for TPM errors), it may move something around in memory or in time. AMD was requiring some delay between INIT and SKINIT, maybe something similar happens here.
I'm currently testing the same packages with legacy Optiplex, if it doesn't work there as well, we will know that it isn't caused by UEFI, but may still be caused by a different coreboot revision.
SergiiDmytruk commentedon Apr 23, 2025
Legacy should work fine, it's only UEFI that had issues, but TXT has at least one UEFI-specific field, so that can be a factor. I would have checked against the stock UEFI firmware, but it requires flashing both flash chips and since I bricked OptiPlex twice already (once to do this test), I think it will happen again and won't be able to run the check anyway. If you have had success with stock <-> Dasharo transitions in the past, maybe you could try.
krystian-hebel commentedon Apr 24, 2025
There are 2 TCPA entries in ACPI, one made by edk2, the other by coreboot (http://192.168.4.32/tests/3815/logfile?filename=serial0.txt#line-191 and few lines below). In case of VP4670, there is only one TPM2 entry: http://192.168.4.32/tests/3446/logfile?filename=serial0.txt#line-364. FACS is also listed twice (although only in dom0 kernel output), but at least it points to the same address, and it is duplicated in UEFI and legacy alike, so probably irrelevant. TCPAs produced by each component is different:
TPM memory also isn't reserved according to dom0 kernel in case of UEFI (
[ 0.000000] Xen: [mem 0x00000000fed90000-0x00000000fed91fff] reserved, while it is for legacy ([ 0.000000] Xen: [mem 0x00000000fed20000-0x00000000fed91fff] reserved).I've found some old TXT error document (not sure where it comes from, it was laying on my disk as
sinit_errors.txt) that have slightly different assignment of error codes. According to it, this error would meanDEF_TYPE MTRR not UC or fixed MTRRs not disabled, but those requirements are met.I hadn't tried it yet. According to https://docs.dasharo.com/variants/dell_optiplex/recovery/ it requires external flashing, and there is not enough space in the rack to try to attach second clip without accidentally disconnecting something. It also doesn't say how to obtain the backup, which is no longer part of initial deployment since it was obsoleted by DTS. Internal flashing is bound to fail, ME doesn't like having its flash region written at runtime.
21 remaining items
SergiiDmytruk commentedon Apr 27, 2025
Dasharo/coreboot#657 makes DRTM work on OptiPlex with Dasharo+UEFI! Weird that it didn't affect SeaBIOS version.
That part wasn't brought back after rebase and I wasn't really missing it (makes development harder). There is a need for some way (maybe new command) to disable slaunch, it could also zero the error and allow bringing back the old behaviour with aborting in a convenient way (one can just add that command to
grub.cfgto always reset the error on boot or run it after a boot failure and do the boot again).SergiiDmytruk commentedon Apr 27, 2025
Sent TrenchBoot/xen#25 to make the code not BUG on AMI firmware.
Didn't send change to do TXT reset on BUG because it somehow didn't work (TXT.ERRORCODE is still 0x8000000a). Seems like it should:
miczyg1 commentedon Apr 28, 2025
@SergiiDmytruk so, did we get past SENTER already? That's great. Pushing the change upstream then... What about RSDP error?
There is an possibility that we used different SINIT ACM?
SergiiDmytruk commentedon Apr 28, 2025
Yes, Xen boots and DRTM PCRs are initialized. Couldn't check the values against
anti-evil-maid-dump-evt-logbecausexl dmesgbuffer likely ran out of space and lost required SLAUNCH log line.That error was likely a bogus one caused by invalid coreboot config. SINIT ACM is from 2019 and Dasharo should be using this version all the time.
krystian-hebel commentedon Apr 28, 2025
Isn't it
BUG_FRAME()that does the reset, beforeslaunch_bug()has a chance to execute? But if they were reversed, the reason wouldn't be printed before the reset, which would be even worse. Let's leave it as it is, cleaning up in GRUB seems cleaner anyway, as long as it is possible to executeslaunch_stateto get the error code.miczyg1 commentedon Apr 28, 2025
This maps to
IllegalProcessorStateper TXT MLE doc.This may be related to what @krystian-hebel wrote above about
BUG_FRAMEreset.SergiiDmytruk commentedon Apr 28, 2025
Doesn't seem like
BUG_FRAMEdoes the reset, I thought that's whyunreachable()is there. See https://github.com/TrenchBoot/xen/blob/aem-next/xen/arch/x86/include/asm/bug.h#L34-L59. Also,and I don't think warnings reset the system. They are probably forcing an exception and its handler invokes
panic()which prints that message and callsmachine_restart().krystian-hebel commentedon May 5, 2025
I've built coreboot from current
dasharobranch, so it should contain Dasharo/coreboot#657. I've usedconfig.dell_optiplex_9010_sff_uefi_txtand added both ACMs, as well as EC binary. For Xen, I'm using images produced by CI onaem-nextbranch, currently TrenchBoot/xen@ad7b572. With this setup on Optiplex I'm still getting bootloops, but the error code is cleared. It seems to take about 5 seconds before the reboot, so I'm assuming it still hits someBUG(), but I wasn't able to get the serial output from Xen yet.Am I missing something? According to the above discussion it should work just fine.
SergiiDmytruk commentedon May 5, 2025
Sounds like it should work. I tested that PR on second OptiPlex and I think one is 7010 and another 9010, so something can be different.
SergiiDmytruk commentedon May 7, 2025
Execution doesn't reach Xen and the platform likely just cold reboots from ACM most of the time. Sometimes it warm reboots and I see
TXT.ERRORCODE: 0xc00020c1like in #58 (comment) above. I thought that means your firmware wasn't built correctly, so I flashed the same image I used on the other OptiPlex but nothing has changed. I guess there is some other issue with Dasharo+UEFI.Since it did work with the stock firmware, the claim in TrenchBoot/TrenchBoot.github.io#51 about TrenchBoot not working for OptiPlex at all seems too strong, it's still some Dasharo-specific issue even though it gets in the way of testing at least on one of the two pieces of hardware.
krystian-hebel commentedon May 7, 2025
But it specifies in the notes that this applies to coreboot with edk2, in the same way it was specified for v0.3. Oh, and by the way, both platforms in the lab are 7010.
SergiiDmytruk commentedon May 7, 2025
It does, I must have actively ignored that part :)
That's even weirder. DRTM definitely did work on asset 37 and it didn't seem random since I used it to verify code changes several times.
krystian-hebel commentedon May 7, 2025
Yes, now I'm getting the same on the other Optiplex (asset 37), and one time it blanked the screen but didn't reboot at all. I didn't flash the firmware so it should be the one that worked previously.
Were there any changes on GRUB side in the last week or so? I may be using older packages, hard to tell since they all have the same version in the name.
SergiiDmytruk commentedon May 7, 2025
No, there were no new changes in GRUB: TrenchBoot/grub@b551778
[-]AEM doesn't work on Dell Optiplex 7010/9010[/-][+]AEM doesn't work on Dell Optiplex 7010 in UEFI mode[/+]