2
Suppose an installation of Debian unstable, using systemd for init, with two filesystem partitions, /
and /home
. Suppose further that, for reasons to do with the physical disks, I have moved the contents of /var
to /home/var
and replaced the /var
directory with an appropriate symlink. (Please do not try to talk me out of moving /var
into the /home
partition, or turn this into a systemd argument ;-)
With this configuration, it is necessary to inform systemd that any unit which requires anything in /var
cannot be started until after /home
is mounted. The one I know to be broken (as it tries to access a file in /var/lib
very early in the boot sequence) is systemd-random-seed.service
, but there could easily be any number of others that I haven't happened to notice yet.
What is the best way to configure the general rule that "anything needing something from /var
cannot be started until after /home
is mounted"? I will accept an answer of the form "add Requires=
and After=
directives to every single unit file affected" only if you can demonstrate that there is no superior alternative.
The version of systemd currently in Debian unstable is 224.
Aha! The possibility of a bind mount occurred to me after I posted this question, but I couldn't find anything in the documentation to indicate whether or not it would work. I'll accept this after confirming it does work (the computer is in the middle of a very large package install right now). – zwol – 2015-08-14T19:18:22.777
Some care needs to be taken with the automount approach: it might work for startup, but it doesn't help at all with ordering the shutdown process... I think it's only mainly a problem with ordering networked filesystem shutdown; if a local mount fails to stop because it's still in use, then systemd-shutdown is supposed to be able to handle it. – sourcejedi – 2017-09-19T17:16:19.410