如何从命令行升级我的设备固件?

如何从命令行升级我的设备固件?

我很少使用 Ubuntu 软件应用程序,但今天打开它时,我看到它有一条通知,说我的指纹扫描仪固件可以更新。

软件中心更新

但是,apt upgradesnap refresh命令输出所有内容都是最新的。我的系统是否缺少第三个软件包来源?

danny@danny:~$ sudo apt update && sudo apt upgrade 
Hit:1 http://se.archive.ubuntu.com/ubuntu impish InRelease
Hit:2 http://se.archive.ubuntu.com/ubuntu impish-updates InRelease                                                                                                                                         
Hit:3 http://se.archive.ubuntu.com/ubuntu impish-backports InRelease                                                                                                                                       
Hit:4 https://dl.google.com/linux/chrome/deb stable InRelease                                                                                                                                              
Hit:5 https://download.docker.com/linux/ubuntu impish InRelease                                                                                                                                  
Hit:6 http://archive.canonical.com/ubuntu impish InRelease                                                                
Get:7 http://security.ubuntu.com/ubuntu impish-security InRelease [110 kB]                          
Hit:8 https://packages.microsoft.com/repos/ms-teams stable InRelease                     
Fetched 110 kB in 1s (127 kB/s)                          
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

答案1

谢谢@Ponjar 的@oldfred 的评论,事实证明还有另一个管理设备固件更新的管理器fwupd

简洁版本

要更新设备固件,您可以运行以下命令:

$ fwupdmgr update

更长的版本

注意:在我试用期间,这里提到的所有fwupdmgr命令都不需要 root 访问权限(即 sudo)才能运行。即使是更新固件的命令也是如此。

这使用左心室收缩功能(Linux 供应商固件服务)作为设备固件的源数据库。您可以通过在 中配置来添加更多来源/etc/fwupd/remotes.d/

要升级固件,可以使用命令fwupdmgr。该软件包似乎已在 Ubuntu 21.10 上预装。如果它不适合您,您可以使用以下命令安装它

sudo apt install fwupd

fwupdmgr您可以通过运行命令获取支持固件更新的设备列表fwupdmgr get-devices

$ fwupdmgr get-devices
WARNING: UEFI capsule updates not available or enabled in firmware setup
  See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information.
21A0000CMX
├─Prometheus:
│     Device ID:          96a0be68fa5cf5d60d3d2d392797c6844ab64d33
│     Summary:            Fingerprint reader
│     Current version:    10.01.3273255
│     Vendor:             Synaptics (USB:0x06CB)
│     Install Duration:   2 seconds
│     GUIDs:              09e8bf16-3e69-50f5-bb66-c7a040248352
│                         8088f861-6318-5b1e-9ce4-fbddbedb09ac
│     Device Flags:       • Updatable
│                         • Supported on remote server
│                         • Cryptographic hash verification is available
├─UEFI dbx:
│     Device ID:          362301da643102b9f38477387e2193e57abaa590
│     Summary:            UEFI Revocation Database
│     Current version:    267
│     Minimum Version:    267
│     Vendor:             UEFI:Linux Foundation
│     Install Duration:   1 second
│     GUIDs:              1e9c3d61-4bd9-514e-ad87-0a9b61b9e77d
│                         304a9ede-aff2-58f6-b5e5-0e651b065f1a
│                         c6682ade-b5ec-57c4-b687-676351208742
│                         f8ba2887-9411-5c36-9cee-88995bb39731
│     Device Flags:       • Internal device
│                         • Updatable
│                         • Needs a reboot after installation
└─UMIS RPETJ512MGE2QDQ:
      Device ID:          71b677ca0f1bc2c5b804fa1d59e52064ce589293
      Summary:            NVM Express Solid State Drive
      Current version:    1.3Q0630
      Vendor:             Union Memory (Shenzhen) (NVME:0x1CC4)
      GUIDs:              c3fe86aa-308e-53bc-aa93-00faaac3ef75
                          437d6904-49e7-551e-bbe9-1ae691ea1a37
                          6df6872d-19f7-5035-b85c-7c760034c77d
                          1d6b808f-3aac-5c20-8496-8a1433de5b80
                          1cabba58-9014-5a19-b40f-a6aa4b45676f
      Device Flags:       • Internal device
                          • Updatable
                          • System requires external power source
                          • Needs a reboot after installation
                          • Device is usable for the duration of the update

您还可以通过运行获取设备的状态(如果有可用的固件更新)fwupdmgr get-updates

$ fwupdmgr get-updates
WARNING: UEFI capsule updates not available or enabled in firmware setup
  See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information.
Devices with no available firmware updates: 
 • UEFI dbx
 • UMIS RPETJ512MGE2QDQ
21A0000CMX
└─Prometheus:
  │   Device ID:          96a0be68fa5cf5d60d3d2d392797c6844ab64d33
  │   Summary:            Fingerprint reader
  │   Current version:    10.01.3273255
  │   Vendor:             Synaptics (USB:0x06CB)
  │   Install Duration:   2 seconds
  │   GUIDs:              09e8bf16-3e69-50f5-bb66-c7a040248352
  │                       8088f861-6318-5b1e-9ce4-fbddbedb09ac
  │   Device Flags:       • Updatable
  │                       • Supported on remote server
  │                       • Cryptographic hash verification is available
  └─Prometheus Fingerprint Reader:
        New version:      10.01.3478575
        Remote ID:        lvfs
        Summary:          Firmware for the Synaptics Prometheus Fingerprint Reader device
        License:          Proprietary
        Size:             425.5 kB
        Created:          2021-06-09
        Urgency:          Medium
        Vendor:           Synaptics
        Duration:         2 seconds
        Flags:            is-upgrade
        Description:      
        New features and enhancements:
        
        • Fix an authentication issue on FOP project.

就我而言,最后一个命令列出“UEFI dbx”和“UMIS RPETJ512MGE2QDQ”为最新版本,“Prometheus”指纹扫描仪有可用的更新。

一旦您满意,您可以运行命令fwupdmgr update来安装所有可用的更新,或者手动将您想要更新的设备的设备 ID 传递给该命令fwupdmgr update 71b677ca0f1bc2c5b804fa1d59e52064ce589293

$ fwupdmgr update
WARNING: UEFI capsule updates not available or enabled in firmware setup
  See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information.
Devices with no available firmware updates: 
 • UEFI dbx
 • UMIS RPETJ512MGE2QDQ
Upgrade available for Prometheus from 10.01.3273255 to 10.01.3478575
Prometheus and all connected devices may not be usable while updating. Continue with update? [Y|n]: 
Downloading…             [***************************************] Less than one minute remaining…
Decompressing…           [***************************************]
Authenticating…          [***************************************]
Authenticating…          [***************************************]
Updating Prometheus…     [***************************************]
Restarting device…       [***************************************]
Successfully installed firmware

完成固件更新后,下次运行命令时fwupdmgr get-updates,它会提示您是否要上传固件报告。

$ fwupdmgr get-updates
WARNING: UEFI capsule updates not available or enabled in firmware setup
  See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information.
Devices with no available firmware updates: 
 • UEFI dbx
 • UMIS RPETJ512MGE2QDQ
Devices with the latest available firmware version:
 • Prometheus
________________________________________________

Devices that have been updated successfully:

 • Prometheus (10.01.3273255 → 10.01.3478575)

Uploading firmware reports helps hardware vendors to quickly identify failing and successful updates on real devices.
Upload report now? (Requires internet connection):
0.  Do not upload reports at this time, but prompt again for future updates
1.  Do not upload reports, and never ask to upload reports for future updates
2.  Upload reports just this one time, but prompt again for future updates
3.  Upload reports this time and automatically upload reports after completing future updates
2
Target:                  https://fwupd.org/lvfs/firmware/report
Payload:                 {
                           "ReportVersion" : 2,
                           "MachineId" : "fd438561a796bdbcccfc66169378030058c8a453066843b91fa6b107cd73c267",
                           "Metadata" : {
                             "DistroId" : "ubuntu",
                             "DistroVersion" : "21.10"
                           },
                           "Reports" : [
                             {
                               "Checksum" : "9e3cc95de4a157318c40135009249bb20fe6af7d",
                               "UpdateState" : 2,
                               "Guid" : [
                                 "09e8bf16-3e69-50f5-bb66-c7a040248352"
                               ],
                               "Plugin" : "synaptics_prometheus",
                               "VersionOld" : "10.01.3273255",
                               "VersionNew" : "10.01.3478575",
                               "Flags" : 37748770,
                               "Created" : 1645459678,
                               "Modified" : 1645460476,
                               "Metadata" : {
                                 "HostSku" : "LENOVO_MT_21A0_BU_Think_FM_ThinkPad P14s Gen 2a",
                                 "RuntimeVersion(org.freedesktop.gusb)" : "0.3.5",
                                 "CompileVersion(com.redhat.fwupdate)" : "12",
                                 "DistroVersion" : "21.10",
                                 "CompileVersion(org.freedesktop.fwupd)" : "1.5.11",
                                 "HostFamily" : "ThinkPad P14s Gen 2a",
                                 "KernelName" : "Linux",
                                 "RuntimeVersion(org.kernel)" : "5.13.0-28-generic",
                                 "CompileVersion(org.freedesktop.gusb)" : "0.3.5",
                                 "RuntimeVersion(com.dell.libsmbios)" : "2.4",
                                 "DistroId" : "ubuntu",
                                 "CpuArchitecture" : "x86_64",
                                 "BootTime" : "1645105544",
                                 "HostVendor" : "LENOVO",
                                 "RuntimeVersion(org.freedesktop.appstream-glib)" : "0.7.14",
                                 "HostProduct" : "21A0000CMX",
                                 "RuntimeVersion(com.redhat.fwupdate)" : "12",
                                 "RuntimeVersion(org.freedesktop.fwupd)" : "1.5.11",
                                 "KernelVersion" : "5.13.0-28-generic"
                               }
                             }
                           ]
                         }
