Repository navigation
Conversation
|
We generally want to keep the behavior of gpt-auto and dissect-image in sync, and that doesn't use /boot/efi/ either. TBH, I don't think this change makes much sense. In most cases, people who are still using legacy setups don't make use of DDI anyway. IOW, changing the ESP mountpoint from /boot/efi/ to /efi/ is fairly trivial, and we should really encourage that instead. |
|
Also, creating /efi/ if rw mounted and fail otherwise is very much consistent behavior to me. |
|
Note that if the ESP is listed in fstab, no matter where it is mounted, the gpt-auto logic will be skipped. See fstab_has_node call above. So the last two changes really make no sense. |
|
sorry, i seldom do this, but here it's necessary: hard NAK. nesting the ESP inside of /boot/ is just wrong. people should stop doing that, and we should not just silently accept this. I think it's ok to look for stuff in /boot/efi I think, if other set it up like this, but we should never set things up like this on our own. sorry, but no. please split out the 2nd commit, it makes sense on its own. |
I see. I was confused by the fact that, in my testing case, the call to BTW how can you make sure that the call to AFAICS this function assumes that udev is running but since this code is called from a generator, this assumption might be not true (think about initrdless systems). |
When ESP is on /boot/efi and an entry in fstab exists, DPS says that the image is compliant. Therefore:
Just to be clear I'm not arguing for ESP on /boot/efi. I'm just trying to prevent systemd from behaving badly when it encounters cases where ESP is on top /boot/efi |
Not if the image specifies a different path for ESP (other than /boot/ or /efi/) in fstab. At least the DPS seems to support this case. Also I'm wondering if silently modifying the image (by creating the missing mount points) is a good idea. At least by default I wouldn't do that. |
c84b392 to
eacb2f2
Compare
Otherwise systemd-dissect happily mounts ESP on top of the root fs.
Even if not recommended, images with ESP on /boot/efi are not uncommon and are valid DDIs as long as the path is specified in fstab. Therefore dissecting such images: - should not modify it by creating /efi and incorrectly forcing ESP on /efi when the image is mounted RW. - should not fail if the image is mounted RO since the images are compliant with DPS. The patch also makes the code fails when XBOOTLDR cannot be mounted on /boot because the directory is not empty.
To allow callers of dissected_image_mount() to make sure that the image won't be modified even if it's mounted RW. No functional change.
It's not expected that introspecting images modifies them, even for creating missing mount point dirs, at least by default. This is especially important when dissecting DDI images with ESP on /boot/efi otherwise it creates a wrong mount point dir at /efi.
eacb2f2 to
b8231ec
Compare
|
@poettering, can we try to make a trade-off ? Encouraging distros to move ESP to Regarding systemd-gpt-auto-generator, it seems ok to skip setups using Regarding systemd-dissect, it's a tool for introspecting DDI images. As such it makes less sense to not support all kind of DDIs. In any cases allowing the tool to modify images to create incorrect mount point directories is wrong regardless of whether |
| * by default) will be created when mounting ESP. If that fails again then the | ||
| * directories exist but are not empty. */ | ||
| again: | ||
| FOREACH_STRING(dir, "/boot", "/efi", "/boot/efi") { |
There was a problem hiding this comment.
nope. we'll not add new support for /boot/efi in 2024. Sorry.
| DISSECT_IMAGE_FSCK | | ||
| DISSECT_IMAGE_USR_NO_ROOT | | ||
| DISSECT_IMAGE_GROWFS | | ||
| DISSECT_IMAGE_MKDIR_MOUNTPOINTS | |
There was a problem hiding this comment.
what's the usecase for this? when would we ever not set this?
if people want immutable images they should set the r/o flag
There was a problem hiding this comment.
As explained in the commit messages, dissect is an introspecting tool and as such it should not modify the introspected images by default. If anything is missing to properly mount the image it should complain and exit (regardless of whether if it's mounted ro or rw).
If modifying the image is wanted then passing a specific option to allow that (--mkdir-mountpoints or such) seems a better approach.
There was a problem hiding this comment.
but the modes where it just introspects the image all set the r/o flag, hence the mkdir doesn't work anyway? so why is any new flag required here?
There was a problem hiding this comment.
See the use case I provided below with --mount. This mode, by default, modifies the image to create /efi if it doesn't exist. You will argue that --read-only could be passed but the fact that the user wants to mount the image RW doesn't mean that the tool is allowed to do various image modifications. And the man page doesn't say anything about that.
gpt-auto-generator is run on any kind of set up, we need to be more defensive there.
Sorry, I am strictly against adding support for /boot/efi. That's just a broken idea, we are not going to make that magically happen. Not in 2024. You could convince me to add:
|
But how ? The only way I can see is to explicitly check for the presence of the paths in /etc/fstab but you and @YHNdnzj shot my first attempt which actually did that... |
I can only repeat myself: systemd-dissect is an introspecting tool that is supposed to operate on DDIs. And images with ESP on /boot/efi are compliant DDIs. systemd-dissect could warn about the fact that such images are considered obsolete but refusing to introspect them is wrong . |
I am not sure I grok what you mean by "compliant"? the discoverable partitions spec never mentions /boot/efi at all, and it doesn't actually say anything about mount point dirs that must or must not exist in the image, hence I am not sure why you insist so much that such an image was "compliant"? the only ways I can describe the situation is at best "spec doesn't say" and at worse "not compliant". |
|
Can you precisely describe an image that you think is currently mishandled by systemd-dissect and also provide the precise command line that does it wrong? |
Excerpt taken from https://uapi-group.org/specifications/specs/discoverable_partitions_specification/#suggested-mode-of-operation:
Indeed it doesn't mention /boot/efi explicitly but the use case we're debating here falls into this category nevertheless, doesn't it ? We can't realistically supports any fancy paths, I agree, but [1] At least it's commonly used enough that some other parts of systemd does support it: |
Not sure it does. I think checking fstab makes sense for the gpt-auto generator thingy, but for the offline dissect logic it simply doesn't. Slightly different rules apply on that I am sure, as the systemd-gpt-auto stuff runs on every boot for regular, traditional users, but when you use systemd-dissect then that's done explicitly, never implicitly and thus we can make stricter requirements.
I am not pretending it never existed. I was fine with making bootctl work with it if things are explicitly set up like this. All I am saying is that we never should set things up like that automatically, because it's broken. It's the difference between consuming a manual setup and setting up an automatic setup. Former is fine, latter is not I am sure.
|
|
If you buy into the concept of DDIs, i.e. disk images that follow the discoverable partition spec and are shipped for sysexts, confexts, portable services, containers, then I think it's not too much to ask to do so without legacy crap. I am happy to update the spec btw, to say explicitly which mount point dirs must exist in compliant DDIs. |
Sure. Consider a disk image with the following partitions: The root partition have the following directory layout: and Here are 2 cases where systemd-dissect is misbehaving (maybe there're more, I haven't tested it exhaustively) At the very least the message is misleading and it should say that the image doesn't support ESP other than "/boot" and "/efi". But as said previously I believe it would be wrong. (Also not sure why the command hangs for about 5 sec... might be due to the fact that when Here it created /efi and mounted ESP on this directory. The image is silently modified by defaut (/efi created) and ESP is mounted at the wrong place. |
Ah, nice you even get an OKish error message for images like this. Anyway, I am very sure that systemd-dissect should not consult fstab Frankly, I see this is a request to update the spec, i.e. say explicitly that implementations may:
Also, I think we should fail rather than fall back to /efi if /boot exists and is populated like it is in your case. |
Don't get this, the problem here is actually that both And with the patch, both tools create /efi and use that as mount point dir when things are not yet set up. |
Please make sure to discuss this with a broader audience given that you're willing to adapt a specification. |
Since you didn't say how this can be done I dared to resubmit my initial proposal but with more comments: #31181. Feel free to shoot again but then please suggest the way you think it should be done. |
My understanding is that the current logic IS ALREADY defensive, i.e. we skip things if fstab_has_node(esp). I don't really care about systems without initrd. I assume people with such a "restricted" setup won't be using gpt-auto anyway. |
|
When #28894 is implemented we should even switch most of the gpt-auto logic to using those symlinks, rather than doing dissect on its own. |
|
Chiming in here. The issue on openSUSE side is that, well, we're coming from a grown general purpose distro. We would really like to integrate systemd stuff as much as possible. We can only do that step by step though. The existing grub based setup has to stay in a working condition. I don't see it going away anytime soon. Even worse, /boot/efi is hardcoded in other packages like u-boot as well. So this takes time to develop tooling that works for both grub and sd-boot and adjust all packages. Meanwhile those of us who work on systemd stuff would like to use the fancy tools already. So as Franck said, even if /boot/efi is considered legacy, dealing with it in a graceful way would be most appreciated by those who are actually actively working on getting rid of it :-) |
|
Let's close this one. The gpt-auto part landed separately in #31181, and |
/boot/efi is not recommended for ESP but it's still commonly used and therefore
systemd-dissectat least shouldn't choke on them.