diff --git a/Makefile.am b/Makefile.am index ee16f9800..7ca0ae858 100644 --- a/Makefile.am +++ b/Makefile.am @@ -244,6 +244,7 @@ dist_systemunit_DATA = \ units/halt.target \ units/kexec.target \ units/local-fs.target \ + units/remote-fs.target \ units/cryptsetup.target \ units/network.target \ units/nss-lookup.target \ @@ -301,7 +302,6 @@ nodist_systemunit_DATA = \ units/getty@.service \ units/serial-getty@.service \ units/console-shell.service \ - units/remote-fs.target \ units/systemd-initctl.service \ units/systemd-logger.service \ units/systemd-shutdownd.service \ @@ -342,14 +342,12 @@ dist_userunit_DATA = \ units/user/exit.target nodist_userunit_DATA = \ - units/user/remote-fs.target \ units/user/exit.service EXTRA_DIST = \ units/getty@.service.m4 \ units/serial-getty@.service.m4 \ units/console-shell.service.m4 \ - units/remote-fs.target.m4 \ units/rescue.service.m4 \ units/systemd-initctl.service.in \ units/systemd-logger.service.in \ @@ -1388,11 +1386,9 @@ endif $(LN_S) ../var-run.mount var-run.mount && \ $(LN_S) ../media.mount media.mount ) ( cd $(DESTDIR)$(userunitdir) && \ - rm -f shutdown.target sockets.target local-fs.target swap.target bluetooth.target printer.target sound.target && \ + rm -f shutdown.target sockets.target bluetooth.target printer.target sound.target && \ $(LN_S) $(systemunitdir)/shutdown.target shutdown.target && \ $(LN_S) $(systemunitdir)/sockets.target sockets.target && \ - $(LN_S) $(systemunitdir)/local-fs.target local-fs.target && \ - $(LN_S) $(systemunitdir)/swap.target swap.target && \ $(LN_S) $(systemunitdir)/bluetooth.target bluetooth.target && \ $(LN_S) $(systemunitdir)/printer.target printer.target && \ $(LN_S) $(systemunitdir)/sound.target sound.target ) diff --git a/TODO b/TODO index 7e0c72517..ff18af242 100644 --- a/TODO +++ b/TODO @@ -50,6 +50,8 @@ Features: * add prefix match to sysctl, tmpfiles, ... +* send out "finished" signal when we are finished booting + * drop /.readahead on bigger upgrades with yum * add inode stat() check to readahead to suppress preloading changed files @@ -72,6 +74,8 @@ Features: * show enablement status in systemctl status +* when failing to start a service due to ratelimiting, try again later, if restart=always is set + * write blog stories about: - enabling dbus services - status update diff --git a/configure.ac b/configure.ac index 85a14c6aa..eb5fb6a97 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.63) -AC_INIT([systemd],[28],[systemd-devel@lists.freedesktop.org]) +AC_INIT([systemd],[29],[systemd-devel@lists.freedesktop.org]) AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) diff --git a/man/os-release.xml b/man/os-release.xml index d8a45b303..f85119d26 100644 --- a/man/os-release.xml +++ b/man/os-release.xml @@ -116,10 +116,12 @@ ID= A lower-case string - identifying the operating system, - excluding any version information and - suitable for processing by scripts. If - not set defaults to + (no spaces) identifying the operating + system, excluding any version + information and suitable for + processing by scripts or usage in + generated file names. If not set + defaults to linux. Example: ID=fedora. @@ -128,10 +130,10 @@ VERSION_ID= A lower-case string - (mostly numeric) identifying the + (mostly numeric, no spaces) identifying the operating system version, excluding any name information and suitable for - processing by scripts. Example: + processing by scripts or usage in generated file names. Example: VERSION_ID=15. diff --git a/man/pam_systemd.xml b/man/pam_systemd.xml index 11852eb02..208c7da1c 100644 --- a/man/pam_systemd.xml +++ b/man/pam_systemd.xml @@ -273,6 +273,14 @@ be reset for the processes of the logged in user. + + + + + Takes a boolean + argument. If true, logs debugging + information. + Note that setting kill-user=1 diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml index de1d9bf44..7b4f7e39c 100644 --- a/man/systemd.exec.xml +++ b/man/systemd.exec.xml @@ -57,13 +57,13 @@ Description - Unit configuration files for services, sockets + Unit configuration files for services, sockets, mount points and swap devices share a subset of configuration options which define the execution environment of spawned processes. This man page lists the configuration options - shared by these three unit types. See + shared by these four unit types. See systemd.unit5 for the common options of all unit configuration files, and diff --git a/src/cryptsetup-generator.c b/src/cryptsetup-generator.c index 696f44ae3..db8ebdfb1 100644 --- a/src/cryptsetup-generator.c +++ b/src/cryptsetup-generator.c @@ -47,7 +47,7 @@ static bool has_option(const char *haystack, const char *needle) { continue; } - if (f[l] != 0 && f[l] == ',') { + if (f[l] != 0 && f[l] != ',') { f++; continue; } diff --git a/src/dbus-execute.c b/src/dbus-execute.c index 3f8fafe6c..6ceffc57a 100644 --- a/src/dbus-execute.c +++ b/src/dbus-execute.c @@ -235,7 +235,7 @@ int bus_execute_append_capability_bs(DBusMessageIter *i, const char *property, v assert(property); assert(c); - /* We store this negated internally, to match the kernel, bu + /* We store this negated internally, to match the kernel, but * we expose it normalized. */ normal = *(uint64_t*) data; diff --git a/src/dbus-execute.h b/src/dbus-execute.h index 42df5aa33..56c5bcd4f 100644 --- a/src/dbus-execute.h +++ b/src/dbus-execute.h @@ -77,7 +77,7 @@ " \n" \ " \n" \ " \n" \ - " \n" \ + " \n" \ " \n" \ " \n" \ " \n" \ diff --git a/src/execute.h b/src/execute.h index 4ed79f0d8..55bae24a2 100644 --- a/src/execute.h +++ b/src/execute.h @@ -211,10 +211,10 @@ void exec_status_exit(ExecStatus *s, ExecContext *context, pid_t pid, int code, void exec_status_dump(ExecStatus *s, FILE *f, const char *prefix); const char* exec_output_to_string(ExecOutput i); -int exec_output_from_string(const char *s); +ExecOutput exec_output_from_string(const char *s); const char* exec_input_to_string(ExecInput i); -int exec_input_from_string(const char *s); +ExecInput exec_input_from_string(const char *s); const char *kill_mode_to_string(KillMode k); KillMode kill_mode_from_string(const char *s); diff --git a/src/mount-setup.c b/src/mount-setup.c index 48c32eab3..f236ab741 100644 --- a/src/mount-setup.c +++ b/src/mount-setup.c @@ -54,7 +54,7 @@ static const MountPoint mount_table[] = { { "devtmpfs", "/dev", "devtmpfs", "mode=755", MS_NOSUID, true }, { "tmpfs", "/dev/shm", "tmpfs", "mode=1777", MS_NOSUID|MS_NODEV, true }, { "devpts", "/dev/pts", "devpts", "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC, false }, - { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV, true }, + { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NODEV, true }, { "tmpfs", "/sys/fs/cgroup", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV, false }, { "cgroup", "/sys/fs/cgroup/systemd", "cgroup", "none,name=systemd", MS_NOSUID|MS_NOEXEC|MS_NODEV, false }, }; @@ -63,6 +63,7 @@ static const MountPoint mount_table[] = { * we just list them here so that we know that we should ignore them */ static const char * const ignore_paths[] = { + "/sys/fs/selinux", "/selinux", "/proc/bus/usb" }; diff --git a/src/nspawn.c b/src/nspawn.c index 969c96189..b5908d63f 100644 --- a/src/nspawn.c +++ b/src/nspawn.c @@ -117,7 +117,7 @@ static int mount_all(const char *dest) { { "sysfs", "/sys", "sysfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, true }, { "tmpfs", "/dev", "tmpfs", "mode=755", MS_NOSUID, true }, { "/dev/pts", "/dev/pts", "bind", NULL, MS_BIND, true }, - { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NOEXEC|MS_NODEV, true }, + { "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NODEV, true }, #ifdef HAVE_SELINUX { "selinux", "/selinux", "selinuxfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_RDONLY, false }, #endif diff --git a/src/pam-module.c b/src/pam-module.c index 03864fed3..bdf61334e 100644 --- a/src/pam-module.c +++ b/src/pam-module.c @@ -46,7 +46,8 @@ static int parse_argv(pam_handle_t *handle, char ***controllers, char ***reset_controllers, char ***kill_only_users, - char ***kill_exclude_users) { + char ***kill_exclude_users, + bool *debug) { unsigned i; bool reset_controller_set = false; @@ -145,6 +146,15 @@ static int parse_argv(pam_handle_t *handle, kill_exclude_users_set = true; + } else if (startswith(argv[i], "debug=")) { + if ((k = parse_boolean(argv[i] + 6)) < 0) { + pam_syslog(handle, LOG_ERR, "Failed to parse debug= argument."); + return k; + } + + if (debug) + *debug = k; + } else { pam_syslog(handle, LOG_ERR, "Unknown parameter '%s'.", argv[i]); return -EINVAL; @@ -406,6 +416,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( char *buf = NULL; int lock_fd = -1; bool create_session = true; + bool debug = false; char **controllers = NULL, **reset_controllers = NULL, **c; char *cgroup_user_tree = NULL; @@ -421,7 +432,7 @@ _public_ PAM_EXTERN int pam_sm_open_session( argc, argv, &create_session, NULL, NULL, &controllers, &reset_controllers, - NULL, NULL) < 0) + NULL, NULL, &debug) < 0) return PAM_SESSION_ERR; if ((r = get_user_data(handle, &username, &pw)) != PAM_SUCCESS) @@ -505,7 +516,8 @@ _public_ PAM_EXTERN int pam_sm_open_session( goto finish; } - pam_syslog(handle, LOG_DEBUG, "Moving new user session for %s into control group %s.", username, buf); + if (debug) + pam_syslog(handle, LOG_DEBUG, "Moving new user session for %s into control group %s.", username, buf); if ((r = create_user_group(handle, SYSTEMD_CGROUP_CONTROLLER, buf, pw, true, true)) != PAM_SUCCESS) goto finish; @@ -616,6 +628,7 @@ _public_ PAM_EXTERN int pam_sm_close_session( const char *username = NULL; bool kill_session = false; bool kill_user = false; + bool debug = false; int lock_fd = -1, r; char *session_path = NULL, *nosession_path = NULL, *user_path = NULL; const char *id; @@ -634,7 +647,7 @@ _public_ PAM_EXTERN int pam_sm_close_session( argc, argv, NULL, &kill_session, &kill_user, &controllers, NULL, - &kill_only_users, &kill_exclude_users) < 0) + &kill_only_users, &kill_exclude_users, &debug) < 0) return PAM_SESSION_ERR; if ((r = get_user_data(handle, &username, &pw)) != PAM_SUCCESS) @@ -676,13 +689,15 @@ _public_ PAM_EXTERN int pam_sm_close_session( } if (kill_session && check_user_lists(handle, pw->pw_uid, kill_only_users, kill_exclude_users)) { - pam_syslog(handle, LOG_DEBUG, "Killing remaining processes of user session %s of %s.", id, username); + if (debug) + pam_syslog(handle, LOG_DEBUG, "Killing remaining processes of user session %s of %s.", id, username); /* Kill processes in session cgroup, and delete it */ if ((r = cg_kill_recursive_and_wait(SYSTEMD_CGROUP_CONTROLLER, session_path, true)) < 0) pam_syslog(handle, LOG_ERR, "Failed to kill session cgroup: %s", strerror(-r)); } else { - pam_syslog(handle, LOG_DEBUG, "Moving remaining processes of user session %s of %s into control group %s.", id, username, nosession_path); + if (debug) + pam_syslog(handle, LOG_DEBUG, "Moving remaining processes of user session %s of %s into control group %s.", id, username, nosession_path); /* Migrate processes from session to user * cgroup. First, try to create the user group diff --git a/src/readahead-common.c b/src/readahead-common.c index 8a75b2e13..f0d57b4c6 100644 --- a/src/readahead-common.c +++ b/src/readahead-common.c @@ -154,9 +154,8 @@ bool enough_ram(void) { assert_se(sysinfo(&si) >= 0); - return si.totalram > 127 * 1024*1024; /* Enable readahead only - * with at least 128MB - * memory */ + /* Enable readahead only with at least 128MB memory */ + return si.totalram > 127 * 1024*1024 / si.mem_unit; } int open_inotify(void) { diff --git a/src/selinux-setup.c b/src/selinux-setup.c index c32c7ad8d..9ff27dcd7 100644 --- a/src/selinux-setup.c +++ b/src/selinux-setup.c @@ -39,7 +39,8 @@ int selinux_setup(char *const argv[]) { int enforce = 0; /* Already initialized? */ - if (path_is_mount_point("/selinux") > 0) + if (path_is_mount_point("/sys/fs/selinux") > 0 || + path_is_mount_point("/selinux") > 0) return 0; /* Before we load the policy we create a flag file to ensure diff --git a/src/systemctl.c b/src/systemctl.c index 99ada3830..08c7fabb7 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -1565,6 +1565,7 @@ static int check_unit(DBusConnection *bus, char **args, unsigned n) { dbus_error_free(&error); dbus_message_unref(m); + m = NULL; continue; } @@ -3962,6 +3963,7 @@ static int create_symlink(const char *verb, const char *old_path, const char *ne return 1; } + free(dest); return 0; } @@ -4088,7 +4090,7 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo } if (!f) { -#if (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA)) || defined(TARGET_MEEGO) && defined (HAVE_SYSV_COMPAT) +#if (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_SUSE) || defined(TARGET_MEEGO) || defined(TARGET_ALTLINUX)) && defined (HAVE_SYSV_COMPAT) if (endswith(i->name, ".service")) { char *sysv; @@ -4159,14 +4161,6 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo return -ENOENT; } - /* Consider unit files stored in /lib and /usr always enabled - * if they have no [Install] data. */ - if (streq(verb, "is-enabled") && - strv_isempty(i->aliases) && - strv_isempty(i->wanted_by) && - !path_startswith(filename, "/etc")) - return 1; - i->path = filename; if ((r = config_parse(filename, f, NULL, items, true, i)) < 0) { @@ -4174,6 +4168,16 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo return r; } + /* Consider unit files stored in /lib and /usr always enabled + * if they have no [Install] data. */ + if (streq(verb, "is-enabled") && + strv_isempty(i->aliases) && + strv_isempty(i->wanted_by) && + !path_startswith(filename, "/etc")) { + fclose(f); + return 1; + } + n_symlinks += strv_length(i->aliases); n_symlinks += strv_length(i->wanted_by); diff --git a/units/.gitignore b/units/.gitignore index fe23b1226..f969466bd 100644 --- a/units/.gitignore +++ b/units/.gitignore @@ -31,7 +31,6 @@ systemd-random-seed-save.service systemd-initctl.service systemd-logger.service getty@.service -remote-fs.target systemd-update-utmp-runlevel.service systemd-update-utmp-shutdown.service test-env-replace diff --git a/units/remote-fs.target.m4 b/units/remote-fs.target similarity index 74% rename from units/remote-fs.target.m4 rename to units/remote-fs.target index c11ffbffa..61920d8f0 100644 --- a/units/remote-fs.target.m4 +++ b/units/remote-fs.target @@ -9,11 +9,7 @@ [Unit] Description=Remote File Systems -m4_dnl -m4_ifdef(`FOR_SYSTEM', -m4_dnl When running in system mode we need the network up -After=network.target local-fs.target -)m4_dnl +After=local-fs.target [Install] WantedBy=multi-user.target