Skip to content

Start sysext.service in initramfs too#39410

Closed
esposem wants to merge 1 commit intosystemd:mainfrom
esposem:sysext-initrd
Closed

Start sysext.service in initramfs too#39410
esposem wants to merge 1 commit intosystemd:mainfrom
esposem:sysext-initrd

Conversation

@esposem
Copy link
Copy Markdown
Contributor

@esposem esposem commented Oct 22, 2025

More context explained here: #38985

@YHNdnzj
Copy link
Copy Markdown
Member

YHNdnzj commented Oct 22, 2025

Sorry, but this seems very wrong.

First of all, systemctl reload systemd-sysext.service and stop must operate on the real root and not assume the service always executes in initrd context. Please add a new systemd-sysext-sysroot.service for this purpose.

Secondly, we discussed this again in systemd chat. My thinking is that systemd-sysext-sysroot.service should be configurable via initrd preset, and instead of changing fstab-generator the unit can just carry WantsMountsFor=/var/lib/sysexts. That way the mount is established in initrd only if the user is using sysext.

In particular, each level of /var/lib/sysexts/ might be a separate mount, hence your patch here is not comprehensive.

@YHNdnzj YHNdnzj added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Oct 22, 2025
@esposem
Copy link
Copy Markdown
Contributor Author

esposem commented Oct 22, 2025

Sorry, but this seems very wrong

That's why it's in a draft ;)
Anyways I initially thought you meant "this concept is very wrong" so I'm glad you only mean my patch.

Yes I can do a separate unit, and we can keep sysext.service but then what would be the difference with sysext-sysroot? Especially if they are both enabled, what would bring the second?

Also as I pointed in the issue, how are we going to disable sysext-sysroot without rebuilding the initramfs? Either a config or a file to be checked?

@esposem esposem force-pushed the sysext-initrd branch 3 times, most recently from 5fc6593 to 05d3260 Compare October 23, 2025 07:50
Introduce systemd-sysext-sysroot.service to run in initramfs, meaning
the service still looks for units in /sysroot but it does it before
switch-root.

Because units are usually in /var/lib/extensions, add also a wants
dependency on that, to be sure it is mounted accordingly.

Same applies for confext
@pothos
Copy link
Copy Markdown
Contributor

pothos commented Dec 12, 2025

Thanks for working on this. I've had the same goal and opened a couple of PRs to fix blocker issues mainly due to broken --root= support but we should also avoid another refresh during boot and there's one more PR introducing a skip logic.
#39843
#39991
#40063
#39980
I've tested them together (there was one more merged PR for initrd detection) and then mounting from the initrd worked nice!

Documentation=man:systemd-confext-sysroot.service(8)

ConditionCapability=CAP_SYS_ADMIN
ConditionDirectoryNotEmpty=|/sysroot/var/lib/confexts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also to consider: mutable extensions

systemd-confext (and sysext) support an automatic mutability mode, where a mutable extension is placed in /var/lib/extensions.mutable and then confext will mount it over /etc. This patch doesn't seem to account for that

AssertPathExists=/etc/initrd-release

DefaultDependencies=no
After=sysroot.mount sysroot-usr.mount initrd-root-fs.target initrd-parse-etc.service
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You run this after initrd-parse-etc but it should probably happen before? Given that the confext merging changes the contents of /etc?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC @YHNdnzj you seem to be the person that suggested this run after initrd-parse-etc. But that really doesn't make sense, since /etc/fstab is going to be handled via a confext on systems that use a mutable confext to manage /etc

Trying to parse /etc/fstab before you setup the confext isn't going to work because there isn't going to be an /etc/fstab to parse.

@poettering
Copy link
Copy Markdown
Member

Let's close this one and continue in #41161

@poettering poettering closed this Mar 25, 2026
@github-actions github-actions bot removed the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants