Skip to content

Configuration Files

Calin Crisan edited this page May 5, 2022 · 6 revisions

Configuration Paths

Most of the programs/services/daemons will expect to find their configuration files somewhere under /etc. While this directory is present on a thingOS machine, it's normally read-only. All services should deal with this limitation.

If the service comes with a hardcoded configuration file and its configuration never changes afterwards, the OS can simply provide the file at compile time, at the expected location in /etc.

If the configuration of a service can be changed during normal OS use, the system OS image should include symlinks to the configuration file (or to an included part) that is present on the (writable) data partition.

If a configuration file is built dynamically at each boot (such as the /etc/resolv.conf file), a symlink should be used to point to the file placed in /var/run. The /var/run folder is in its turn a symlink to /tmp, which resides in RAM.

Default Configuration Provisioning

Having (parts of) the configuration file on the data partition is just fine for configurations that change during a normal functioning of the OS. The data partition, however, is created at first boot and a default configuration should be provided for all services/programs/daemons relying on these files on the data partition.

The service's init script is responsible of making sure a complete configuration exists. What most init scripts provided by thingOS do is to look for a configuration file on the /boot partition and use it for provisioning, moving it to the data partition. In the absence of such a file, they would look for a system-provided configuration, usually placed under the /etc/ system folder and use it as a default configuration.

Long story short, system configuration files are used as defaults, while boot configurations are used for provisioning.

Provisioning via the boot partition is particularly useful for Windows or Mac users, since it's a FAT partition that can be mounted on virtually any possible operating system.

Examples

The S35wifi init script will look for /boot/wpa_supplicant.conf and will move it to /data/etc/wpa_supplicant.conf if found. In the absence of a /data/etc/wpa_supplicant.conf and /boot/wpa_supplicant.conf, the /etc/wpa_supplicant.conf will be used as a default and copied over to /data/etc/wpa_supplicant.conf.

The modprobe command uses the /etc/modprobe.d folder to read its configuration. thingOS provides a system /etc/modprobe.d/modprobe.conf as well as a symlink to /data/etc/modprobe.conf for this purpose.

Clone this wiki locally