1 |
On Tue, Feb 16, 2016 at 9:20 PM, Duncan <1i5t5.duncan@×××.net> wrote: |
2 |
> |
3 |
> Initial shutdown is via two targets (as opposed to specific services), |
4 |
|
5 |
Since not everybody in this thread may be familiar with systemd, I'll |
6 |
just add a quick definition. |
7 |
|
8 |
When systemd says "target" - think "virtual service." The equivalent |
9 |
in openrc would be an init.d script that has dependencies but which |
10 |
doesn't actually launch any processes. |
11 |
|
12 |
Targets also take the place of runlevels in systemd. |
13 |
|
14 |
Just as with runlevels in openrc they are used to synchronize |
15 |
milestones during bootup, but the design is much more generic. |
16 |
Presumably openrc hard-codes runlevels like sysinit, boot, and |
17 |
default. In systemd I believe it just looks at the config file and |
18 |
directly launches the desired target, and then the dependency chain |
19 |
for that pulls in all the targets that precede it. Targets can depend |
20 |
on other targets, and services can depend on previous targets. |
21 |
|
22 |
The other dimension is that unit files describe what target they are |
23 |
typically associated with if it isn't the default. So, you don't run |
24 |
into the sorts of situations you have with openrc that if you want to |
25 |
enable mdraid support you need to remember to add it to the boot |
26 |
runlevel. That might be a relatively-easy thing to add support for in |
27 |
openrc actually. |
28 |
|
29 |
Hopefully that makes Dunan's summary easier to read for anybody who |
30 |
doesn't speak systemdese. |
31 |
|
32 |
Another bit of background that might be helpful is that systemd also |
33 |
manages mounts directly. It parses fstab and creates a network of |
34 |
mount units with appropriate dependencies. Whether you unmount |
35 |
/var/tmp using "umount /var/tmp" or "systemctl stop var-tmp.mount" |
36 |
systemd updates the status of the var-tmp.mount unit to a stopped |
37 |
status. I believe if you add a noauto line to fstab it will create a |
38 |
mount unit automatically and not start it, and if you made it mount on |
39 |
boot I think it would actually be mounted as soon as you save the file |
40 |
in your editor (systemd can monitor config files for changes - all of |
41 |
this is governed by scripts/software called generators). |
42 |
|
43 |
So, systemd in general tries to stay aware of the state of mounts. I |
44 |
suspect that isn't just firing off a script to find/unmount anything |
45 |
that is mounted. From Dunan's email it sounds like you could create a |
46 |
mount unit and explicitly not set a conflict with the unmount target |
47 |
which would cause the filesystem to remain mounted at shutdown. I |
48 |
have no idea what that would do to unmounting the root. |
49 |
|
50 |
-- |
51 |
Rich |