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

generator: Exit if there's no /run/ostree #3147

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/libostree/ostree-impl-system-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,18 @@ _ostree_impl_system_generator (const char *normal_dir, const char *early_dir, co
if (unlinkat (AT_FDCWD, INITRAMFS_MOUNT_VAR, 0) == 0)
return TRUE;

// If we're not booted via ostree, do nothing
if (!glnx_fstatat_allow_noent (AT_FDCWD, OTCORE_RUN_OSTREE, NULL, 0, error))
return FALSE;
if (errno == ENOENT)
return TRUE;

g_autofree char *cmdline = read_proc_cmdline ();
if (!cmdline)
return glnx_throw (error, "Failed to read /proc/cmdline");

/* If we're installed on a system which isn't using OSTree for boot (e.g.
* package installed as a dependency for flatpak or whatever), silently
* exit so that we don't error, but at the same time work where switchroot
* is PID 1 (and so hasn't created /run/ostree-booted).
*/
g_autofree char *ostree_cmdline = otcore_find_proc_cmdline_key (cmdline, "ostree");
if (!ostree_cmdline)
return TRUE;
// SAFETY: If we have /run/ostree, then we must have the ostree= karg
g_assert (ostree_cmdline);

if (!require_internal_units (normal_dir, early_dir, late_dir, error))
return FALSE;
Expand Down
Loading