pid1: propagate the original command line when reexecuting
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 22 Jul 2021 06:21:46 +0000 (08:21 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 23 Jul 2021 09:59:07 +0000 (11:59 +0200)
commitf3af6ba86c1128ccf6d6f896f70c22f9645a51c5
tree09f147a017256e08046ea8ac9472f4f2ab552018
parentcdaf655f73bb3be10d47ab6f00d71a8d0b1a81e3
pid1: propagate the original command line when reexecuting

When we reexec the manager in a container, we lose configuration settings on
the kernel command line:

  $ systemd-nspawn -M rawhide -b systemd.status-unit-format=name systemd.show-status=yes
  ...
  # tr '\0' ' ' </proc/1/cmdline
  /usr/lib/systemd/systemd systemd.status_unit_format=combined systemd.show-status=yes
  # sudo systemctl daemon-reexec
  # tr '\0' ' ' </proc/1/cmdline
  /usr/lib/systemd/systemd --system --deserialize 20

  This means that after daemon-reexec, the settings that we gain from the
  commandline are reset to defaults.

So let's reeexecute with the original arguments copied over, modulo some
filtering.

(cherry picked from commit 846f1da465beda990c1c01346311393f485df467)
src/core/main.c