* refuse automount triggers when automount is queued for stop, much like we refuse socket triggers when sockets are queued for stop
-* perfomance messages for selinux are gone from debug log?
-
* There's something wrong with escaping unit names: http://lists.freedesktop.org/archives/systemd-devel/2012-August/006292.html
* logind: different policy actions for idle, suspend, shutdown blockers: allow idle blockers by default, don't allow suspend blockers by default
saved_argc = argc;
log_show_color(isatty(STDERR_FILENO) > 0);
- log_show_location(false);
- log_set_max_level(LOG_INFO);
- if (getpid() == 1) {
+ if (getpid() == 1 && detect_container(NULL) <= 0) {
+
+ /* Running outside of a container as PID 1 */
+ arg_running_as = MANAGER_SYSTEM;
+ make_null_stdio();
+ log_set_target(LOG_TARGET_KMSG);
+ log_open();
+
if (in_initrd()) {
char *rd_timestamp = NULL;
}
}
- arg_running_as = MANAGER_SYSTEM;
-
- make_null_stdio();
- log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_JOURNAL : LOG_TARGET_JOURNAL_OR_KMSG);
-
if (!skip_setup) {
if (selinux_setup(&loaded_policy) < 0)
goto finish;
goto finish;
}
- log_open();
-
if (label_init(NULL) < 0)
goto finish;
log_error("Failed to set the kernel's time zone, ignoring: %s", strerror(-r));
}
}
+
+ /* Set the default for later on, but don't actually
+ * open the logs like this for now. Note that if we
+ * are transitioning from the initrd there might still
+ * be journal fd open, and we shouldn't attempt
+ * opening that before we parsed /proc/cmdline which
+ * might redirect output elsewhere. */
+ log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
+
+ } else if (getpid() == 1) {
+
+ /* Running inside a container, as PID 1 */
+ arg_running_as = MANAGER_SYSTEM;
+ log_set_target(LOG_TARGET_CONSOLE);
+ log_open();
+
+ /* For the later on, see above... */
+ log_set_target(LOG_TARGET_JOURNAL);
+
} else {
+
+ /* Running as user instance */
arg_running_as = MANAGER_USER;
log_set_target(LOG_TARGET_AUTO);
log_open();