Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 943319 - sys-apps/fwupd-2.0.1: Error "Failed to load daemon: syscall filtering is configured but not working" is back
Summary: sys-apps/fwupd-2.0.1: Error "Failed to load daemon: syscall filtering is conf...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: John M. Harris, Jr.
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2024-11-12 11:24 UTC by Klaus Kusche
Modified: 2024-12-13 09:35 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.txt,9.45 KB, text/plain)
2024-11-16 21:29 UTC, Klaus Kusche
Details
Kernel .config (.config,148.22 KB, text/plain)
2024-11-16 21:39 UTC, Klaus Kusche
Details
fwupd.service as installed by emerge on my Gentoo system (fwupd.service,1.45 KB, text/plain)
2024-11-17 18:57 UTC, Klaus Kusche
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Kusche 2024-11-12 11:24:06 UTC
When trying to run fwupdmgr, it hangs.

journalctl:
Nov 12 12:07:55 lap dbus-daemon[433]: [system] Activating via systemd: service name='org.freedesktop.fwupd' unit='fwupd.service' requested by ':1.104' (uid=0 pid=38477 comm="fwupdmgr refresh>

Nov 12 12:07:55 lap systemd[1]: Starting Firmware update daemon...

Nov 12 12:07:55 lap fwupd[38487]: Failed to load daemon: syscall filtering is configured but not working

Nov 12 12:07:55 lap systemd[1]: fwupd.service: Main process exited, code=exited, status=1/FAILURE

Nov 12 12:07:55 lap systemd[1]: fwupd.service: Failed with result 'exit-code'.

Nov 12 12:07:55 lap systemd[1]: Failed to start Firmware update daemon.

Nov 12 12:08:20 lap dbus-daemon[433]: [system] Failed to activate service 'org.freedesktop.fwupd': timed out (service_start_timeout=25000ms)

This is on a systemd gentoo.

fwupd was emerged with 

[ebuild   R    ] sys-apps/fwupd-2.0.1::gentoo  USE="amdgpu archive bash-completion cbor gnutls lzma nvme policykit spi systemd uefi -amt -bluetooth (-elogind) -fastboot -flashrom -gtk-doc -introspection -logitech -minimal -modemmanager -sqlite -synaptics -test -tpm" PYTHON_SINGLE_TARGET="python3_12 -python3_10 -python3_11 -python3_13" 4855 KiB


The same problem also existed in 1.9.x fwupd, but was definitely fixed in 1.9.20, see my comment 1 in bug 931500 and upstream bug 
https://github.com/fwupd/fwupd/issues/7144

However, the meson.build commit applied to fix 7144 is present in the current gentoo 2.0.1 build, so this is most likely "same error message, but different reason".
Comment 1 Klaus Kusche 2024-11-12 11:28:08 UTC
Downgraded to 1.9.24, this one works fine.
Comment 2 Klaus Kusche 2024-11-16 13:42:09 UTC
See also https://github.com/fwupd/fwupd/issues/8078
Comment 3 John M. Harris, Jr. 2024-11-16 21:14:22 UTC
Unfortunately, I haven't been able to reproduce this on any of my devices.

Did you restart the fwupd service before running fwupdmgr? Does fwupdtool work?
Comment 4 John M. Harris, Jr. 2024-11-16 21:20:10 UTC
Given that error message comes from the daemon, that was a dumb question. Could you please attach `emerge --info`?
Comment 5 Klaus Kusche 2024-11-16 21:29:30 UTC
Created attachment 908818 [details]
emerge --info
Comment 6 Klaus Kusche 2024-11-16 21:39:12 UTC
Created attachment 908819 [details]
Kernel .config

Kernel .config is from 6.11.8, fwupd error was with 6.11.6 or 7,
but I didn't change the config since then.
Comment 7 Klaus Kusche 2024-11-16 21:42:19 UTC
(In reply to John M. Harris, Jr. from comment #3)
> Unfortunately, I haven't been able to reproduce this on any of my devices.
> 
> Did you restart the fwupd service before running fwupdmgr? Does fwupdtool
> work?

I will re-emerge 2.0.1 und test fwupdtool tomorrow.
Comment 8 Klaus Kusche 2024-11-17 18:54:39 UTC
Did some testing with 2.0.1:

1.) The fwupd daemon is auto-started by systemd on demand, not when booting:
As soon as I invoke fwupdmgr on the command line,
the error message mentioned above appears in the syslog.
Nothing about fwupd in the syslog before that.

2.) fwupdtool works without problems, 
at least for the commands refresh and get-updates.

