stages/rpm: support marking install as ostree
An ostree system can be identified as such by the presence of a marker file: /run/ostree-booted. The `rpm-ostree` tool also creates this marker during the _installation_ of the system[1,2]. Recently, starting with F36, the authselect package has taken has become mandatory[3] and is now owning the nsswitch config. An rpm-ostree system, which has parts of the user database in /usr, release on the nss-altfiles to read these databases. The necessary entries are added during the post-processing, which is called in our `org.osbuild.ostree.preptree` stage[4]. This installation is skipped though if the nsswitch is the file is a symlink, indicating that it is owned by some other package, like authselect. So the F36 authselect change first broke rpm- ostree[6]. The fix was to check for `/run/ostree-booted` in the authselect scriptlet and special case this situation[7,8]. Now, our `org.osbuild.rpm` stage does not yet have the ability to pretend it is a running ostree system and thus we did not get the special treatment resulting in nss-altfiles not being enabled in our ostree commits. Therefore the passwd database in /usr was not read and a lot of daemons and programs without a valid user, like e.g. `sshd`. This change introduces a new option, `ostree_booted` that if set, will create the `/run/ostree-booted` marker and thus our installation phase will get the same treatments from packages as rpm-ostree. Hopefully. [1]730bec87b1/rust/src/builtins/compose/mod.rs (L24)[2]6211d1452e/src/app/rpmostree-compose-builtin-tree.cxx (L501)[3] https://fedoraproject.org/wiki/Changes/Make_Authselect_Mandatory [4]7993c6f565/rust/src/composepost.rs (L635)[5]d614caeca1/f/0010-spec-fix-detection-of-ostree-system.patch[6] https://bugzilla.redhat.com/show_bug.cgi?id=2034360 [7] https://src.fedoraproject.org/rpms/authselect/c/d614caeca1a68f55542aefd0d76bda2691c85d24?branch=f36 [8] https://github.com/authselect/authselect/issues/48
This commit is contained in:
parent
776bab46ae
commit
16f1c560cc
1 changed files with 24 additions and 0 deletions
|
|
@ -100,6 +100,10 @@ SCHEMA = """
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"ostree_booted": {
|
||||
"type": "boolean",
|
||||
"description": "Create the '/run/ostree-booted' marker"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
|
@ -143,6 +147,10 @@ SCHEMA_2 = """
|
|||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"ostree_booted": {
|
||||
"type": "boolean",
|
||||
"description": "Create the '/run/ostree-booted' marker"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -160,6 +168,12 @@ SCHEMA_2 = """
|
|||
"""
|
||||
|
||||
|
||||
# File to mark a system as ostree booted. Also used by certain packages
|
||||
# like e.g. authselect, to adjust its behavior during installation.
|
||||
# Controlled via the `ostree_booted` option.
|
||||
OSTREE_BOOTED_MARKER = "run/ostree-booted"
|
||||
|
||||
|
||||
def generate_package_metadata(tree):
|
||||
query = r"""\{
|
||||
"name": "%{NAME}",
|
||||
|
|
@ -284,6 +298,13 @@ def main(tree, inputs, options):
|
|||
|
||||
machine_id_created = create_machine_id_if_needed(tree)
|
||||
|
||||
ostree_booted = None
|
||||
if options.get("ostree_booted", False):
|
||||
os.makedirs(f"{tree}/run", exist_ok=True)
|
||||
ostree_booted = f"{tree}/{OSTREE_BOOTED_MARKER}"
|
||||
with open(ostree_booted, "w", encoding="utf-8") as f:
|
||||
f.write("")
|
||||
|
||||
extra_args = []
|
||||
|
||||
if options.get("exclude", {}).get("docs"):
|
||||
|
|
@ -338,6 +359,9 @@ def main(tree, inputs, options):
|
|||
machine_id_file.unlink()
|
||||
machine_id_file.touch()
|
||||
|
||||
if ostree_booted:
|
||||
os.unlink(ostree_booted)
|
||||
|
||||
# remove random seed from the tree if exists
|
||||
with contextlib.suppress(FileNotFoundError):
|
||||
os.unlink(f"{tree}/var/lib/systemd/random-seed")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue