Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbus in the initrd just like this is a bad idea #2378

Open
poettering opened this issue Jun 7, 2023 · 7 comments
Open

dbus in the initrd just like this is a bad idea #2378

poettering opened this issue Jun 7, 2023 · 7 comments
Labels
bluetooth Issues related to the bluetooth module bug Our bugs dbus Issues related to the dbus module network-manager Issues related to the network-manager module systemd-networkd Issues related to the systemd-networkd module

Comments

@poettering
Copy link
Contributor

So I recently noticed that dracut nowadays embeds dbus in the initrd. That's a bad idea and leads to deadlocks like this one: https://bugzilla.redhat.com/show_bug.cgi?id=1976653#c4

This then led people to submit this PR: bus1/dbus-broker#271

Which is wrong too.

D-Bus simply isn't ready to run in the initrd, because it doesn't allow to schedule at which point in time services shall become activatable. activatable services are activatable during the entire runtime of the bus and if something talks via the bus to a service like that too early it will hang if the activation request cannot be fulfilled yet because the system is not booted up far enough for this to work. The result of that are deadlocks.

So, I am sorry, but the dbus support in dracut should never have been merged like this.

This can be solved properly, but requires some engineering in dbus. See: bus1/dbus-broker#259

But that hasn't materialized yet (though dbus-broker upstreams agree this makes sense). But until this running dbus in the initrd, is just prone to issues like the mentioned.

dbus-broker PR 271 is bogus if you ask me, because it rearranges an upstream unit file to match a downstream change in a unit file that dracut made. Specifically, dracut's dbus support patches out some deps in dbus.socket. But if so it should really patch out the same deps in the broker unit file too, and not expect upsrream dbus-rboker to adjust for that...

@poettering poettering added the bug Our bugs label Jun 7, 2023
@aafeijoo-suse
Copy link
Member

D-Bus simply isn't ready to run in the initrd, because it doesn't allow to schedule at which point in time services shall become activatable. activatable services are activatable during the entire runtime of the bus and if something talks via the bus to a service like that too early it will hang if the activation request cannot be fulfilled yet because the system is not booted up far enough for this to work. The result of that are deadlocks.

dracut has support for D-Bus since Nov 2020 (#900), I wonder how 2.5 years later this problem shows up.
@teg @dvdhrm could you share your opinion on this?

@poettering
Copy link
Contributor Author

It showed up in July 2021, see linked bug reports. people then tried to "fix" this with a change in systemd that i think is simply the wrong place.

I don't really grok what caused this to show up. as long as only wiced pulled in dbus the issue should have remain specific to suse i guess. but apparently some other modules started to pull in the dbus mess now which made this more visible.

@LaszloGombos
Copy link
Collaborator

LaszloGombos commented Jun 9, 2023

systemd-networkd, network-manager (and bluetooth) pulls in dbus now - all released with dracut v54 on May 14, 2021.

The referenced bug in the redhat bug database is from the systemd-networkd dracut module .

Possibly related existing dracut bugs - #1521 https://bugzilla.redhat.com/show_bug.cgi?id=1964879

CC @bengal and @lnykryn for visibility.

My suggestion at this point is to disable pulling in bluetooth dracut module by default (even if there is a bluetooth keyboard in use).

@dvdhrm
Copy link

dvdhrm commented Jun 12, 2023

dracut has support for D-Bus since Nov 2020 (#900), I wonder how 2.5 years later this problem shows up. @teg @dvdhrm could you share your opinion on this?

I think Lennart did a splendid job in explaining the race-condition regarding activation of dbus services. The underlying cause is a lack of APIs to add dbus-activatable-services at runtime. Hence, systemd has to treat all dbus-services activatable once dbus is running, which can easily conflict with configurations specified in the respective service units.

@LaszloGombos LaszloGombos added the dbus Issues related to the dbus module label Jun 15, 2023
@LaszloGombos LaszloGombos added systemd-networkd Issues related to the systemd-networkd module network-manager Issues related to the network-manager module bluetooth Issues related to the bluetooth module labels Jun 17, 2023
@LaszloGombos
Copy link
Collaborator

Does systemd-networkd actually have a hard dependency on dbus (I know network-manager and bluetooth do) ?

@poettering
Copy link
Contributor Author

it does not.

@jmpolom
Copy link

jmpolom commented Mar 26, 2024

Fedora has opted to remove the network-legacy module from dracut in Fedora 40 effectively forcing NetworkManager into the initrd if you need early boot networking. This seems like an actual problem given what's detailed here and no resolution to the issue described? I don't think anyone wants an initrd that deadlocks/hangs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bluetooth Issues related to the bluetooth module bug Our bugs dbus Issues related to the dbus module network-manager Issues related to the network-manager module systemd-networkd Issues related to the systemd-networkd module
Projects
None yet
Development

No branches or pull requests

5 participants