CoreOS uses systemd for init and process management. This repo is divided into three collections of files:
- configs: Customized daemon configuration files, usually installed
into
/etc
but really the sky is the limit there. - scripts: Helper scripts for init and service startup. These are
generally to be used as systemd oneshot services and installed
into
/usr/lib/coreos
. - systemd: Unit files for mount points, our helper scripts, or other
services that doen't install their own unit files. There is a top
level
coreos-startup.target
which depends on everything that should be enabled by default on CoreOS. See Ordering for details.
The coreos-base/coreos-init ebuild handles the install process.
A few notes on things that must happen which are unique to Core OS.
- resize
state
: Support easy VM growth by checking if there is unused space at the end of the disk and expanding the filesystem to use it. - mount
/media/state
: Anything that should persist across boots must be in here bind mounted or linked here including/home
and/var
. - initialize
/media/state
: The state partition is created during build but we need to be sure that it has the directories we expect before trying to use it. - bind mounts: Map things into
/media/state
or/run
and so on as apropraite. - mount
/usr/share/oem
: Provides extra vendor add-ons. - generate ssh keys: The stock sshd units do not handle this so we need to.
- setup dev/debug mode: Optionally bind
dev_image
to/usr/local
and remount/
as read-write.
Dependencies between the units can be not so obvious to a human and our boot involves an unusually long sequence of actions:
resize-state.service
Runsscripts/resize_stateful_partition
local-fs-pre.target
media-state.service
andusr-share-oem.mount
Other things are likely being mounted around here too.init-state.service
Create directories needed for home, var, and var-run.home.mount
andvar.mount
Almost a normal looking system now!var-run.mount
Binds/var/run
to/run
to consolidate clutter.local-fs.target
Mounting complete!systemd-tmpfiles-setup.service
Recreates assorted files and directories based on tmpfiles.d configs.sysinit.target
Things are looking usable now! Most daemons will start about now.