Skip to content

Commit

Permalink
[Endless] gpt-auto-generator: Make /boot a persistent mount
Browse files Browse the repository at this point in the history
When using staged deployments, ostree updates the boot loader entries during
shutdown from a systemd unit. That's proven to be very fragile when /boot is an
automount:

* Once automount units are scheduled to be stopped, systemd ignores
  notifications from autofs that the mount is needed. That means that if the
  mount isn't active when the shutdown phase begins, finalizing the deployment
  will fail.

* When a separate mount namespace is in use, autofs does not see the mount as
  active and notifies systemd that the mount is expired so it will be
  unmounted. Since systemd often starts units in separate mount namespaces,
  this can either cause the finalizing unit to be triggered early and hang or
  fail if it hasn't completed by the time the mount expires.

Although the goal of keeping the ESP unmounted is worthy since it's on a VFAT
filesystem, having systemd not mount /boot when needed or unmounted while it's
still needed is worse. This changes the /boot mount (either the ESP or XBOOTLDR
partition) to be persistent.

https://phabricator.endlessm.com/T33136
  • Loading branch information
dbnicholson committed Mar 1, 2022
1 parent d191155 commit 1ce7c7b
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions src/gpt-auto-generator/gpt-auto-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,14 @@ static int add_xbootldr(DissectedPartition *p) {
if (r > 0)
return 0;

return add_automount("boot",
p->node,
"/boot",
p->fstype,
true,
esp_or_xbootldr_options(p),
"Boot Loader Partition",
120 * USEC_PER_SEC);
return add_mount("boot",
p->node,
"/boot",
p->fstype,
true,
esp_or_xbootldr_options(p),
"Boot Loader Partition",
SPECIAL_LOCAL_FS_TARGET);
}

#if ENABLE_EFI
Expand Down Expand Up @@ -547,14 +547,24 @@ static int add_esp(DissectedPartition *p, bool has_xbootldr) {
} else
log_debug("Not an EFI boot, skipping ESP check.");

return add_automount(id,
p->node,
esp_path,
p->fstype,
true,
esp_or_xbootldr_options(p),
"EFI System Partition Automount",
120 * USEC_PER_SEC);
if (streq(esp_path, "/boot"))
return add_mount(id,
p->node,
esp_path,
p->fstype,
true,
esp_or_xbootldr_options(p),
"EFI System Partition",
SPECIAL_LOCAL_FS_TARGET);
else
return add_automount(id,
p->node,
esp_path,
p->fstype,
true,
esp_or_xbootldr_options(p),
"EFI System Partition Automount",
120 * USEC_PER_SEC);
}
#else
static int add_esp(DissectedPartition *p, bool has_xbootldr) {
Expand Down

0 comments on commit 1ce7c7b

Please sign in to comment.