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

RFE: remove from mkosi-initrd the udev rules copied from dracut #3404

Open
aafeijoo-suse opened this issue Jan 22, 2025 · 5 comments
Open

RFE: remove from mkosi-initrd the udev rules copied from dracut #3404

aafeijoo-suse opened this issue Jan 22, 2025 · 5 comments
Labels

Comments

@aafeijoo-suse
Copy link
Contributor

We should consider removing these 2 udev rules:

I had not any problem booting LVM on top of RAID using initrds generated by mkosi without the 2nd udev rule, but maybe I'm missing a specific case.

@prajnoha, @teigland, could any of you confirm if it is still required to set db_persist for LVM on md devices? In that case, a PR can be submitted here https://github.com/md-raid-utilities/mdadm, so we can safely remove the 2nd rule.

@DaanDeMeyer
Copy link
Contributor

10-mkosi-initrd-dm.rules is no longer necessary since 10-dm-rules sets the db_persist option (https://gitlab.com/lvmteam/lvm2/-/commit/eb4f744820832aff3d6da1bba14f12e91a5b3535).

So annoyingly enough, Ubuntu is rather behind on newer versions of lvm2, and even in Noble they only have 2.03, which does not have the upstreamed udev rules yet.

@aafeijoo-suse
Copy link
Contributor Author

So annoyingly enough, Ubuntu is rather behind on newer versions of lvm2, and even in Noble they only have 2.03, which does not have the upstreamed udev rules yet.

Thanks, I didn't know that. At least now we have this issue open so we can track the status of these leftovers.

@prajnoha
Copy link

prajnoha commented Jan 23, 2025

@prajnoha, @teigland, could any of you confirm if it is still required to set db_persist for LVM on md devices? In that case, a PR can be submitted here https://github.com/md-raid-utilities/mdadm, so we can safely remove the 2nd rule.

If there's an LV on top of an MD device, the dracut in initrd will activate both layers properly - there' s no problem with that.

The db_persist is needed only for tracking the activation state of LVM and MD devices over to rootfs. That is because of their multi-step activation scheme where we need to differentiate various "add" udev events properly and to do that, we need to persist certain records in udev db.

In case the db_persist was missing for MD devices, the udevadm trigger --action=add (that is also used for after-pivot-to-root-fs "coldplug" as part of systemd-udev-trigger.service) would not trigger the pvscan on such MD devices, which in turn would not activate any LVs on top of MDs during the coldplug. But in majority of situations, the whole stack with MD and LVM is activated in initrd already (if needed - if not, the stack is activated after pivot to root fs). So we don't need to care that much - it's already activated fully or not, the job is done.

The issues would be if we already activated the MD layer in initrd, not using the db_persist, and then trying to autoactivate the LVM layer after pivot to root fs. And it's just the --action=add that would not work, the --action=change still works even without the db_persist.

In my opinion, It's still good to have the db_persist in place for consistency and completeness to avoid future surprises like "why don't the udev trigger with ADD event work for the stack where we have LVM on top of an MD device?". These are exactly the details and little omissions that can cause hidden issues and which we can prevent. So in case we're using the same MD udev rules for both initrd and rootfs, we should add the db_persist to the MD udev rules, just like we did for LVM already.

@aafeijoo-suse
Copy link
Contributor Author

Thank you very much for your feedback.

But in majority of situations, the whole stack with MD and LVM is activated in initrd already (if needed - if not, the stack is activated after pivot to root fs). So we don't need to care that much - it's already activated fully or not, the job is done.

That explains why I could not reproduce the issue.

@aafeijoo-suse
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants