I can use the “changes” folder to modify the filesystem as follows:
Build PC | Target
changes/usr/bin → /bin
changes/usr/lib → /lib
changes/usr/etc → /etc
However, I cannot modify the /opt folder on the target:
changes/usr/opt → /usr/opt # Incorrect, need /opt
changes/opt → # Build error
changes/var/rootdirs/opt → # Data not present
TorizonCore and TorizonCore Builder use OSTree in order to capture and version control changes to the filesystem. The /opt directory on the device is actually symlinked like so:
ls -l /opt
lrwxrwxrwx 2 root root 16 Oct 19 18:50 /opt -> var/rootdirs/opt
This is important because the entire /var directory is not controlled by OSTree. This is by design for the purpose of having a persistent directory that is not touched. That said this means you can’t customize /opt. You would need to use another directory where changes are captured. What kind of changes were you going to use /opt for?
Thanks Jeremias. That’s good info to have regarding /var not being controlled by OSTree. I am simply wanting to preinstall a driver that wants to put some files over there. I have since discovered that the path to those files can be changed in a configuration file, so things are working now as they should. I am slightly concerned though that the approach is mildly contortionist and relies on the driver respecting its own configuration.
While I have you, why is /etcnot a link to /usr/etc in the same way as /bin and /lib?
Lloyd
While I have you, why is /etcnot a link to /usr/etc in the same way as /bin and /lib?
Well the answer to this again is OSTree. The /etc directory is another kind of special directory in the OSTree framework. So this directory is tracked and versioned by OSTree, but in a somewhat unintuitive way.
Basically when an update/upgrade with OSTree occurs, a 3 way merge happens to the /etc directory. The merge is between the current state (/etc), the default state (/usr/etc), and the new state ( the new /usr/etc). This document describes the process in more detail: Atomic Upgrades | ostreedev/ostree
But basically, that’s why /etc is not just a simple symlink of /usr/etc. /usr/etc is just a copy of the default state of /etc, but not necessarily equal to the current state of /etc.
If you’re after adding a library at runtime and it absolutely has to be outside your application container(s), it’s probably easiest just to put the library somewhere in etc and add it to ld.so.conf.d.