Doing a ps
on my Linux box shows that systemd
runs with the command line options --switched-root
and --deserialize
. Nothing in the man page or /usr/share/doc/systemd
mentions them, and Google hasn't been much help. So, what do they do? I'm guessing that --switched-root
has something to do with pivot_root, but that's just a guess.
-
1Good point, same here on Arch: my process n. 1 is systemd --system --deserialize 18. Again no clue from man.– MariusMatutiaeOct 30, 2013 at 11:52
1 Answer
These are intentionally undocumented internal parts of systemd. Very simply, therefore:
--deserialize
is used to restore saved internal state that a previous invocation ofsystemd
,exec()
ing this one, has written out to a file. Its option argument is an open file descriptor for that process.--switched-root
is used to tell this invocation ofsystemd
that it has been invoked fromsystemd
managing an initramfs, and so should behave accordingly — including turning off some of the behaviour otherwise caused by--deserialize
.
-
4It's a good answer. To expand on this a bit: systemd running with --deserialize --switched-root essentially means systemd was also used in the initramfs. Nowadays this is pretty common, so those two options are to be expected in the command line of PID 1.– zbyszekJun 28, 2017 at 22:20
-
3@zbyszek So what's the point here? If it's a good answer, why are those publicly exposed internal parts of
systemd
still no part in the officialsystemd
documentation yet? Shouldn't your explanation rather be included into the officialsystemd
documentation to explain to us what we see (systemd-cgls | grep deserialize
)? It's 2020 already! Are Google and SO really the only place, where such prominently publicly presented internal parts ofsystemd
should be explained to minors like us?– TinoFeb 22, 2020 at 7:47