[systemd-devel] [PATCH 1/2] core: Refuse to run a user instance when the system hasn't been booted with systemd.

Kok, Auke-jan H auke-jan.h.kok at intel.com
Fri Oct 5 20:42:01 PDT 2012


On Fri, Oct 5, 2012 at 4:11 PM, Thomas Bächler <thomas at archlinux.org> wrote:
> Running as a user instance won't work at all if systemd isn't running as system
> manager, so refuse to start in that case.

huh?

I'd like to think this is a situation that should really work...

- to test systemd in a non-systemd environment
- Chroot/namespacesVM situations where there's no contact with the
real init process
- some calamity happened or IPC is temporarily offlined
- just because it makes no sense to enforce it

what exactly breaks?

Auke



> Signed-off-by: Thomas Bächler <thomas at archlinux.org>
> ---
>  src/core/main.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/core/main.c b/src/core/main.c
> index f9aba46..3df38c2 100644
> --- a/src/core/main.c
> +++ b/src/core/main.c
> @@ -62,6 +62,7 @@
>  #include "hwclock.h"
>  #include "selinux-setup.h"
>  #include "ima-setup.h"
> +#include "sd-daemon.h"
>
>  static enum {
>          ACTION_RUN,
> @@ -1381,6 +1382,10 @@ int main(int argc, char *argv[]) {
>          } else {
>
>                  /* Running as user instance */
> +                if(!sd_booted()) {
> +                        log_error("Trying to run as user instance, but the system has not been booted with systemd.");
> +                        goto finish;
> +                }
>                  arg_running_as = SYSTEMD_USER;
>                  log_set_target(LOG_TARGET_AUTO);
>                  log_open();
> --
> 1.7.12.2
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list