Skip to content

Commit

Permalink
rpm-ostree: Setup readonly sysroot for ostree & rw karg
Browse files Browse the repository at this point in the history
- Enable read only sysroot in the ostree repo config.
- Add `rw` to the kernel arguments to keep statefull parts of the system
  (/var & /etc) writable.
- Update units tests to account for the new rw karg

See: https://fedoraproject.org/wiki/Changes/Silverblue_Kinoite_readonly_sysroot
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2086489
  • Loading branch information
travier committed Aug 2, 2022
1 parent f6df2e7 commit ea95459
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions pyanaconda/modules/payloads/payload/rpm_ostree/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ def _set_kargs(self):
if root_data.type == "btrfs subvolume":
set_kargs_args.append("rootflags=subvol=" + root_name)

set_kargs_args.append("rw")

safe_exec_with_redirect("ostree", set_kargs_args, root=self._sysroot)


Expand Down Expand Up @@ -520,6 +522,17 @@ def run(self):
self._data.remote + ':' + ref]
)

log.info("ostree config set sysroot.readonly true")

safe_exec_with_redirect(
"ostree",
["config",
"--repo=" + self._physroot + "/ostree/repo",
"set",
"sysroot.readonly",
"true"]
)

log.info("ostree admin deploy complete")
self.report_progress(_("Deployment complete: {}").format(ref))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def test_btrfs_run(self, devdata_mock, storage_mock, symlink_mock, rename_mock,
exec_mock.assert_called_once_with(
"ostree",
["admin", "instutil", "set-kargs", "BOOTLOADER-ARGS", "root=FSTAB-SPEC",
"rootflags=subvol=device-name"],
"rootflags=subvol=device-name", "rw"],
root=sysroot
)

Expand Down Expand Up @@ -576,7 +576,7 @@ def test_nonbtrfs_run(self, devdata_mock, storage_mock, symlink_mock, rename_moc
)
exec_mock.assert_called_once_with(
"ostree",
["admin", "instutil", "set-kargs", "BOOTLOADER-ARGS", "root=FSTAB-SPEC"],
["admin", "instutil", "set-kargs", "BOOTLOADER-ARGS", "root=FSTAB-SPEC", "rw"],
root=sysroot
)

Expand Down

0 comments on commit ea95459

Please sign in to comment.