Compare commits

...

7 Commits

Author SHA1 Message Date
John Allwine
b09a226fb7
Merge 15e0f69eb4 into 8aaea0c65d 2024-12-20 14:43:54 -05:00
Colin Walters
8aaea0c65d
Merge pull request #3361 from cgwalters/release
Release 2024.10
2024-12-19 17:10:40 -05:00
Colin Walters
45ddf3b798
Merge pull request #3351 from cgwalters/fix-transient-root-doc
man: Note semantics combining `root.transient` with `composefs.enabled`
2024-12-19 16:23:48 -05:00
Colin Walters
aca6f17ff8 Post-release version bump
Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-19 15:11:42 -05:00
Colin Walters
66f5a77ae6 Release 2024.10
Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-19 15:10:12 -05:00
Colin Walters
786b38c2cf man: Note semantics combining root.transient with composefs.enabled
It's all quite confusing having to reason about both the pre-composefs
ostree and the composefs version. But hopefully soon we more firmly
leave behind that first legacy.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-17 16:04:38 -05:00
John Allwine
15e0f69eb4 Look for a /usr/lib/ostree-boot/setup.sh script and run it
during ostree admin deploy after the uEnv.txt file has been
written. setup.sh could write out a whole new uEnv.txt file
and/or write out other files/symlinks. The script is passed
the sysroot path, the ostree deployment path and the
boot/loader.# path, so it can make the proper links.
2021-08-20 12:19:31 -06:00
3 changed files with 94 additions and 12 deletions

View File

@ -1,7 +1,7 @@
AC_PREREQ([2.63])
dnl To perform a release, follow the instructions in `docs/CONTRIBUTING.md`.
m4_define([year_version], [2024])
m4_define([release_version], [10])
m4_define([release_version], [11])
m4_define([package_version], [year_version.release_version])
AC_INIT([libostree], [package_version], [walters@verbum.org])
is_release_build=no

View File

@ -120,20 +120,25 @@ License along with this library. If not, see <https://www.gnu.org/licenses/>.
<varlistentry>
<term><varname>root.transient</varname></term>
<listitem><para>A boolean value; the default is <literal>false</literal>.
If this is set to <literal>true</literal>, then the <literal>/</literal> filesystem will be a writable <literal>overlayfs</literal>,
with the upper directory being a hidden directory (in the underlying system root filesystem) that will persist across reboots by default.
However, changes will <emphasis>be discarded</emphasis> on OS updates!
Setting this flag to <literal>true</literal> requires composefs (See <literal>composefs.enabled</literal>).
When enabled, the root mount point <literal>/</literal> will be an overlayfs whose contents will be stored
in a tmpfs, and hence discarded on OS upgrade or reboot.
</para>
<para>
Enabling this option can be very useful for cases such as packages (dpkg/rpm/etc) that write content into <literal>/opt</literal>,
particularly where they expect the target to be writable at runtime. To make that work, ensure that your <literal>/opt</literal>
directory is *not* a symlink to <literal>/var/opt</literal>, but is just an empty directory.
</para>
<para>
Note the <literal>/usr</literal> mount point remains read-only by default. This option is independent of <literal>etc.transient</literal> and <literal>sysroot.readonly</literal>;
This option is independent of <literal>etc.transient</literal> and <literal>sysroot.readonly</literal>;
it is supported for example to have <literal>root.transient=true</literal> but <literal>etc.transient=false</literal> in which case changes to <literal>/etc</literal> continue
to persist across updates, with the default OSTree 3-way merge applied.
</para></listitem>
Also related to persistence it is important to emphasize that <literal>/sysroot</literal> (the physical root filesystem) is still persistent
by default; in-place OS upgrades can be applied.
</para>
<para>
Enabling this option can make it significantly easier to adopt an image-based model in some circumstances.
For example, if you have a configuration management system that is inspecting machine-specific state and
e.g. dynamically installing packages or applying configuration, it can more easily be adapted to
run on each boot, while still shifting a portion (or ideally most) image configuration to build time
as part of the base image/commit.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>composefs.enabled</varname></term>

View File

@ -63,6 +63,79 @@ _ostree_bootloader_uboot_get_name (OstreeBootloader *bootloader)
return "U-Boot";
}
/* Run system's setup.sh script, if it exists in $deployment/usr/lib/ostree-boot/ */
static gboolean
run_system_setup (OstreeBootloaderUboot *self,
const int bootversion,
GCancellable *cancellable,
GError **error)
{
// code to find bootargs is duplicated from create_config_from_boot_loader_entries
// is there a better way to know the deployment path?
g_autoptr(GPtrArray) boot_loader_configs = NULL;
OstreeBootconfigParser *config;
const char *val;
const char *bootargs = NULL;
if (!_ostree_sysroot_read_boot_loader_configs (self->sysroot, bootversion, &boot_loader_configs,
cancellable, error)) {
return FALSE;
}
for (int i = 0; i < boot_loader_configs->len; i++) {
config = boot_loader_configs->pdata[i];
val = ostree_bootconfig_parser_get (config, "options");
if (val) {
bootargs = val;
break;
}
}
if(bootargs == NULL) {
return FALSE;
}
g_autoptr(OstreeKernelArgs) kargs = NULL;
const char *setup_path = NULL;
const char *setup_path_relative = NULL;
const char *ostree_arg = NULL;
GFile *sysroot_file = ostree_sysroot_get_path(self->sysroot);
g_autofree char* sysroot_path = g_file_get_path(sysroot_file);
kargs = ostree_kernel_args_from_string (bootargs);
ostree_arg = ostree_kernel_args_get_last_value (kargs, "ostree");
if (!ostree_arg)
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"No ostree= kernel argument found in boot loader configuration file");
return FALSE;
}
setup_path_relative = glnx_strjoina ((ostree_arg+1), "/usr/lib/ostree-boot/setup.sh");
setup_path = glnx_strjoina (sysroot_path, ostree_arg, "/usr/lib/ostree-boot/setup.sh");
if (glnx_fstatat_allow_noent (self->sysroot->sysroot_fd, setup_path_relative, NULL, 0, error)) {
int estatus;
g_autofree char *loader_arg = g_strdup_printf ("/boot/loader.%d", bootversion);
char const* setup_argv[5];
setup_argv[0] = setup_path;
setup_argv[1] = sysroot_path;
setup_argv[2] = ostree_arg;
setup_argv[3] = loader_arg;
setup_argv[4] = NULL;
if (!g_spawn_sync (NULL, (char**)setup_argv, NULL, G_SPAWN_SEARCH_PATH,
NULL, NULL, NULL, NULL, &estatus, error)) {
return FALSE;
}
if (!g_spawn_check_exit_status (estatus, error)) {
return FALSE;
}
}
return TRUE;
}
/* Append system's uEnv.txt, if it exists in $deployment/usr/lib/ostree-boot/ */
static gboolean
append_system_uenv (OstreeBootloaderUboot *self, const char *bootargs, GPtrArray *new_lines,
@ -145,11 +218,12 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, int bootver
if (val)
{
g_ptr_array_add (new_lines, g_strdup_printf ("bootargs%s=%s", index_suffix, val));
if (i == 0)
if (i == 0) {
if (!append_system_uenv (self, val, new_lines, cancellable, error))
return FALSE;
}
}
}
return TRUE;
}
@ -178,6 +252,9 @@ _ostree_bootloader_uboot_write_config (OstreeBootloader *bootloader, int bootver
GLNX_FILE_REPLACE_DATASYNC_NEW, cancellable, error))
return FALSE;
if (!run_system_setup (self, bootversion, cancellable, error))
return FALSE;
return TRUE;
}