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

bug?: Changes made under etc/ are not applied with rpm-ostree update #28

Closed
tepene opened this issue Apr 16, 2023 · 8 comments
Closed

Comments

@tepene
Copy link

tepene commented Apr 16, 2023

I'm not sure if it's a bug, a feature, or if it's just my lack of understanding. My custom image https://github.com/tepene/ublue-bayou is based on this startingpoint. I'm getting along quite well ;) but now I'm struggling with updates.

According to https://github.com/coreos/rpm-ostree/blob/main/docs/container.md#installing-config-files

You can use any tooling you want to generate config files in /etc. When a booted system pulls an updated container images, the changes will also be applied.

But that's not what is happening. For Example: I modified the etc/yafti.yml, rebuilt the image, uploaded it to my local registry and ran rpm-ostree update on my test machine. The new update gets applied and i reboot with systemctl reboot.
After the reboot I check the content of the /etc/yafti.yml on my test machine and it still has the "old" content. Not the "new" as I would have expected.

Am I missing something crucial. Is etc/ only applied during a fresh installation and not during updates, or is there a magic command which I am missing? Any help is greatly appreciated.

@xynydev
Copy link
Member

xynydev commented Apr 18, 2023

Answer on our Discord:

Screenshot_20230418-143942_1

Referenced article:

https://blog.verbum.org/2014/01/24/why-ostree-requires-usretc/


We should probably change the default Containerfile to copy files to /usr/etc, but I'll check from the others first.

@elgabo86
Copy link

elgabo86 commented Apr 18, 2023

I don't know if my problem is related to this one but when I add for example virt-manager in the build script, the "libvirt" group does not merge in /usr/lib/group whereas if I install virt-manager as a layer packages, the group appears in this file.

Edit : The same goes for the qemu user.
When I install virt-manager with the build script, there is no user qemu created in /etc/passwd whereas if I install by layered packages, qemu user appears in this file.

@xynydev
Copy link
Member

xynydev commented Apr 18, 2023

virt-manager

I think this is a different issue, I don't think this issue is affects RPMs. I've installed virt-manager in my own image and it works, no libvirt groups or qemu users, but no issues either. Is this something you except to be there ootb?

@elgabo86
Copy link

virt-manager

I think this is a different issue, I don't think this issue is affects RPMs. I've installed virt-manager in my own image and it works, no libvirt groups or qemu users, but no issues either. Is this something you except to be there ootb?

Yes virt-manager works but only with root privileges.

Normally with layered packages, just copy the line containing the "libvirt" group from /usr/lib/group to /etc/group and add the user in this group to be able to use virt-manager without root, the users "gluster " "qemu" "saslauth" are created automatically in /etc/passwd. But when the packages are installed with the script, the "libvirt" group does not exist in /usr/lib/group and the "gluster" "qemu" "saslauth" users are not created.

@tepene
Copy link
Author

tepene commented Apr 20, 2023

We should probably change the default Containerfile to copy files to /usr/etc, but I'll check from the others first.

Thanks! I just did some simple tests with the file /etc/justifile after I changed COPY etc /etc to COPY etc /usr/etc in my Containerfile.

Test cases

Install from scratch

After changing the Containerfile in my source, I rebased the new image on a freshly staged VM.

✔️ Files affected by COPY etc /usr/etc get copied to /etc. Everything fine.

Add some lines to /etc/justifile in my source

Then I added some lines to the /etc/justifile in my source. Rebuilt the image and updated the VM

✔️ Changes from my source got applied to file on my VM. Everything fine.

Removed some lines from /etc/justifile in my source

Then I deleted some lines to the /etc/justifile in my source. Rebuilt the image and updated the VM

✔️ Changes from my source got applied to file on my VM. Everything fine.

Add some lines to /etc/justifile on my VM and some lines to /etc/justifile in my source

Then I added some lines to /etc/justifile on my VM and I also changed some lines in /etc/justifile on my source. Rebuilt the image and updated the VM.

⚠️ This time, the file on the VM didn't get updated. Only the file under /usr/etc.

The ostree admin config-diff shows exactly that.

$ sudo ostree admin config-diff | grep justfile
M    justfile

Is there a way to resolve the config-diff?

@xynydev
Copy link
Member

xynydev commented Apr 22, 2023

Thank's for the extensive testing @tepene !

Is there a way to resolve the config-diff?

I'd assume the command just looks at the direct difference in the files in the case auto-merging is not possible. You'd probably do a manual merge then, deciding if the updates from the image are something you want to add to your own /etc/justfile

@tepene
Copy link
Author

tepene commented Apr 22, 2023

one possible solution I found is rsync -avh /usr/etc/ /etc/ --delete which is noted here https://community.toradex.com/t/manually-reset-of-modified-etc-files-to-current-ostree-commit/15748/4

This might be useful if you want to "reset" your system back to the original state.

xynydev added a commit that referenced this issue Apr 26, 2023
discussed at length in #28
also including tons of comments about the issue
xynydev added a commit that referenced this issue Apr 26, 2023
* fix: prevent /etc/ merge issues
discussed at length in #28
also including tons of comments about the issue

* fix: change references of /etc/ to /usr/etc
@xynydev
Copy link
Member

xynydev commented Apr 26, 2023

#43 merged, it's done.

@xynydev xynydev closed this as completed Apr 26, 2023
Arcitec added a commit to Arcitec/os that referenced this issue May 10, 2023
Removing leftovers from the old /etc/ paths that were used before issue blue-build#28 was solved.
xynydev pushed a commit that referenced this issue May 10, 2023
Removing leftovers from the old /etc/ paths that were used before issue #28 was solved.
plata added a commit to plata/ublue-surface that referenced this issue Aug 10, 2023
As per comment in `Containerfile`:
```
# Warning: If you want to place anything in "/etc" of the final image, you MUST
# place them in "./usr/etc" in your repo, so that they're written to "/usr/etc"
# on the final system. That is the proper directory for "system" configuration
# templates on immutable Fedora distros, whereas the normal "/etc" is ONLY meant
# for manual overrides and editing by the machine's admin AFTER installation!
# See issue #28 (blue-build/legacy-template#28).
```
b- pushed a commit to briorg/server that referenced this issue Oct 13, 2023
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

No branches or pull requests

3 participants