Do not restore /etc before the overlay is ready
This should fix the following problem:
# systemctl status cfg-restore-etc.service | cat
● cfg-restore-etc.service - Restore /etc from the Persistent config
Loaded: loaded (/lib/systemd/system/cfg-restore-etc.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2017-11-02 17:32:01 UTC; 2min 32s ago
Process: 151 ExecStart=/bin/sh -c cp -a /cfg/etc/* /etc/ (code=exited, status=1/FAILURE)
Main PID: 151 (code=exited, status=1/FAILURE)
Nov 02 17:32:01 czechlight sh[151]: cp: can't preserve times of '/etc/sysrepo/data': Read-only file system
Nov 02 17:32:01 czechlight sh[151]: cp: can't preserve ownership of '/etc/sysrepo/data': Read-only file system
Nov 02 17:32:01 czechlight sh[151]: cp: can't preserve permissions of '/etc/sysrepo/data': Read-only file system
Nov 02 17:32:01 czechlight sh[151]: cp: can't preserve times of '/etc/sysrepo': Read-only file system
Nov 02 17:32:01 czechlight sh[151]: cp: can't preserve ownership of '/etc/sysrepo': Read-only file system
Nov 02 17:32:01 czechlight sh[151]: cp: can't preserve permissions of '/etc/sysrepo': Read-only file system
Nov 02 17:32:01 czechlight systemd[1]: cfg-restore-etc.service: Main process exited, code=exited, status=1/FAILURE
Nov 02 17:32:01 czechlight systemd[1]: Failed to start Restore /etc from the Persistent config.
Nov 02 17:32:01 czechlight systemd[1]: cfg-restore-etc.service: Unit entered failed state.
Nov 02 17:32:01 czechlight systemd[1]: cfg-restore-etc.service: Failed with result 'exit-code'.
And indeed, that service attempted to start before that unit which sets
up the /etc overlay has finished.
Change-Id: If961d5a13784611be6083b72cfaaaa7d9079d57f
diff --git a/board/czechlight/common/overlay/usr/lib/systemd/system/cfg-restore-etc.service b/board/czechlight/common/overlay/usr/lib/systemd/system/cfg-restore-etc.service
index 6e4514e..d735d99 100644
--- a/board/czechlight/common/overlay/usr/lib/systemd/system/cfg-restore-etc.service
+++ b/board/czechlight/common/overlay/usr/lib/systemd/system/cfg-restore-etc.service
@@ -3,7 +3,7 @@
DefaultDependencies=no
Conflicts=umount.target
Before=local-fs.target umount.target
-After=cfg.mount
+After=cfg.mount etc-overlay.service
Requires=cfg.mount etc-overlay.service
ConditionDirectoryNotEmpty=/cfg/etc