For historical reasons, some NAS of my customers have customizations in
/etc/crontab to regularly execute things and in
/etc/profile to provide customized login shells for SSH/PuTTY. Additionally, login with SSH/PuTTY supports using a key pair, so the file
/root/.ssh/authorized_keys exists and is preserved during upgrades as well. While I’ve read that all contents of
/ get wiped out during updates, things don’t seem to be that easy or
/root/.ssh/authorized_keys wouldn’t be available anymore.
So here’s what I’ve found so far: Synology uses upstart and that fires the job
/usr/share/init/root-file-system.conf at some point, which itself uses a script named
/usr/syno/sbin/config_bootup_check.sh. That really seems to delete
/etc on every reboot and replace that with the contents of
/etc.defaults. This is what makes customizations in
/etc/profile disappear and can be worked around e.g. by placing those customizations into
/etc.defaults/.bashrc_profile instead, which gets sourced by
/etc/profile automatically. THOUGH, while
.bashrc_profile survives reboots, it DOES NOT survive updates.
The only workaround I can think of is creating some trigger for the task planner, as that supports executing actions on reboot, which checks if
/etc.defaults/.bashrc_profile is customized or not already and does so as necessary. That shouldn’t slowdown the boot too much and should be somewhat safe, as
/etc.defaults/.bashrc_profile seems to be designed to only change during updates.
Though, that doesn’t explain how
/root/.ssh/authorized_keys are preserved not only during reboots, but updates as well. Looking at
/root/.ssh, it has a timestamp from applying the last update, while the files within have much older timestamps. Additionally I’m somewhat sure that
/usr/syno/sbin/config_bootup_check.sh really only deletes directories like
/root. But that doesn’t explain how
/etc/crontab is kept.
So, are there any docs available about which files are kept during reboots, updates etc.?