无法启动 fwupd-refresh 服务

无法启动 fwupd-refresh 服务

我在多个 ubuntu 20 和 22 服务器上的此服务处于失败状态,这很烦人,因为它会在我的监控系统上触发警告。

我无法启动该服务,当journalctl -xe我尝试启动它时:

Jun 26 15:03:39 w03 systemd[1]: Starting Refresh fwupd metadata and update motd...
-- Subject: A start job for unit fwupd-refresh.service has begun execution
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit fwupd-refresh.service has begun execution.
--
-- The job identifier is 11102154.
Jun 26 15:03:39 w03 systemd[1]: fwupd-refresh.service: Main process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStart= process belonging to unit fwupd-refresh.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Jun 26 15:03:39 w03 systemd[1]: fwupd-refresh.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit fwupd-refresh.service has entered the 'failed' state with result 'exit-code'.
Jun 26 15:03:39 w03 systemd[1]: Failed to start Refresh fwupd metadata and update motd.
-- Subject: A start job for unit fwupd-refresh.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit fwupd-refresh.service has finished with a failure.

这是service fwupd-refresh status

● fwupd-refresh.service - Refresh fwupd metadata and update motd
     Loaded: loaded (/lib/systemd/system/fwupd-refresh.service; static; vendor preset: disabled)
     Active: failed (Result: exit-code) since Sun 2022-06-26 15:03:39 UTC; 1min 47s ago
TriggeredBy: ● fwupd-refresh.timer
       Docs: man:fwupdmgr(1)
    Process: 287257 ExecStart=/usr/bin/fwupdmgr refresh (code=exited, status=1/FAILURE)
   Main PID: 287257 (code=exited, status=1/FAILURE)

Jun 26 15:03:39 w03 systemd[1]: Starting Refresh fwupd metadata and update motd...
Jun 26 15:03:39 w03 systemd[1]: fwupd-refresh.service: Main process exited, code=exited, status=1/FAILURE
Jun 26 15:03:39 w03 systemd[1]: fwupd-refresh.service: Failed with result 'exit-code'.
Jun 26 15:03:39 w03 systemd[1]: Failed to start Refresh fwupd metadata and update motd.

我不知道在哪里可以找到更多日志来了解该问题,有什么想法吗?

答案1

编辑以下文件

/lib/systemd/system/fwupd-refresh.service

添加 User=root,这样就解决了服务失败的问题。

然后:

systemctl daemon-reload; service fwupd-refresh restart; service fwupd-refresh status

这是服务文件的一个示例。

[Unit]
Description=Refresh fwupd metadata and update motd
Documentation=man:fwupdmgr(1)
After=network.target

[Service]
Type=oneshot
User=root
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

相关内容