22

I have VPS, and after checking systemctl, I noticed that my fwupd-refresh.service failed.

terminal

Can you explain the problem, and could you help to fix it?

Pablo Bianchi
  • 17,552
seesharp
  • 333
  • 1
  • 2
  • 5

4 Answers4

20

In some cases this error can be safely ignored. fwupd-refresh.service just executes /usr/bin/fwupdmgr refresh command and treats exit status 2 as success (see last 2 lines of fwupd-refresh.service). But fwupdmgr can also successfully exit with status 0, which will be wrongfully interpreted by systemd as an error.

  • systemctl cat fwupd-refresh:

    # /lib/systemd/system/fwupd-refresh.service
    [Unit]
    Description=Refresh fwupd metadata and update motd
    Documentation=man:fwupdmgr(1)
    After=network.target
    
    

    [Service] Type=oneshot CacheDirectory=fwupdmgr StandardError=null DynamicUser=yes RestrictAddressFamilies=AF_NETLINK AF_UNIX AF_INET AF_INET6 SystemCallFilter=~@mount ProtectKernelModules=yes ProtectControlGroups=yes RestrictRealtime=yes SuccessExitStatus=2 ExecStart=/usr/bin/fwupdmgr refresh

  • sudo /usr/bin/fwupdmgr refresh:

    ...
    Successfully downloaded new metadata: 0 local devices supported
    
  • echo $?: 0

  • man fwupdmgr:

    EXIT STATUS
          Commands that successfully execute will return "0", but commands that have no actions but successfully execute will return "2".
    
Shevchuk
  • 373
  • Any idea why I'd get the following after /usr/bin/fwupdmgr refresh:

    Failed to connect to daemon: Error calling StartServiceByName for org.freedesktop.fwupd: Timeout was reached

    – Mike Ciffone Jun 14 '22 at 02:58
  • 1
    @MikeCiffone no, but these might be relevant: https://github.com/fwupd/fwupd/issues/1805 https://github.com/fwupd/fwupd/issues/4242 – Shevchuk Jun 14 '22 at 14:59
  • 4
    For anyone that experiences that timeout error: apt upgrade fwupd.service followed by /usr/bin/fwupdmgr refresh resolved it. – Mike Ciffone Jun 14 '22 at 16:02
  • To expand on comment from @MikeCiffone - This worked for me as well. I recently upgraded to 22.04 and it appears a few packages were in the hold state so apt would not upgrade them. Explicitly using the package name in the upgrade command gives apt the "ok" to upgrade that package. – mainmachine Oct 25 '22 at 16:20
  • 2
    Why not SuccessExitStatus=0 2, since fwupdmgr refresh can return both 0 or 2 in case of (some definition of) success? – user1202136 Jun 07 '23 at 13:02
15

In my own case (Ubuntu Server 20.04 with latest updates), DynamicUser=no provides quick&dirty solution.

First, run "systemctl edit fwupd-refresh" and enter:

[Service]
DynamicUser=no

Then, run "systemctl restart fwupd-refresh" and enjoy.

2

fwupd-refresh.service Loaded: masked

A service that is masked is disabled and can't be activated by an other unit (timers, targets, services...) that needs it or manually. It's the stronger version of disabling a service.

fwupd-refresh.timer: ...failed...unit fwupd-refresh is masked.

To change this:

sudo systemctl unmask fwupd-refresh

Then this:

sudo systemctl daemon-reload && sudo systemctl start fwupd-refresh.service
systemctl list-units --failed

If fwupd-refresh is listed as failed then:

Uncomment #DynamicUser=yes in /lib/systemd/system/fwupd-refresh.service

https://www.freedesktop.org/software/systemd/man/systemd.exec.html#DynamicUser=

  • Good stuff. I think you might want to add a sudo before: systemctl start fwupd-refresh.service – vin Oct 23 '22 at 04:21
2

I've solved my problem with it https://github.com/fwupd/fwupd/wiki/PluginFlag:legacy-bios

Simply adding "bios" at the end of this line DisabledPlugins=test;invalid;bios in

/etc/fwupd/daemon.conf