Secure Boot + self-signed keys + NVIDIA GPU = bricked laptop
I just got a new laptop (Precision 7560, with a nice 8-core Tiger Lake-H Xeon CPU and RTX A4000 GPU), and it came pre-installed with Windows 10, and BitLocker was enabled.
This got me interested in securing the entire boot process, so I prepared Arch Linux on a second SSD. I set up systemd-boot on the EFI partition, and a LUKS-encrypted partition with BTRFS, containing root, home, and swap subvolumes (plus hibernate-to-swap).
Then I used /u/Foxboron's excellent tool, sbctl to generate and enroll self-signed keys into the firmware. I edited /etc/kernel/cmdline with all the various kernel command-line options (early mode setting, LUKS options and drives, the hibernate-to-swap resume option etc).
Finally, I wanted LUKS' unlocking behaviour to resemble BitLocker's and tie its state to the firmware and TPM as well as auto-unlock on boot, so I used sd-cryptenroll to set the password prompt to trip if the firmware admin password was changed, or Secure Boot was disabled.
Everything worked beautifully (except I have no S3 sleep on these newfangled notebooks, so I have to hibernate), until I decided to switch OFF Optimus in the firmware and boot with the NVIDIA GPU alone.
Bam, no POST and flashing amber/white LEDs. The only way to fix this is with a motherboard replacement.
At least I have next-business-day ProSupport. The problem is that I really don't want (anyone) to teardown a brand-new laptop... The Precision is a particularly hairy device to replace the motherboard for.
This has apparently happened to a lot of ThinkPad notebooks with self-signed keys, too. Incidentally, is there a way to enroll the Microsoft keys as well as the self-signed ones? I know this compromises security, but I'd rather slightly insecure than bricked laptop.
UPDATE
So it turns out that my laptop was not bricked. Instead, just because I had left out the Microsoft UEFI CA 2011 certificate from the UEFI db datastore, the NVIDIA GPU's own firmware wasn't recognised and hence, the internal screen didn't work at all, and especially not during the pre-boot process. I didn't realise this and when I plugged in an external display, it didn't take (because I didn't close the lid), which made me think the notebook was bricked. Even after I connected the display and switched outputs, the status LED still continued blinking, despite having a valid output to the monitor.
I had to work blindly to get to Arch (Windows is the default option—I still use it more often than I do Linux, which was the point of this whole exercise, to allow seamless, encrypted dual-booting), but once I did, this section of the Arch wiki, as /u/Foxboron and /u/Ohlav has suggested, was all I needed to do to solve the problem. I now have my internal display back, Windows bootloader and systemd-boot both self-signed.
All good again!
Edited 31 Aug 2021. We only hold this version.
About this post
- Posted
- Archived
- Edited
- Score
- 96 · 95% up
- Kind
- Text
- ID
- pec41w
32 comments
See
https://github.com/Foxboron/sbctl/issues/85#issuecomment-886539689
and
https://github.com/Foxboron/sbctl/issues/40
Many thanks. As an update, I can boot to Windows (which is what I have set
systemd-bootto default to), and I can work through an external monitor, but the internal display (and hence the UEFI setup menu) doesn't work.Is there any way I can enroll the Microsoft keys through PowerShell or something?
Did you try restarting directly into UEFI from Windows? My laptop mirrors the screen after reboot (or try with the laptop closed, make sure it doesnt go to standby in that case)
Reboot to UEFI from within Windows: press and hold shift when clicking 'Restart', go to advanced options (I think) and then select the UEFI thing. OR open CMD as admin and run
shutdown /r /fwI don't know windows sadly :/
Your setup very much mirrors my own (except I didn't know about sbctl, so I did it manually and installed mkinitcpio v31 to create the unified kernel image instead). It sucks that that happened.
This is just a very uneducated guess, I'm very much new to secure boot myself, but did you import the manufacturers key? I'm thinking that it's probably due to that, based on the warning in https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#Using_your_own_keys
Basically I'm suspecting that the nvidia device can't initialize in the uefi and it bricks the device. Again though, I only started with this myself last week so I'm very much new to it.
It is exactly this. Early ROM of nvidia GPU are UEFI secure boot signed by microsoft key and cant be validated by your own key.
Did you mean rom that are early in the boot process-like early stage-or that are early as in old versions of the ROM?
There are 2 Microsoft Certificates in the Factory DB. One is the Production, for Windows and stuff and the other is the UEFI Certificate. You may replace the PK and KEK, delete the production certificate, but you must leave the Microsoft UEFI certificate, as it's the one that NVIDIA uses to authenticate its products.
If can access the UEFI disable Secure Boot and you are ok. Of you can't, the only way is refreshing the BIOS. If your motherboard supports BIOS flashback, you may use it. If you have access to a EFI Shell or Windows, like you commented, maybe try it through the PowerShell.
In suma: Don't remove the Microsoft UEFI Certificate from the DB. Disable SecureBoot to recover access either through the UEFI itself or reflashing the BIOS.
Good Luck.
This is offtopic, but why are new laptops coming without S3 sleep support?
I finally upgraded from almost a decade old laptop and found out that my new laptop doesn't support S3 sleep, thankfully due to a dedicated community, there's a way to enable it using BIOS injection on mine.
Because, in all Microsoft's wisdom, it decided that leaving notebooks perennially connected to the internet even in 'sleep mode' was a good idea, and it was a good idea to leave them in S0 mode for that.
Read: Modern Standby vs S3.
Yeah, it's meant to mimic Android and iOS devices in terms of being able to do push notifications and stuff. Useful for tablet devices like Surface, not so useful elsewhere.
Some people would rather have deep sleep like S3, but for some idiotic reason, they decided to remove that entirely..........
If the UEFI flash chip is a SOIC-8 you should be able to find a copy of the stock UEFI online and flash that onto it with a cheap IC flashing clip and usb-serial adaptor or rasberry pie.
If it's smaller it might still be possible but it's gonna be fiddly. I did something similar with a xiaomi laptop recently except I forgot the UEFI password. Sadly the BIOS for my model was never posted online so I can't reflash it.
Yeah, this is why I wrote a post about it here. If you're not careful, you can brick your laptop.
SecureBoot in it's current form, is entirely under Microsoft's control and in their favour. Doing something different is extremely risky and can result in bricked hardware. You're basically punished for doing something they don't approve of.
Deleted before we saved it.
The battery is 95 Wh.
I haven't tried a full discharge yet, but it drains around 8% per hour on Arch with KDE Plasma and the
linux-zenkernel. Windows is slightly higher at around 10%. This is with Optimus enabled.I haven't performed any battery optimisations yet.
Yeah, you'd need the NVIDIA dGPU to turn on/off opportunistically.
I'm glad everything is resolved, but I'm trying to understand what happened here, for my own peace of mind.
Why could you not reboot into UEFI's menu and disable Secure Boot or simply re-enable Optimus?
Some devices (notably, discrete graphics cards from NVIDIA and AMD) have their own signed firmware (called 'option ROMs') that have to be loaded and validated/authenticated before the devices can be used.
I did not have Microsoft's signed key enrolled in my own key database, which led to the NVIDIA card's firmware not being authenticated correctly. /u/Ohlav's comment is clearer about this, as I am quite new to the whole Secure Boot thing myself.
For some reason, the GPU continued to output normally through the external video ports despite not sending a signal through the eDP cable to the notebook's internal display, which allowed me to boot into both OSes and subsequently enroll the key, to solve the issue.
So you're now able to use eDP, and internal display? I just got a new laptop too, i was going to self-sign, and came across with this and I'm scared a bit... So I wonder that If i self sign and import windows keys, will there be a problem?
SecureBoot is malware
No, but with the way things are, Microsoft has full and complete control of deciding who can compete and who cannot.
so, you agree?
Deleted before we saved it.