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

rpmostree: use nss files from sysroot for tmpfiles #1976

Closed
wants to merge 1 commit into from
Closed

rpmostree: use nss files from sysroot for tmpfiles #1976

wants to merge 1 commit into from

Conversation

yuvalturg
Copy link
Contributor

Executing systemd-tmpfiles with --root does not recognize users and
groups from the root filesystem. To overcome this, copy the nss files
from the sysroot over to the stage2 filesystem just before
systemd-tmpfiles

Signed-off-by: Yuval Turgeman yturgema@redhat.com

@M4rtinK M4rtinK added manual testing required This issue can't be merged without manual testing master Please, use the `f39` label instead. labels May 21, 2019
@jkonecny12
Copy link
Member

Jenkins, it's ok to test.

@jkonecny12
Copy link
Member

@cgwalters could you please look on this and say what do you think about it?

nssfiles = ["passwd", "group"]
srcfiles = [util.getSysroot() + "/usr/lib/" + f for f in nssfiles]
cp_args = ["-a", "-bS", ".orig"] + srcfiles + ["/etc"]
self._safe_exec_with_redirect("cp", cp_args)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, please have this code silently do nothing if the files don't exist, so things continue to work after we switch to sysusers.

Second...I think you need to temporarily concatenate them, otherwise the root user won't be present, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @cgwalters

Copy link
Member

@jkonecny12 jkonecny12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for your contribution!
Could you please make the change below before merge?

pyanaconda/payload/rpmostreepayload.py Outdated Show resolved Hide resolved
@jkonecny12
Copy link
Member

Could you please explain how we can test this? Also is there a bug you are trying to fix by this contribution?

@jkonecny12
Copy link
Member

jenkins, test this please

Executing systemd-tmpfiles with --root does not recognize users and
groups from the root filesystem.  To overcome this, copy the nss files
from the sysroot over to the stage2 filesystem just before
systemd-tmpfiles

Signed-off-by: Yuval Turgeman <yturgema@redhat.com>
Copy link
Contributor

@poncovka poncovka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should also restore the files after the systemd-tmpfiles call. There is a similar pull request at #1683. Anyway, this issue is reported at systemd/systemd#7032. The problem is that nss doesn't support the root option. Have you filed a bug for nss?

@yuvalturg
Copy link
Contributor Author

Hi guys, thanks for the review, I didn't file a bug, but the issue that is reported in systemd/systemd#7032 seems to fit.

This patch will concatenate nss files from /etc and /usr/lib from the image and in case one of them is missing it will fail silently as @cgwalters asked so it won't break the move to sysusers.

As for testing, I created my own ostree image with custom file ownership under /var, repacked stage2 with this change, then created my own iso, and saw that the installation was successful with correct ownership under /var.

Why do we need to restore the old files ?

@poncovka
Copy link
Contributor

@yuvalturg, Anaconda doesn't run only in the stage2 environment. It can be installed on your system and used for installation to a directory or an image. Also, the users and groups of the stage2 environment can be set up with a kickstart file to configure login via ssh. Therefore, it is not desirable to change the users and groups of the host system. Even with restored files, the installation can fail before that and leave the host system changed.

We recommend to file a bug to libc nss, so they can implement support for the root option and systemd-tmpfiles can use it.

I am closing this pull request.

@poncovka poncovka closed this Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manual testing required This issue can't be merged without manual testing master Please, use the `f39` label instead.
Development

Successfully merging this pull request may close these issues.

5 participants