如何通过命令行升级设备固件?

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

Software center updates

然而,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.

如果您点击您发布的屏幕截图上的更新按钮会发生什么? - PonJar
看起来有一个可用的固件更新管理器。https://linoxide.com/how-to-update-firmware-on-ubuntu-using-fwupd/ 我猜你已经安装了它才会收到那个消息。如果你想使用命令行,可以查看手册页。 - PonJar
我不想点击那个以便我可以验证收到的任何答案。否则,我将不得不等待另一个更新。你能写一个关于你的发现的答案吗?它看起来似乎是解决方案。 - Dan
我无法验证linoxide的文章是否准确。如果你选择按照它的方法操作,并且它有效的话,最好是自己回答问题并在一两天后接受它。 - PonJar
2可能是fwupd。使用LVFS进行固件更新的设备 https://fwupd.org/lvfs/devicelist sudo fwupdmgr get-devices & sudo fwupdmgr get-updates & sudo fwupdmgr update - oldfred
1个回答

感谢@Ponjar和@oldfred的评论,原来还有另一个管理设备固件更新的管理器叫做fwupd

简短版本

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

$ fwupdmgr update

更详细版本

注意:在我的测试中,这里提到的所有命令都不需要root访问权限(即sudo)来运行。甚至包括更新固件的命令。

此方法使用LVFS(Linux供应商固件服务)作为设备固件的源数据库。您可以通过在/etc/fwupd/remotes.d/中进行配置来添加更多的源。

要升级固件,可以使用fwupdmgr命令。该软件包似乎已预安装在Ubuntu 21.10上。如果对您而言未安装,可以使用以下命令进行安装:

sudo apt install fwupd

你可以通过运行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