Torizon, changes to /opt folder


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

How would I go about sorting this out?


Greetings @lblackbeard,

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?

Best Regards,

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 /etc not a link to /usr/etc in the same way as /bin and /lib?

While I have you, why is /etc not 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.

I hope that helps clear that up.

Best Regards,

1 Like