Skip to content

Commit

Permalink
Allow --installroot on read-only bootc system
Browse files Browse the repository at this point in the history
Upstream commit: a1aa8d0

Some people use --installroot on a read-only bootc system to install
a system into a chroot subtree. However, current bootc check did not
take into account --installroot and rejected the operation.

This patch augments the check for the installroot being different
from /.

It's pointless to check for installroot writability here because
installroot is written before this check when updating the
repositories and computing a transaction. Moving this check sooner
would not help because some directories (/opt, /) are kept read-only
even on writable bootc.

Resolves: rpm-software-management#2108
Resolves: https://issues.redhat.com/browse/RHEL-49670
  • Loading branch information
ppisar committed Aug 28, 2024
1 parent 2913ff3 commit a4660fa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dnf/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def do_transaction(self, display=()):
elif 'test' in self.conf.tsflags:
logger.info(_("{prog} will only download packages, install gpg keys, and check the "
"transaction.").format(prog=dnf.util.MAIN_PROG_UPPER))
if dnf.util._is_bootc_host():
if dnf.util._is_bootc_host() and \
os.path.realpath(self.conf.installroot) == "/":
_bootc_host_msg = _("""
*** Error: system is configured to be read-only; for more
*** information run `bootc --help`.
Expand Down

0 comments on commit a4660fa

Please sign in to comment.