Greetings @ldvp,
Let me summarize to make sure I understand the situation here.
- You start with a base TorizonCore image I assume.
- You make some modifications then capture these changes with TorizonCore Builder to create a new version. (release 1)
- With release 1 you make manual changes to
/etc
. These manual changes are not officially part of any release, 1 or 2, is that right? - You then make a new version (release 2). Just to clarify is release 2 based on release 1? Also are the manual changes to
/etc
included in release 2? I assume based on your wording they are not. - Now the problem is that when you deploy release 2 the manual changes done to release 1 are still present and not overwritten by release 2.
Did I get that all correct?
If I did then it sounds like you are falling victim to a fundamental “feature” of OSTree. OSTree treats the /etc
directory differently than other directories. The behavior is summarized in this excerpt from the OSTree documentation:
On upgrade, OSTree will perform a basic 3-way diff, and apply any local changes to the new copy, while leaving the old untouched.
So there’s a 3 way merge happening here between release 1’s /etc
contents, the manual changes done to /etc
, and release 2’s /etc
contents. This sounds like what you’re experiencing.
Now if I understand you basically want to to remove the manual changes done to /etc
so that the update goes from release 1 to release 2 cleanly. I don’t believe there’s a OSTree command that resets /etc
. However there’s another mechanism you can do. In order to do the 3 way merge OSTree needs to know release 1’s original /etc
content. But how does it do that if you do manual changes on /etc
? The secret is /usr/etc
, this directory is a read only default of that release’s /etc
.
For your case what this means is that /usr/etc
should contain release 1’s original /etc
content without any of the changes that occurred after release 1 was deployed. I imagine you can do a kind of magic with rsync
to copy/overwrite /usr/etc
to /etc
to effectively “restore” it, to it’s original state.
Let me know if this helps you.
Best Regards,
Jeremias