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

drop rofiles-fuse, start using overlayfs #4827

Closed
alexlarsson opened this issue Feb 12, 2024 · 7 comments
Closed

drop rofiles-fuse, start using overlayfs #4827

alexlarsson opened this issue Feb 12, 2024 · 7 comments

Comments

@alexlarsson
Copy link
Collaborator

On an automotive cs9 image, using composefs this command fails:

# rpm-ostree install --apply-live --idempotent --allow-inactive -y fontconfig
...
error: Running %posttrans for fontconfig: bwrap(/bin/sh): Child process killed by signal 2; 
run `journalctl -t 'rpm-ostree(fontconfig.posttrans)'` for more information

The log says is:

# journalctl -t 'rpm-ostree(fontconfig.posttrans)'
Feb 12 09:33:16 74fb4ccc-a8ac-435e-83be-4b69a8bdd037.testing-farm rpm-ostree(fontconfig.posttrans)[1154]: 
could not open /etc/xml/catalog for saving

The actual post-trans is:

%posttrans
if [ -e %{_sysconfdir}/xml/catalog ]; then
  %{_bindir}/xmlcatalog --noout --add system \
                        "urn:fontconfig:fonts.dtd" \
                        "file://%{_datadir}/xml/fontconfig/fonts.dtd" \
                        %{_sysconfdir}/xml/catalog
fi

I don't understand why this breaks, because /etc should still be the regular bind-mount even though composefs is used (i.e. it is not using e.g. transient /etc. However, I don't know the details of apply-live.

@alexlarsson
Copy link
Collaborator Author

I did some investigation, and /etc is on a rofiles-fuse mount with -copyup, so writes to it should work. However, it doesn't. Trying to modify an existing file (which should break the hardlink and replace it) like so:

echo foo > $ETC/fuse.conf

Fails with:

/tmp/rpmostree-rofiles-fusedtvOpD/fuse.conf: Operation not permitted

I wonder if it somehow is using the composefs dir as backing for the rofiles, and not the deploy dirs.

@cgwalters
Copy link
Member

In a quick test, I am not reproducing this on FCOS (fedora 39).

That said, I can't even enable composefs in the current centos-bootc:stream9 images as dbus-broker.service fails to launch...wait...this used to work...

(some debugging)

Argh it it's that's dang patch for rhel to disable tmp.mount by default...this is a recent bug there.

@alexlarsson
Copy link
Collaborator Author

So, the problem happens because the file we're replacing has fs-verity enabled.

@cgwalters
Copy link
Member

Oh yeah duh, so this is an ostree bug: verify_write_or_copyup is just not prepared for this.

@cgwalters
Copy link
Member

Obviously package layering here should stop using rofiles-fuse and use overlayfs instead (and more generally align with container builds).

alexlarsson added a commit to alexlarsson/ostree that referenced this issue Feb 14, 2024
In case fs-verity is in used for the repo objects, and something like
"rpm-ostree apply-live" uses rofiles-fuse with --copyup, then writing
to a hard-linked file fails to copy up, like this:

echo foo > /a/rofile-mnt/a-file
/a/rofile-mnt/a-file: Operation not permitted

The reason for this is that do_write() starts by opening the file
non-truncating for writing, stat:ing it and then calling
verify_write_or_copyup(). It is expecting the the open(write) to
succeed, however, in the fs-verity case any open with write fails with
EPERM.

We fix this by delaying the EPERM failure, only reporting it when the
file descriptor needs to be used. In the case this triggered a copyup
the file descriptor will be reopened, and in this case we will not get
the EPERM anymore.

To simplify this code the fd variable now uses glnx_autofd.

This fixes coreos/rpm-ostree#4827
@alexlarsson
Copy link
Collaborator Author

Its not actually in verify_write_or_copyup(), but before it, see the linked PR.

@alexlarsson
Copy link
Collaborator Author

Fixed by ostreedev/ostree#3175

@cgwalters cgwalters changed the title apply-live failure to run fontconfig post-trans when using composefs start using overlayfs Feb 15, 2024
@cgwalters cgwalters changed the title start using overlayfs drop rofiles-fuse, start using overlayfs Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants