Commit Graph

295 Commits

Author SHA1 Message Date
Richard Hughes
ded5410f6d Delete unused EFI variables when deploying firmware
Unconditionally delete FWUPDATE_VERBOSE and FWUPDATE_DEBUG_LOG when deploying
the update using fwupdtool or fwupd and leave it to fwupdate.

If you want to debug the efi binary you then have to use fwupdate and squirt
the .cap file rather than using all the other layers.
2020-10-27 17:05:01 +00:00
Richard Hughes
49c2a78c99 Include the amount of NVRAM size in use in the LVFS failure report 2020-10-27 13:58:40 +00:00
Mario Limonciello
8aa5d41eb7 Add external interface messages 2020-10-26 12:05:20 -05:00
Richard Hughes
e80547e8fc Record the TPM version when reporting a UEFI update
Fixes https://github.com/fwupd/fwupd/issues/2391
2020-10-22 16:16:23 +01:00
Richard Hughes
c7283ea61e uefi: Drop efivar dependency 2020-10-19 16:13:21 +01:00
Richard Hughes
81b5defaa6 uefi: Use fu_efivar_get_data() to fix setting BootNext correctly
Fixes https://github.com/fwupd/fwupd/issues/2169
2020-10-19 16:13:21 +01:00
Mario Limonciello
61ba02ae16 trivial: increase debugging for for fu-uefi-bootmgr.c
See #2169 for more context
2020-10-15 17:02:04 -05:00
Richard Hughes
7bcb8d4385 Export FwupdPlugin so we can convey enumerated system errors to the end user
For instance, we can tell the user that UEFI UpdateCapsule is disabled in the
system firmware, or that efivarfs is not mounted. This is much better than
creating "dummy" devices which are really just hacks around the problem because
no better API existed. THe dummy devices cause as many problems as they solve.

Plugins have to set FWUPD_PLUGIN_FLAG_USER_WARNING if a warning should be shown
to the user, and only one warning will be shown of each failure type.

It is expected that GUI clients like gnome-software and gnome-firmware would use
this API to notify the user the localized message for why firmware updates are
not being shown.

Fixes https://github.com/fwupd/fwupd/issues/2456
2020-10-13 15:56:49 +01:00
Érico Rolim
acd95c661b uefi: add configuration option for objcopy utility. 2020-10-10 12:32:13 +01:00
Richard Hughes
e6eb913b74 uefi: Only set the version format for ESRT entries
Setting the default to number unconditionally causes problems when the device
is created using _register_proxy_device().

Based on a patch by Mario Limonciello <mario.limonciello@dell.com>, many thanks.
2020-10-08 10:34:23 -05:00
Mario Limonciello
e8a2fc8c57 uefi: Make udisks2 errors more apparent
When support for dynamically mounting disks was added for 25ba41579f
udisks2 became a harder dependency and it was less obvious to users.

Create devices but show an error in why devices aren't updatable if
it's not found.

Users can still configure ESP manually in `uefi.conf`

Fixes: #2444
2020-10-08 09:16:32 -05:00
Mario Limonciello
c5ea3a39f9 trivial: uefi: quiet down debugging messages
With how well fwupd UEFI updates work these days >99% of people
don't need to see messages about the capsule update running.
Those who have problems, this isn't going to help them.
2020-10-03 06:58:13 -05:00
Richard Hughes
7d1267fd84 Clarify various parts of the HSI specification
Firsly, that HSI isn't expected for embedded devices and then secondary how we
require SecureBoot to be available for HSI:1

At the moment we get a runtime failure if it is disabled. Making SB a part of
`HSI:1` makes this requiremnt explicit and prevents us getting `HSI:2!` if it
is not available.
2020-10-02 09:13:56 +01:00
Mario Limonciello
67a8b89453 trivial: clean up some debugging statements 2020-09-28 15:58:53 -05:00
Mario Limonciello
5d902778e4 trivial: uefi: remove extra flag for secure boot (shown in device flags) 2020-09-28 15:58:53 -05:00
Richard Hughes
9a1e8e44e0 uefi: Fix critical warning regression with 'fwupdate -a'
Set the ESP when creating the device with a known GUID.

Fixes https://github.com/fwupd/fwupd/issues/2406
2020-09-21 17:00:12 +01:00
Mario Limonciello
88f0d422ec uefi: correct a logic error in TPM PCR reading (Fixes: #2382)
069449e tried to avoid issues with all zero TPM PCR's, but caused
a problem with any byte was zero.
2020-09-15 14:38:52 -05:00
Richard Hughes
db344d5a40 trivial: Fix several small memory leaks discovered with valgrind 2020-09-09 14:16:49 -05:00
Mario Limonciello
110eb286bc Make TPM more optional (Fixes: #2360)
- Rename the `plugin_tpm` option to `tpm` and when it's disabled
remove TPM support from all plugins
- If enabled then require the TSS to be installed
2020-09-08 15:16:58 -05:00
Richard Hughes
d3f60abe6d uefi: Port the plugin to use FuVolume 2020-08-12 18:35:15 +01:00
Mario Limonciello
0ebddc9fcf trivial: fix some unused variables found by clang-10 2020-08-10 10:33:31 -05:00
Mario Limonciello
6a6029f132 uefi: disable plugin if efivar is not supported
Don't even try to coldplug the device.

Fixes: #2237
2020-06-30 13:55:33 -05:00
Mario Limonciello
4669dd590a trivial: uefi: drop secure boot check at coldplug
We'll instead check this when the user tries to run an update.  This
allows them to sign a bootloader after the daemon starts (or remove
a signed bootloader after starting)

Fixes: #2219
2020-06-24 08:18:48 -05:00
Mario Limonciello
91e27e145a Add a new plugin for legacy BIOS
This plugin is only enabled when coreboot isn't detected.
It intentionally does not check for EFI to be disabled at startup
since it can also notify the user that UEFI capsule updates are
disabled on the system even if running in UEFI mode.
2020-06-22 11:22:18 +01:00
Richard Hughes
b114661a25 Collect per-device report metadata for the history database
Add two new vfuncs that can be used to collect report metadata from devices
both before and after the update has run. This means we can remove the hacks
where we set add 'global' metadata entries and just hope that there is only one
device from the same plugin that is updated.

This also allows us to collect debugging metadata from devices after an offline
update has been run.
2020-06-16 15:49:28 +01:00
Mario Limonciello
2caea54202 uefi: check for free space after cleaning up ESP
In a very small ESP situation it's possible that the amount of free
space is insufficient until it's actually been cleaned.

Fixes: #2179
2020-06-15 10:21:18 -05:00
Mario Limonciello
d5d496b62a trivial: uefi: fix dell TPM updates
Adding an extra header makes the firmware reject the GUID in the real
header.
2020-05-29 07:31:15 -05:00
Mario Limonciello
d39bcee29d trivial: detect cpuid.h and also look for host architecture
Fixes cross compilation for arm with clang which provides cpuid.h
but helpfully has this error:
```
 #if !(__x86_64__ || __i386__)
 #error this header is for x86 only
 #endif
```

Fixes: #2131
2020-05-26 15:06:08 -05:00
Richard Hughes
e3091c394b trivial: Move the SecureBoot attr to a runtime issue 2020-05-22 15:15:09 +01:00
Richard Hughes
b246bcaecb Allow client tools to translate the HSI attributes and results
To do this, rely on the AppStream ID to map to a translated string (providing a
fallback for clients that do not care) and switch the free-form result string
into a set of enumerated values that can be translated.

This fixes some of the problems where some things have to be enabled to "pass"
and other attributes have to be some other state. For cases where we want the
user to "do" something, provide a URL to a wiki page that we update out-of-band
of fwupd releases.
2020-05-18 17:03:49 +01:00
Richard Hughes
cae111d1de Save the plugin that created the FwupdSecurityAttr
This is really useful for debugging.
2020-05-15 16:17:27 +01:00
Richard Hughes
c1eda7d516 Add many new plugins to support for the Host Security ID
The HSI specification is currently incomplete and in active development.

Sample output for my Lenovo P50 Laptop:

    Host Security ID: HSI:2+UA!

    HSI-1
    ✔  UEFI dbx: OK
    ✔  TPM: v2.0
    ✔  SPI: Write disabled
    ✔  SPI: Lock enabled
    ✔  SPI: SMM required
    ✔  UEFI Secure Boot: Enabled

    HSI-2
    ✔  TPM Reconstruction: Matched PCR0 reading

    HSI-3
    ✘  Linux Kernel S3 Sleep: Deep sleep available

    HSI-4
    ✘  Intel CET: Unavailable

    Runtime Suffix -U
    ✔  Firmware Updates: Newest release is 8 months old

    Runtime Suffix -A
    ✔  Firmware Attestation: OK

    Runtime Suffix -!
    ✔  fwupd plugins: OK
    ✔  Linux Kernel: OK
    ✔  Linux Kernel: Locked down
    ✘  Linux Swap: Not encrypted
2020-05-12 21:20:18 +01:00
Richard Hughes
0258c12af3 uefi: Manually call fu_device_setup() during coldplug
This forces the daemon to convert the main-system-firmware instance ID to a
GUID, which allows us to find it using fu_device_list_get_by_guid()
2020-05-01 19:26:52 +01:00
Richard Hughes
0d4e2ca4c5 Make tss2-esys conditional
This is not provided in RHEL 8 in the default build root.
2020-04-22 09:36:14 +01:00
Sam Morris
6a161aa1d1 uefi: correctly format firmware version of Dynabook (né Toshiba) X30, X40 and probably others
Fixes #1998
2020-04-15 13:00:26 +01:00
Mario Limonciello
7b866e5f92 uefi: Don't use shim for non-secure boot configurations
Since the entry is dynamically created this removes one area that
can potentially cause failures.
Helps: #1794
2020-03-16 06:55:05 -05:00
Mario Limonciello
6a0f25f649 trivial: uefi: restore uefi.quirk
It was a casualty in 6f8a3da8f0
2020-03-06 12:10:15 +00:00
Richard Hughes
a32034b844 Drop UEFI quirks we now inherit from metadata
Fixes https://github.com/fwupd/fwupd/issues/1843
2020-03-06 12:10:15 +00:00
Mario Limonciello
b87d48a042 When TPM PCR0 measurements fail, query if secure boot is available and enabled
If the measurements are missing but it's a UEFI system, it's a good indication
that the user has secure boot turned off.
Notify the user on the UEFI device through a non-fatal `UpdateMessage`

To accomplish this, move fu-uefi-vars into the plugin library for other plugins to use
2020-03-05 07:54:15 -06:00
Mario Limonciello
be1a555737 trivial: uefi: set vendor ID on dummy device 2020-03-05 07:54:15 -06:00
Richard Hughes
b097603800 Allow server metadata to set the version format on some devices
It appears just choosing 'if Dell then QUAD else TRIPLET' isn't good enough.
2020-02-26 15:45:40 +00:00
Richard Hughes
f50ff2c27e Decouple the version format from the version itself
If we say that the version format should be the same for the `version_lowest`
and the `version_bootloader` then it does not always make sense to set it at
the same time.

Moving the `version_format` to a standalone first-class property also means it
can be typically be set in the custom device `_init()` function, which means we
don't need to worry about *changing* ther version format as set by the USB and
UDev superclass helpers.
2020-02-25 14:00:09 +00:00
Mario Limonciello
c1776c9ad4 Add raw versions for bootloader and lowest
The assumption is that same version format is used for all 3 of these
versions.
2020-02-25 12:20:51 +00:00
Richard Hughes
f43381f4a7 Allow server metadata to set the device name on some devices
This does 'bleed' the metadata contents into areas previously covered by quirks,
but in this case may be pragmatic and more up to date than a build-time
generated quirk file, which increases the user-friendliness of fwupdmgr.
2020-02-24 14:15:34 +00:00
Mario Limonciello
9ee0e63e53 trivial: add some better descriptions for man pages
Since more utilities are now in `bindir`, they should be more descriptive.
2020-02-20 09:34:10 -06:00
Mario Limonciello
21e7faa78b uefi: Move fwupdate into bindir
Intended to be executed by users for debugging purposes, create a man
page as well.
2020-02-20 09:02:11 -06:00
Richard Hughes
334ba7994c trivial: Add helper fu_plugin_get_config_value_boolean() 2020-02-20 14:55:10 +00:00
Richard Hughes
6f8a3da8f0 Generate an additional UEFI quirk file using the stable LVFS metadata
The UEFI ESRT table just gives us a table of GUIDs with some basic flags, and
isn't very useful to end users. This is acceptable for Dell as there is only
typically one ESRT entry, which is for the system firmware. On typical Lenovo
hardware there might be half-a-dozen different 'Device' entries which all look
very similar.

As it's not possible to get a channel-of-data from the ODMs to fwupd, use the
existing LVFS metadata to generate some better names for these devices.
Although this looks like a lot of repeated data, libxmlb helpfully dedupes the
strings for us, making the quirk store only slightly larger.

Also, I've deliberately made this a manual step as we're not going to have
internet access on distro builders, and I'd also like the fwupd tarball output
to be deterministic and repeatable.
2020-02-14 17:14:24 +00:00
Bhaskar Upadhaya
73461ca1b7 uefi: Apply capsule update even with single valid capsule
Currently if there is an invalid boot entry for firmware update, the fwupd
EFI program will not call UpdateCapsule(), even if there is a valid entry.

For example, if the following entries exist the firmware update will fail:

HD(1,GPT,A672BBCA-325E-4D6F-91E1-DD57FAA85A9C)/\EFI\rhel\fw\fwupdate-6cialq.cap ... /*Valid entry*/
HD(1,GPT,E8176B29-6F73-43F2-AE8E-05E09DE20EE5)/\EFI\fedora\fw\fwupd-6dcbd5ed-e82d-4c44-bda1-7194199ad92a.cap ... /*InValid entry*/

Ensure capsule update is happening even if a valid capsule entry exists.

Signed-off-by: Bhaskar Upadhaya <bupadhaya@marvell.com>
2020-02-14 15:37:08 +00:00
Richard Hughes
52cda3db9c uefi: Find the correct lds and crt name when specifying -Defi_ldsdir
This fixes the Flatpak build of fwupd.
2020-02-13 17:56:33 +00:00