Proceed with upload? [Y|n]: 
Idle…                    [***************************************]
Successfully uploaded 1 report
No updates available for remaining devices

答案2

这是@Dan 的回答。以下是更多背景、细节和摘要信息。

通过 Linux 命令行更新系统上的所有固件

这包括更新指纹识别器、键盘、UEFI、“系统固件”(包括 BIOS、USB 控制器等)中的固件,三星 990 PRO M.2 SSD旧固件错误地快速磨损并损坏驱动器, ETC。

快速摘要

这些是主要命令。因此,这是更新系统上所有固件的一行最小命令:

sudo apt update \
    && sudo apt install fwupd \
    && fwupdmgr get-updates \
    && fwupdmgr update

细节

https://en.wikipedia.org/wiki/Fwupd

fwupd是一个开源守护进程,用于管理基于 Linux 的系统上的固件更新安装,由 GNOME 维护者 Richard Hughes 开发。

它连接到 Linux 供应商固件服务 (LVFS),这里:https://fwupd.org/,其中指出:

Linux 供应商固件服务是一个安全门户,允许硬件供应商上传固件更新。

所有主流 Linux 发行版都使用该网站为fwupdmgrGNOME 软件等客户端提供元数据。

因此,我们使用fwupdmgr它来检查固件更新(可在 LVFS 中获取https://fwupd.org/,并由制造商放置在那里),并安装它们(如果有)。

fwupdmgr命令摘要

我已用 标记了主要命令,以<====使它们脱颖而出。

# Update your apt package manager's list of available packages to install,
# and their versions
sudo apt update

# Install the fwupd package
sudo apt install fwupd

# Check the help menu for fwupd
fwupdmgr --help
# Check the version
fwupdmgr --version

# List all devices that support firmware updates, and their current versions
fwupdmgr get-devices

# Check for firmware updates
# - This lists all devices with no available updates (because they are 
#   already up-to-date) at the top. 
# - Below that, it lists all devices with available updates, including the 
#   current version first, followed by the new version available.
fwupdmgr get-updates    # <====

# Perform all firmware updates (as listed by `fwupdmgr get-updates`)
fwupdmgr update         # <====

# Alias to the above `fwupdmgr update` command
fwupdmgr upgrade

这些是主要命令。因此,这是更新系统上所有固件的一行最小命令:

sudo apt update \
    && sudo apt install fwupd \
    && fwupdmgr get-updates \
    && fwupdmgr update

示例运行

fwupdmgr update这是在我的系统将“系统固件”从 v1.13.1 升级到 1.18.0 时运行该命令的示例。

Enter当被问到问题时,只需按即可接受默认选项。默认值以大写字母表示。例如:在Perform operation? [Y|n]-- 中,默认值为Y(yes),而在 中Restart now? [y|N],默认值为N(no)。

$ fwupdmgr update         # <====
Devices with no available firmware updates: 
 • VEN 04F3:00 04F3:311C
 • Fingerprint Sensor
 • PC801 NVMe SK hynix 1TB
 • SSD 970 EVO Plus 2TB
 • TPM 2.0
 • UEFI Device Firmware
 • UEFI Device Firmware
 • UEFI dbx
╔══════════════════════════════════════════════════════════════════════════════╗
║ Upgrade System Firmware from 1.13.1 to 1.18.0?                               ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ This stable release fixes the following issues:                              ║
║                                                                              ║
║ • This release contains security updates as disclosed in the Dell            ║
║ Security Advisories.                                                         ║
║ • Fixed the issue where the Wake on Approach feature does not work when      ║
║ the system enters Modern Standby mode. This issue occurs after updating the  ║
║ BIOS.                                                                        ║
║ • Fixed the issue where the system audio is distorted when you play          ║
║ videos.                                                                      ║
║                                                                              ║
║ Precision 5570 must remain plugged into a power source for the duration of   ║
║ the update to avoid damage.                                                  ║
╚══════════════════════════════════════════════════════════════════════════════╝

Perform operation? [Y|n]: 
Downloading…             [***************************************]
Downloading…             [***************************************]
Decompressing…           [***************************************]
Decompressing…           [***************************************]
Authenticating…          [***************************************]
Authenticating…          [***************************************]
Restarting device…       [***************************************]
Writing…                 [***************************************]
Scheduling…              [***************************************]
Decompressing…           [***************************************]
Restarting device…       [***************************************]
Waiting…                 [***************************************]
Successfully installed firmware
Do not turn off your computer or remove the AC adapter while the update is in progress.

An update requires a reboot to complete. Restart now? [y|N]: 

此时,您应该重新启动系统。选择y上面的选项,或运行reboot,或使用 GUI 菜单重新启动。当计算机进入 BIOS 闪存屏幕时,它将自动开始应用固件更新,如下所示:

在此处输入图片描述

完成重启后,fwupdmgr get-updates再运行一次并选择“是”以将报告上传给制造商,以帮助他们改进固件升级过程。您将看到此请求:Upload report now? (Requires internet connection) [Y|n]。以下是重启后的完整运行和输出:

$ fwupdmgr get-updates
Devices with no available firmware updates: 
 • PC801 NVMe SK hynix 1TB
 • SSD 970 EVO Plus 2TB
 • TPM 2.0
 • UEFI Device Firmware
 • UEFI Device Firmware
 • VEN 04F3:00 04F3:311C
 • Fingerprint Sensor
 • UEFI dbx
Devices not currently updatable:
 • System Firmware — Cannot install update when not on AC power
________________________________________________

Devices that have been updated successfully:

 • System Firmware (1.13.1 → 1.18.0)

Uploading firmware reports helps hardware vendors to quickly identify failing and successful updates on real devices.
Upload report now? (Requires internet connection) [Y|n]:

如果你fwupdmgr update现在跑步(或者甚至(当然,如果重新启动了,则会出现上述情况),您将看到所有内容都是最新的。这是fwupdmgr update通过 执行上述升级后在我的系统上再次运行 的示例fwupdmgr update。所有固件现在要么没有可用的更新,要么已经是最新的:

$ fwupdmgr update
Devices with no available firmware updates: 
 • VEN 04F3:00 04F3:311C
 • Fingerprint Sensor
 • PC801 NVMe SK hynix 1TB
 • SSD 970 EVO Plus 2TB
 • TPM 2.0
 • UEFI Device Firmware
 • UEFI Device Firmware
 • UEFI dbx
Devices with the latest available firmware version:
 • System Firmware

而且,如果您现在再次运行,您将在其输出的最底部fwupdmgr get-updates看到,如下所示:No updates available

$ fwupdmgr get-updates
Devices with no available firmware updates: 
 • VEN 04F3:00 04F3:311C
 • Fingerprint Sensor
 • PC801 NVMe SK hynix 1TB
 • SSD 970 EVO Plus 2TB
 • TPM 2.0
 • UEFI Device Firmware
 • UEFI Device Firmware
 • UEFI dbx
Devices with the latest available firmware version:
 • System Firmware
No updates available

参考

  1. @Dan 的回答
  2. https://en.wikipedia.org/wiki/Fwupd
  3. https://fwupd.org/- 连接的主要网站fwupdmgr,制造商会向其上传固件更新,以供fwupdmgr

也可以看看

  1. https://itsfoss.com/update-firmware-ubuntu/

  2. 请注意,如果你尝试升级Windows 上的三星 SSD 固件, 使用三星魔术师软件建议使用 GUI。它可以在 Windows、MacOS 和 Android 上运行,但不幸的是不能在 Linux 上运行。您可以在此处下载:https://semiconductor.samsung.com/us/consumer-storage/support/tools/.它将升级三星 M.2 980 Pro / 990 Pro 等 SSD 上的错误固件。

    对于 Linux,请尝试fwupdmgr update上面的命令。我尝试fwupdmgr将 SSD 放在外部Sabrent USB 3.2 外壳,不幸的是,它无法通过这种方式检测到三星 980 Pro SSD。接下来,我将使用笔记本电脑内的 SSD 再次尝试,运行fwupdmgr get-updatesfwupdmgr update从 Ubuntu Live USB 运行,看看是否可行。

    诀窍是尝试使用以下方法更新固件出去首先使用驱动器,以免损坏它,所以我需要一种方法来更新其固件,驱动器上还没有任何内容,并且驱动器内部安装在目标笔记本电脑中,以便可以正确检测到它,但是在运行 Linux 时,例如,从外部 Live USB 或其他东西,因为内部 SSD 将是空的。

  3. LinuxOPsys:如何使用fwupd

相关内容