3.) fwupdmgr refresh and get-updates also work without problems
after I manually start /usr/libexec/fwupd/fwupd in another terminal as root
before invoking fwupdmgr.

And /usr/libexec/fwupd/fwupd outputs only expected warnings to its terminal,
nothing related to syscall filtering.

This could indicate that something is wrong with Gentoo's fwupd.service?
Comment 9 Klaus Kusche 2024-11-17 18:57:49 UTC
Created attachment 908890 [details]
fwupd.service as installed by emerge on my Gentoo system
Comment 10 John M. Harris, Jr. 2024-11-23 23:52:59 UTC
Could you please try with USE=flashrom? Removing that USE flag from my Dell systems, I can reproduce this.
Comment 11 Klaus Kusche 2024-11-24 10:48:22 UTC
(In reply to John M. Harris, Jr. from comment #10)
> Could you please try with USE=flashrom? Removing that USE flag from my Dell
> systems, I can reproduce this.

flashrom does not make a difference for me: It fails with and without flashrom.

But I analyzed the problem:

On startup, the fwupd daemon actually checks that syscall filtering is working:
It tries a mlock system call which should be filtered (i.e. should fail),
and if that mlock succeeds, it terminates itself with 
"Failed to load daemon: syscall filtering is configured but not working".

fwupd relies on systemd for syscall filtering.
However, syscall filtering in systemd is optional:
It is only compiled into systemd with USE=seccomp.
Without USE=seccomp, systemd silently ignores syscall filtering
and lets all syscalls pass through.
On all my systems, systemd is built without seccomp.

So there are two different ways to solve the problem
(tried both, both work for me):

* Either make the fwupd ebuild depend on systemd[seccomp]
(I don't like that solution: Don't force security onto systems
which do not want or need to be secure).

* Or (if systemd is built without seccomp) modify fwupd's meson-build
(or the final fwupd.service), removing the line
Environment="FWUPD_SYSCALL_FILTER=systemd".
Without that line, fwupd does not check syscall filtering on startup.

Perhaps the fwupd ebuild should also get a USE=seccomp flag?
Comment 12 Klaus Kusche 2024-11-24 17:27:27 UTC
Two upstream patches (data/meson.build and meson_options.txt),
fix the problem for me, see
https://github.com/fwupd/fwupd/issues/8078

The patches introduce a new bool meson variable systemd_syscall_filter.
It needs to be set to false in the ebuild if systemd does not have syscall filtering.

At the first glance, the following changes are needed
if those patches are accepted upstream:

* Introduce a new USE seccomp in fwupd, valid only if USE systemd is set

* Depend on systemd[seccomp] if USE seccomp is set

* Set meson systemd_syscall_filter to true or false depending on USE seccomp
Comment 13 Joakim Tjernlund 2024-11-28 18:22:40 UTC Comment hidden (offtopic)
Comment 14 Joakim Tjernlund 2024-12-09 17:12:27 UTC Comment hidden (offtopic)
Comment 15 Larry the Git Cow gentoo-dev 2024-12-13 09:35:53 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=daa6d2e14eeed0862de714a73cf480ba0a5e2407

commit daa6d2e14eeed0862de714a73cf480ba0a5e2407
Author:     John M. Harris Jr. <johnmh@johnmh.me>
AuthorDate: 2024-12-10 07:04:06 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-12-13 09:34:22 +0000

    sys-apps/fwupd: add 2.0.3
    
    Introduces USE=seccomp for systemd seccomp filtering.
    
    Closes: https://bugs.gentoo.org/943319
    Signed-off-by: John M. Harris Jr. <johnmh@johnmh.me>
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/fwupd/Manifest           |   1 +
 sys-apps/fwupd/fwupd-2.0.3.ebuild | 190 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 191 insertions(+)