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
gpt-auto-generator: correctly handle the return value of function slash_boot_in_fstab() #28652
Conversation
…sh_boot_in_fstab()
r = slash_boot_in_fstab(); | ||
if (r < 0) | ||
return r; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This checks if /boot
is in fstab, and return true if it exists. Ignoring non-negative value is meaningless, and if this really fixes the issue, then please drop the call entirely.
@@ -586,17 +586,12 @@ static int add_partition_esp(DissectedPartition *p, bool has_xbootldr) { | |||
* Otherwise, if /efi/ is unused and empty (or missing), we'll take that. | |||
* Otherwise, we do nothing. */ | |||
if (!has_xbootldr && slash_boot_exists()) { | |||
r = slash_boot_in_fstab(); | |||
r = path_is_busy("/boot"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. If the ESP already has an entry in fstab, fstab_has_node
above should handle it. If not, we should only use /boot/
when it's not specified in fstab, and fallback to /efi/
otherwise. You're just overmounting /boot/
if it's empty, regardless of already listed in fstab or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that although path_is_busy
checks whether the path is already a mountpoint, no mount unit will have been started by the time the generator does its initial run, i.e. during systemd startup. So we need to check fstab explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the fstab
on my system:
UUID=93fe18d5-1331-4d58-b6a5-fceb1d130300 / ext4 rw,relatime 0 1
UUID=1DAD-F136 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
Does this mean that fstab_has_node
is not as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> #28690
Fixes: #28585
Actually, the return value of slash_boot_in_fstab() maybe
true
:systemd/src/shared/fstab-util.c
Line 107 in f882a98