Fixes for preset-all, daemon-reexec, and other bugs
This commit is contained in:
parent
2666b4f578
commit
696e2f22d4
@ -0,0 +1,36 @@
|
||||
From 555c57de77d0a364c116b28809524a1067e2159f Mon Sep 17 00:00:00 2001
|
||||
From: Christian Rebischke <Chris.Rebischke@posteo.de>
|
||||
Date: Thu, 28 Jul 2016 04:40:20 +0200
|
||||
Subject: [PATCH] systemctl: be sure to be quiet with 'systemctl is-enabled
|
||||
--quiet' (#3819)
|
||||
|
||||
Fixes #3813.
|
||||
(cherry picked from commit 689e4e6a94222b4d58a8b9cb3c51cc2f82268aa9)
|
||||
---
|
||||
src/systemctl/systemctl.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
||||
index 6a0ed79a53..6e61eeadef 100644
|
||||
--- a/src/systemctl/systemctl.c
|
||||
+++ b/src/systemctl/systemctl.c
|
||||
@@ -5566,10 +5566,12 @@ static int enable_sysv_units(const char *verb, char **args) {
|
||||
if (!found_sysv)
|
||||
continue;
|
||||
|
||||
- if (found_native)
|
||||
- log_info("Synchronizing state of %s with SysV service script with %s.", name, argv[0]);
|
||||
- else
|
||||
- log_info("%s is not a native service, redirecting to systemd-sysv-install.", name);
|
||||
+ if (!arg_quiet) {
|
||||
+ if (found_native)
|
||||
+ log_info("Synchronizing state of %s with SysV service script with %s.", name, argv[0]);
|
||||
+ else
|
||||
+ log_info("%s is not a native service, redirecting to systemd-sysv-install.", name);
|
||||
+ }
|
||||
|
||||
if (!isempty(arg_root))
|
||||
argv[c++] = q = strappend("--root=", arg_root);
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 821098286ee773662245254c11ada000ab32fa91 Mon Sep 17 00:00:00 2001
|
||||
From: Tejun Heo <htejun@fb.com>
|
||||
Date: Sun, 31 Jul 2016 21:38:47 -0400
|
||||
Subject: [PATCH] logind: 0% and 100% should be valid for UserTasksMax (#3836)
|
||||
|
||||
config_parse_user_tasks_max() was incorrectly accepting percentage value
|
||||
between 1 and 99. Update it to accept 0% and 100%. This brings it in line
|
||||
with TasksMax handling in systemd.
|
||||
(cherry picked from commit cb3e4417590196bd30e1b8097348dca6ba34bd15)
|
||||
---
|
||||
src/login/logind-user.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
|
||||
index 348e396292..63363035e7 100644
|
||||
--- a/src/login/logind-user.c
|
||||
+++ b/src/login/logind-user.c
|
||||
@@ -893,7 +893,7 @@ int config_parse_user_tasks_max(
|
||||
|
||||
/* First, try to parse as percentage */
|
||||
r = parse_percent(rvalue);
|
||||
- if (r > 0 && r < 100)
|
||||
+ if (r >= 0)
|
||||
k = system_tasks_max_scale(r, 100U);
|
||||
else {
|
||||
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,43 @@
|
||||
From c877672ff6ec11efc8cd55d4c156211b16cf0975 Mon Sep 17 00:00:00 2001
|
||||
From: tblume <Thomas.Blume@suse.com>
|
||||
Date: Tue, 2 Aug 2016 14:55:25 +0200
|
||||
Subject: [PATCH] systemd-ask-password: make sure directory watch is started
|
||||
before cryptsetup (#3850)
|
||||
|
||||
The password directory watch should get ordered before cryptsetup to make sure
|
||||
that the password for unlocking the crypt device gets prompted.
|
||||
(cherry picked from commit 7633f8ef371a0992374956437fb7bb8189156b10)
|
||||
---
|
||||
units/systemd-ask-password-console.path | 2 +-
|
||||
units/systemd-ask-password-wall.path | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/units/systemd-ask-password-console.path b/units/systemd-ask-password-console.path
|
||||
index 2949635fea..7899ae788f 100644
|
||||
--- a/units/systemd-ask-password-console.path
|
||||
+++ b/units/systemd-ask-password-console.path
|
||||
@@ -11,7 +11,7 @@ Documentation=man:systemd-ask-password-console.service(8)
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
After=plymouth-start.service
|
||||
-Before=paths.target shutdown.target
|
||||
+Before=paths.target shutdown.target cryptsetup.target
|
||||
ConditionPathExists=!/run/plymouth/pid
|
||||
|
||||
[Path]
|
||||
diff --git a/units/systemd-ask-password-wall.path b/units/systemd-ask-password-wall.path
|
||||
index 95ec9bc8a0..a3ca617256 100644
|
||||
--- a/units/systemd-ask-password-wall.path
|
||||
+++ b/units/systemd-ask-password-wall.path
|
||||
@@ -10,7 +10,7 @@ Description=Forward Password Requests to Wall Directory Watch
|
||||
Documentation=man:systemd-ask-password-console.service(8)
|
||||
DefaultDependencies=no
|
||||
Conflicts=shutdown.target
|
||||
-Before=paths.target shutdown.target
|
||||
+Before=paths.target shutdown.target cryptsetup.target
|
||||
|
||||
[Path]
|
||||
DirectoryNotEmpty=/run/systemd/ask-password
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 811a90e2de94c71bddf02cdab36c1a0560288695 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Mantas=20Mikul=C4=97nas?= <grawity@gmail.com>
|
||||
Date: Mon, 8 Aug 2016 11:07:38 +0300
|
||||
Subject: [PATCH] Revert "logind: really handle *KeyIgnoreInhibited options in
|
||||
logind.conf"
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This reverts commit 8121f4d209eca85dcb11830800483cdfafbef9b7.
|
||||
|
||||
The special 'key handling' inhibitors should always work regardless of
|
||||
any *IgnoreInhibited settings – otherwise they're nearly useless.
|
||||
|
||||
Reverts: #3470
|
||||
Fixes: #3897
|
||||
(cherry picked from commit 06a70b918d4d753769a727239f75af8896006467)
|
||||
---
|
||||
src/login/logind-action.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
|
||||
index 8ef48dbaa1..a950409254 100644
|
||||
--- a/src/login/logind-action.c
|
||||
+++ b/src/login/logind-action.c
|
||||
@@ -85,7 +85,7 @@ int manager_handle_action(
|
||||
}
|
||||
|
||||
/* If the key handling is inhibited, don't do anything */
|
||||
- if (!ignore_inhibited && inhibit_key > 0) {
|
||||
+ if (inhibit_key > 0) {
|
||||
if (manager_is_inhibited(m, inhibit_key, INHIBIT_BLOCK, NULL, true, false, 0, NULL)) {
|
||||
log_debug("Refusing operation, %s is inhibited.", inhibit_what_to_string(inhibit_key));
|
||||
return 0;
|
||||
--
|
||||
2.9.0
|
||||
|
112
0005-man-explain-that-KeyIgnoreInhibited-only-apply-to-a-.patch
Normal file
112
0005-man-explain-that-KeyIgnoreInhibited-only-apply-to-a-.patch
Normal file
@ -0,0 +1,112 @@
|
||||
From 9ecf9e414a97e861db403e043696fed6033508f0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 14 Aug 2016 16:27:59 -0400
|
||||
Subject: [PATCH] man: explain that *KeyIgnoreInhibited only apply to a subset
|
||||
of locks
|
||||
|
||||
Follow-up for #3924.
|
||||
|
||||
(cherry picked from commit 05b2a8fd7a0533758d2f532df798cabc3c442683)
|
||||
---
|
||||
man/logind.conf.xml | 42 ++++++++++++++++++++++++++----------------
|
||||
man/systemd-inhibit.xml | 2 +-
|
||||
man/systemd-logind.service.xml | 2 +-
|
||||
3 files changed, 28 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/man/logind.conf.xml b/man/logind.conf.xml
|
||||
index adba5a4131..5931832996 100644
|
||||
--- a/man/logind.conf.xml
|
||||
+++ b/man/logind.conf.xml
|
||||
@@ -211,7 +211,7 @@
|
||||
<term><varname>HandleLidSwitch=</varname></term>
|
||||
<term><varname>HandleLidSwitchDocked=</varname></term>
|
||||
|
||||
- <listitem><para>Controls whether logind shall handle the
|
||||
+ <listitem><para>Controls how logind shall handle the
|
||||
system power and sleep keys and the lid switch to trigger
|
||||
actions such as system power-off or suspend. Can be one of
|
||||
<literal>ignore</literal>,
|
||||
@@ -240,7 +240,16 @@
|
||||
docking station, or if more than one display is connected, the
|
||||
action specified by <varname>HandleLidSwitchDocked=</varname>
|
||||
occurs; otherwise the <varname>HandleLidSwitch=</varname>
|
||||
- action occurs.</para></listitem>
|
||||
+ action occurs.</para>
|
||||
+
|
||||
+ <para>A different application may disable logind's handling of system power and
|
||||
+ sleep keys and the lid switch by taking a low-level inhibitor lock
|
||||
+ ("handle-power-key", "handle-suspend-key", "handle-hibernate-key",
|
||||
+ "handle-lid-switch"). This is most commonly used by graphical desktop environments
|
||||
+ to take over suspend and hibernation handling, and to use their own configuration
|
||||
+ mechanisms. If a low-level inhibitor lock is taken, logind will not take any
|
||||
+ action when that key or switch is triggered and the <varname>Handle*=</varname>
|
||||
+ settings are irrelevant.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
@@ -249,21 +258,22 @@
|
||||
<term><varname>HibernateKeyIgnoreInhibited=</varname></term>
|
||||
<term><varname>LidSwitchIgnoreInhibited=</varname></term>
|
||||
|
||||
- <listitem><para>Controls whether actions triggered by the
|
||||
- power and sleep keys and the lid switch are subject to
|
||||
- inhibitor locks. These settings take boolean arguments. If
|
||||
- <literal>no</literal>, the inhibitor locks taken by
|
||||
- applications in order to block the requested operation are
|
||||
- respected. If <literal>yes</literal>, the requested operation
|
||||
- is executed in any case.
|
||||
+ <listitem><para>Controls whether actions that <command>systemd-logind</command>
|
||||
+ takes when the power and sleep keys and the lid switch are triggered are subject
|
||||
+ to high-level inhibitor locks ("shutdown", "sleep", "idle"). Low level inhibitor
|
||||
+ locks ("handle-*-key"), are always honoured, irrespective of this setting.</para>
|
||||
+
|
||||
+ <para>These settings take boolean arguments. If <literal>no</literal>, the
|
||||
+ inhibitor locks taken by applications are respected. If <literal>yes</literal>,
|
||||
+ "shutdown", "sleep", and "idle" inhibitor locks are ignored.
|
||||
<varname>PowerKeyIgnoreInhibited=</varname>,
|
||||
- <varname>SuspendKeyIgnoreInhibited=</varname> and
|
||||
- <varname>HibernateKeyIgnoreInhibited=</varname> default to
|
||||
- <literal>no</literal>.
|
||||
- <varname>LidSwitchIgnoreInhibited=</varname> defaults to
|
||||
- <literal>yes</literal>. This means that the lid switch does
|
||||
- not respect suspend blockers by default, but the power and
|
||||
- sleep keys do. </para></listitem>
|
||||
+ <varname>SuspendKeyIgnoreInhibited=</varname>, and
|
||||
+ <varname>HibernateKeyIgnoreInhibited=</varname> default to <literal>no</literal>.
|
||||
+ <varname>LidSwitchIgnoreInhibited=</varname> defaults to <literal>yes</literal>.
|
||||
+ This means that when <command>systemd-logind</command> is handling events by
|
||||
+ itself (no low level inhibitor locks are taken by another application), the lid
|
||||
+ switch does not respect suspend blockers by default, but the power and sleep keys
|
||||
+ do.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
diff --git a/man/systemd-inhibit.xml b/man/systemd-inhibit.xml
|
||||
index 9d85908f97..ce169960d8 100644
|
||||
--- a/man/systemd-inhibit.xml
|
||||
+++ b/man/systemd-inhibit.xml
|
||||
@@ -61,7 +61,7 @@
|
||||
<title>Description</title>
|
||||
|
||||
<para><command>systemd-inhibit</command> may be used to execute a
|
||||
- program with a shutdown, sleep or idle inhibitor lock taken. The
|
||||
+ program with a shutdown, sleep, or idle inhibitor lock taken. The
|
||||
lock will be acquired before the specified command line is
|
||||
executed and released afterwards.</para>
|
||||
|
||||
diff --git a/man/systemd-logind.service.xml b/man/systemd-logind.service.xml
|
||||
index 5733e42cd1..f0bdb1c756 100644
|
||||
--- a/man/systemd-logind.service.xml
|
||||
+++ b/man/systemd-logind.service.xml
|
||||
@@ -84,7 +84,7 @@
|
||||
management</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
- <para>User sessions are registered in logind via the
|
||||
+ <para>User sessions are registered with logind via the
|
||||
<citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||
PAM module.</para>
|
||||
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,28 @@
|
||||
From ee2b7cbcd0633aaddd4f758580e9157dea0e6a1c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Thu, 11 Aug 2016 21:53:32 -0400
|
||||
Subject: [PATCH] systemctl: fix preset-all with missing /etc/systemd/system
|
||||
|
||||
If the directory is missing, we can assume that those pesky symlinks are gone too.
|
||||
|
||||
(cherry picked from commit 32d9493e593fed7fe5b4dd1e92fe4fd419042fe5)
|
||||
---
|
||||
src/shared/install.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 7b49e1ece9..2d9306058d 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -620,7 +620,7 @@ static int remove_marked_symlinks(
|
||||
|
||||
fd = open(config_path, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW);
|
||||
if (fd < 0)
|
||||
- return -errno;
|
||||
+ return errno == ENOENT ? 0 : -errno;
|
||||
|
||||
do {
|
||||
int q, cfd;
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,77 @@
|
||||
From 6f3bf5e9e0ba04df7ffc85b6a21d296c2902edcb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Fri, 12 Aug 2016 23:50:58 -0400
|
||||
Subject: [PATCH] shared/install: remove unused paramater and add more comments
|
||||
|
||||
(cherry picked from commit ff56349d5a83f2202ed331f232f5d73467db482c)
|
||||
---
|
||||
src/shared/install.c | 18 ++++++++++++------
|
||||
1 file changed, 12 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 2d9306058d..5e0f9c5d0c 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -903,6 +903,10 @@ static int install_info_may_process(
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * Adds a new UnitFileInstallInfo entry under name in the InstallContext.will_process
|
||||
+ * hashmap, or retrieves the existing one if already present.
|
||||
+ */
|
||||
static int install_info_add(
|
||||
InstallContext *c,
|
||||
const char *name,
|
||||
@@ -1334,9 +1338,8 @@ static int install_info_follow(
|
||||
}
|
||||
|
||||
/**
|
||||
- * Search for the unit file. If the unit name is a symlink,
|
||||
- * follow the symlink to the target, maybe more than once.
|
||||
- * Propagate the instance name if present.
|
||||
+ * Search for the unit file. If the unit name is a symlink, follow the symlink to the
|
||||
+ * target, maybe more than once. Propagate the instance name if present.
|
||||
*/
|
||||
static int install_info_traverse(
|
||||
UnitFileScope scope,
|
||||
@@ -1421,6 +1424,10 @@ static int install_info_traverse(
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * Call install_info_add() with name_or_path as the path (if name_or_path starts with "/")
|
||||
+ * or the name (otherwise). root_dir is prepended to the path.
|
||||
+ */
|
||||
static int install_info_add_auto(
|
||||
InstallContext *c,
|
||||
const LookupPaths *paths,
|
||||
@@ -2685,7 +2692,6 @@ static int preset_prepare_one(
|
||||
InstallContext *plus,
|
||||
InstallContext *minus,
|
||||
LookupPaths *paths,
|
||||
- UnitFilePresetMode mode,
|
||||
const char *name,
|
||||
Presets presets,
|
||||
UnitFileChange **changes,
|
||||
@@ -2748,7 +2754,7 @@ int unit_file_preset(
|
||||
return r;
|
||||
|
||||
STRV_FOREACH(i, files) {
|
||||
- r = preset_prepare_one(scope, &plus, &minus, &paths, mode, *i, presets, changes, n_changes);
|
||||
+ r = preset_prepare_one(scope, &plus, &minus, &paths, *i, presets, changes, n_changes);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
@@ -2809,7 +2815,7 @@ int unit_file_preset_all(
|
||||
continue;
|
||||
|
||||
/* we don't pass changes[] in, because we want to handle errors on our own */
|
||||
- r = preset_prepare_one(scope, &plus, &minus, &paths, mode, de->d_name, presets, NULL, 0);
|
||||
+ r = preset_prepare_one(scope, &plus, &minus, &paths, de->d_name, presets, NULL, 0);
|
||||
if (r == -ERFKILL)
|
||||
r = unit_file_changes_add(changes, n_changes,
|
||||
UNIT_FILE_IS_MASKED, de->d_name, NULL);
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,86 @@
|
||||
From 35b8a55c85aa69af9634af337085da777d438bea Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 13 Aug 2016 01:20:29 -0400
|
||||
Subject: [PATCH] shared/install: ignore unit symlinks when doing preset-all
|
||||
|
||||
Before, when interating over unit files during preset-all, behaviour was the
|
||||
following:
|
||||
|
||||
- if we hit the real unit name first, presets were queried for that name, and
|
||||
that unit was enabled or disabled accordingly,
|
||||
|
||||
- if we hit an alias first (one of the symlinks chaining to the real unit), we
|
||||
checked the presets using the symlink name, and then proceeded to enable or
|
||||
disable the real unit.
|
||||
|
||||
E.g. for systemd-networkd.service we have the alias dbus-org.freedesktop.network1.service
|
||||
(/usr/lib/systemd/system/dbus-org.freedesktop.network1.service), but the preset
|
||||
is only for the systemd-networkd.service name. The service would be enabled or
|
||||
disabled pseudorandomly depending on the order of iteration.
|
||||
|
||||
For "preset", behaviour was analogous: preset on the alias name disabled the
|
||||
service (following the default disable policy), preset on the "real" name
|
||||
applied the presets.
|
||||
|
||||
With the patch, for "preset" and "preset-all" we silently skip symlinks. This
|
||||
gives mostly the right behaviour, with the limitation that presets on aliases
|
||||
are ignored. I think that presets on aliases are not that common (at least my
|
||||
preset files on Fedora don't exhibit any such usage), and should not be
|
||||
necessary, since whoever installs the preset can just refer to the real unit
|
||||
file. It would be possible to overcome this limitation by gathering a list of
|
||||
names of a unit first, and then checking whether *any* of the names matches the
|
||||
presets list. That would require a significant redesign of the code, and be
|
||||
a lot slower (since we would have to fully read all unit directories to preset
|
||||
one unit) to so I'm not doing that for now.
|
||||
|
||||
With this patch, two properties are satisfied:
|
||||
- preset-all and preset are idempotent, and the second and subsequent invocations
|
||||
do not produce any changes,
|
||||
- preset-all and preset for a specific name produce the same state for that unit.
|
||||
|
||||
Fixes #3616.
|
||||
|
||||
(cherry picked from commit 11e11fd57a837ea1cb142009c3048882392f3ed3)
|
||||
---
|
||||
src/shared/install.c | 13 ++++++++++---
|
||||
1 file changed, 10 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 5e0f9c5d0c..ef5a56391c 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -1974,7 +1974,6 @@ int unit_file_revert(
|
||||
unsigned *n_changes) {
|
||||
|
||||
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
|
||||
- /* _cleanup_(install_context_done) InstallContext c = {}; */
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_strv_free_ char **todo = NULL;
|
||||
size_t n_todo = 0, n_allocated = 0;
|
||||
@@ -2697,13 +2696,21 @@ static int preset_prepare_one(
|
||||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
+ _cleanup_(install_context_done) InstallContext tmp = {};
|
||||
UnitFileInstallInfo *i;
|
||||
int r;
|
||||
|
||||
- if (install_info_find(plus, name) ||
|
||||
- install_info_find(minus, name))
|
||||
+ if (install_info_find(plus, name) || install_info_find(minus, name))
|
||||
return 0;
|
||||
|
||||
+ r = install_info_discover(scope, &tmp, paths, name, SEARCH_FOLLOW_CONFIG_SYMLINKS, &i);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+ if (!streq(name, i->name)) {
|
||||
+ log_debug("Skipping %s because is an alias for %s", name, i->name);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
r = query_presets(name, presets);
|
||||
if (r < 0)
|
||||
return r;
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,97 @@
|
||||
From c9b3950580db43c576d3ec8f7bf14e49905a09cb Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 13 Aug 2016 09:38:12 -0400
|
||||
Subject: [PATCH] man: describe what symlinks to unit do, and specify that
|
||||
presets must use real names
|
||||
|
||||
The man pages didn't ever mention that symlinks to units can be created, and what
|
||||
exactly this means. Fix that omission, and disallow presets on alias names.
|
||||
|
||||
(cherry picked from commit d923e42eed9a29137821760dafecb13798264c07)
|
||||
---
|
||||
man/systemctl.xml | 3 ++-
|
||||
man/systemd.preset.xml | 4 ++++
|
||||
man/systemd.unit.xml | 36 +++++++++++++++++++++++-------------
|
||||
3 files changed, 29 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/man/systemctl.xml b/man/systemctl.xml
|
||||
index e7880d24f7..8b73e91bdb 100644
|
||||
--- a/man/systemctl.xml
|
||||
+++ b/man/systemctl.xml
|
||||
@@ -1088,7 +1088,8 @@ kobject-uevent 1 systemd-udevd-kernel.socket systemd-udevd.service
|
||||
enabled and disabled, or only enabled, or only disabled.</para>
|
||||
|
||||
<para>If the unit carries no install information, it will be silently ignored
|
||||
- by this command.</para>
|
||||
+ by this command. <replaceable>NAME</replaceable> must be the real unit name,
|
||||
+ any alias names are ignored silently.</para>
|
||||
|
||||
<para>For more information on the preset policy format, see
|
||||
<citerefentry><refentrytitle>systemd.preset</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
||||
diff --git a/man/systemd.preset.xml b/man/systemd.preset.xml
|
||||
index b7164014f0..d09167baaf 100644
|
||||
--- a/man/systemd.preset.xml
|
||||
+++ b/man/systemd.preset.xml
|
||||
@@ -98,6 +98,10 @@
|
||||
Empty lines and lines whose first non-whitespace character is # or
|
||||
; are ignored.</para>
|
||||
|
||||
+ <para>Presets must refer to the "real" unit file, and not to any aliases. See
|
||||
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
||||
+ for a description of unit aliasing.</para>
|
||||
+
|
||||
<para>Two different directives are understood:
|
||||
<literal>enable</literal> may be used to enable units by default,
|
||||
<literal>disable</literal> to disable units by default.</para>
|
||||
diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
|
||||
index 85a7b12d76..f818e772a9 100644
|
||||
--- a/man/systemd.unit.xml
|
||||
+++ b/man/systemd.unit.xml
|
||||
@@ -144,21 +144,31 @@
|
||||
<option>false</option> and <option>off</option> are
|
||||
equivalent.</para>
|
||||
|
||||
- <para>Time span values encoded in unit files can be written in
|
||||
- various formats. A stand-alone number specifies a time in seconds.
|
||||
- If suffixed with a time unit, the unit is honored. A concatenation
|
||||
- of multiple values with units is supported, in which case the
|
||||
- values are added up. Example: "50" refers to 50 seconds; "2min
|
||||
- 200ms" refers to 2 minutes plus 200 milliseconds, i.e. 120200ms.
|
||||
- The following time units are understood: s, min, h, d, w, ms, us.
|
||||
- For details see
|
||||
+ <para>Time span values encoded in unit files can be written in various formats. A stand-alone number specifies a
|
||||
+ time in seconds. If suffixed with a time unit, the unit is honored. A concatenation of multiple values with units
|
||||
+ is supported, in which case the values are added up. Example: <literal>50</literal> refers to 50 seconds;
|
||||
+ <literal>2min 200ms</literal> refers to 2 minutes and 200 milliseconds, i.e. 120200 ms. The following time units
|
||||
+ are understood: <literal>s</literal>, <literal>min</literal>, <literal>h</literal>, <literal>d</literal>,
|
||||
+ <literal>w</literal>, <literal>ms</literal>, <literal>us</literal>. For details see
|
||||
<citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>.</para>
|
||||
|
||||
- <para>Empty lines and lines starting with # or ; are
|
||||
- ignored. This may be used for commenting. Lines ending
|
||||
- in a backslash are concatenated with the following
|
||||
- line while reading and the backslash is replaced by a
|
||||
- space character. This may be used to wrap long lines.</para>
|
||||
+ <para>Empty lines and lines starting with <literal>#</literal> or <literal>;</literal> are ignored. This may be
|
||||
+ used for commenting. Lines ending in a backslash are concatenated with the following line while reading and the
|
||||
+ backslash is replaced by a space character. This may be used to wrap long lines.</para>
|
||||
+
|
||||
+ <para>Units can be aliased (have an alternative name), by creating a symlink from the new name to the existing name
|
||||
+ in one of the unit search paths. For example, <filename>systemd-networkd.service</filename> has the alias
|
||||
+ <filename>dbus-org.freedesktop.network1.service</filename>, created during installation as the symlink
|
||||
+ <filename>/usr/lib/systemd/system/dbus-org.freedesktop.network1.service</filename>. In addition, unit files may
|
||||
+ specify aliases through the <varname>Alias=</varname> directive in the [Install] section; those aliases are only
|
||||
+ effective when the unit is enabled. When the unit is enabled, symlinks will be created for those names, and removed
|
||||
+ when the unit is disabled. For example, <filename>reboot.target</filename> specifies
|
||||
+ <varname>Alias=ctrl-alt-del.target</varname>, so when enabled it will be invoked whenever CTRL+ALT+DEL is
|
||||
+ pressed. Alias names may be used in commands like <command>enable</command>, <command>disable</command>,
|
||||
+ <command>start</command>, <command>stop</command>, <command>status</command>, …, and in unit dependency directives
|
||||
+ <varname>Wants=</varname>, <varname>Requires=</varname>, <varname>Before=</varname>, <varname>After=</varname>, …,
|
||||
+ with the limitation that aliases specified through <varname>Alias=</varname> are only effective when the unit is
|
||||
+ enabled. Aliases cannot be used with the <command>preset</command> command.</para>
|
||||
|
||||
<para>Along with a unit file <filename>foo.service</filename>, the
|
||||
directory <filename>foo.service.wants/</filename> may exist. All
|
||||
--
|
||||
2.9.0
|
||||
|
147
0010-shared-install-move-root-skipping-into-create_symlin.patch
Normal file
147
0010-shared-install-move-root-skipping-into-create_symlin.patch
Normal file
@ -0,0 +1,147 @@
|
||||
From f0d72d47f05bbbb851d9ab64df877a3f0e769b4e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 13 Aug 2016 01:21:57 -0400
|
||||
Subject: [PATCH] shared/install: move root skipping into create_symlink()
|
||||
|
||||
No functional change intended.
|
||||
|
||||
(cherry picked from commit 60bec8e4031367869520280350fa1523625d682b)
|
||||
---
|
||||
src/shared/install.c | 33 +++++++++++++--------------------
|
||||
1 file changed, 13 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index ef5a56391c..8c45725f5a 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -394,6 +394,7 @@ void unit_file_dump_changes(int r, const char *verb, const UnitFileChange *chang
|
||||
}
|
||||
|
||||
static int create_symlink(
|
||||
+ const LookupPaths *paths,
|
||||
const char *old_path,
|
||||
const char *new_path,
|
||||
bool force,
|
||||
@@ -401,11 +402,16 @@ static int create_symlink(
|
||||
unsigned *n_changes) {
|
||||
|
||||
_cleanup_free_ char *dest = NULL;
|
||||
+ const char *rp;
|
||||
int r;
|
||||
|
||||
assert(old_path);
|
||||
assert(new_path);
|
||||
|
||||
+ rp = skip_root(paths, old_path);
|
||||
+ if (rp)
|
||||
+ old_path = rp;
|
||||
+
|
||||
/* Actually create a symlink, and remember that we did. Is
|
||||
* smart enough to check if there's already a valid symlink in
|
||||
* place.
|
||||
@@ -1486,7 +1492,6 @@ static int install_info_symlink_alias(
|
||||
|
||||
STRV_FOREACH(s, i->aliases) {
|
||||
_cleanup_free_ char *alias_path = NULL, *dst = NULL;
|
||||
- const char *rp;
|
||||
|
||||
q = install_full_printf(i, *s, &dst);
|
||||
if (q < 0)
|
||||
@@ -1496,9 +1501,7 @@ static int install_info_symlink_alias(
|
||||
if (!alias_path)
|
||||
return -ENOMEM;
|
||||
|
||||
- rp = skip_root(paths, i->path);
|
||||
-
|
||||
- q = create_symlink(rp ?: i->path, alias_path, force, changes, n_changes);
|
||||
+ q = create_symlink(paths, i->path, alias_path, force, changes, n_changes);
|
||||
if (r == 0)
|
||||
r = q;
|
||||
}
|
||||
@@ -1542,7 +1545,6 @@ static int install_info_symlink_wants(
|
||||
|
||||
STRV_FOREACH(s, list) {
|
||||
_cleanup_free_ char *path = NULL, *dst = NULL;
|
||||
- const char *rp;
|
||||
|
||||
q = install_full_printf(i, *s, &dst);
|
||||
if (q < 0)
|
||||
@@ -1557,9 +1559,7 @@ static int install_info_symlink_wants(
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
- rp = skip_root(paths, i->path);
|
||||
-
|
||||
- q = create_symlink(rp ?: i->path, path, true, changes, n_changes);
|
||||
+ q = create_symlink(paths, i->path, path, true, changes, n_changes);
|
||||
if (r == 0)
|
||||
r = q;
|
||||
}
|
||||
@@ -1576,7 +1576,6 @@ static int install_info_symlink_link(
|
||||
unsigned *n_changes) {
|
||||
|
||||
_cleanup_free_ char *path = NULL;
|
||||
- const char *rp;
|
||||
int r;
|
||||
|
||||
assert(i);
|
||||
@@ -1594,9 +1593,7 @@ static int install_info_symlink_link(
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
- rp = skip_root(paths, i->path);
|
||||
-
|
||||
- return create_symlink(rp ?: i->path, path, force, changes, n_changes);
|
||||
+ return create_symlink(paths, i->path, path, force, changes, n_changes);
|
||||
}
|
||||
|
||||
static int install_info_apply(
|
||||
@@ -1772,7 +1769,7 @@ int unit_file_mask(
|
||||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
- q = create_symlink("/dev/null", path, force, changes, n_changes);
|
||||
+ q = create_symlink(&paths, "/dev/null", path, force, changes, n_changes);
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
}
|
||||
@@ -1932,14 +1929,12 @@ int unit_file_link(
|
||||
r = 0;
|
||||
STRV_FOREACH(i, todo) {
|
||||
_cleanup_free_ char *new_path = NULL;
|
||||
- const char *old_path;
|
||||
|
||||
- old_path = skip_root(&paths, *i);
|
||||
new_path = path_make_absolute(basename(*i), config_path);
|
||||
if (!new_path)
|
||||
return -ENOMEM;
|
||||
|
||||
- q = create_symlink(old_path ?: *i, new_path, force, changes, n_changes);
|
||||
+ q = create_symlink(&paths, *i, new_path, force, changes, n_changes);
|
||||
if (q < 0 && r >= 0)
|
||||
r = q;
|
||||
}
|
||||
@@ -2318,7 +2313,7 @@ int unit_file_set_default(
|
||||
_cleanup_lookup_paths_free_ LookupPaths paths = {};
|
||||
_cleanup_(install_context_done) InstallContext c = {};
|
||||
UnitFileInstallInfo *i;
|
||||
- const char *new_path, *old_path;
|
||||
+ const char *new_path;
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -2341,10 +2336,8 @@ int unit_file_set_default(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- old_path = skip_root(&paths, i->path);
|
||||
new_path = strjoina(paths.persistent_config, "/" SPECIAL_DEFAULT_TARGET);
|
||||
-
|
||||
- return create_symlink(old_path ?: i->path, new_path, force, changes, n_changes);
|
||||
+ return create_symlink(&paths, i->path, new_path, force, changes, n_changes);
|
||||
}
|
||||
|
||||
int unit_file_get_default(
|
||||
--
|
||||
2.9.0
|
||||
|
100
0011-shared-install-when-creating-symlinks-keep-existing-.patch
Normal file
100
0011-shared-install-when-creating-symlinks-keep-existing-.patch
Normal file
@ -0,0 +1,100 @@
|
||||
From bfcaa19428a32234356fde460ef556c23bf80f4a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sat, 13 Aug 2016 01:27:21 -0400
|
||||
Subject: [PATCH] shared/install: when creating symlinks, keep existing
|
||||
relative symlinks
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Running preset-all on a system installed from rpms or even created
|
||||
using make install would remove and recreate a lot of symlinks, changing
|
||||
relative to absolute symlinks. In general relative symlinks are nicer,
|
||||
so there is no reason to change them, and those spurious changes were
|
||||
obscuring more interesting stuff.
|
||||
|
||||
$ make install DESTDIR=/var/tmp/inst1
|
||||
|
||||
$ systemctl preset-all --root=/var/tmp/inst1
|
||||
(before)
|
||||
Removed /var/tmp/inst1/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/ctrl-alt-del.target → /usr/lib/systemd/system/exit.target.
|
||||
Removed /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/remote-fs.target.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/remote-fs.target → /usr/lib/systemd/system/remote-fs.target.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/machines.target → /usr/lib/systemd/system/machines.target.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/sockets.target.wants/systemd-journal-remote.socket → /usr/lib/systemd/system/systemd-journal-remote.socket.
|
||||
Removed /var/tmp/inst1/etc/systemd/system/sockets.target.wants/systemd-networkd.socket.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/sockets.target.wants/systemd-networkd.socket → /usr/lib/systemd/system/systemd-networkd.socket.
|
||||
Removed /var/tmp/inst1/etc/systemd/system/getty.target.wants/getty@tty1.service.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/getty.target.wants/getty@tty1.service → /usr/lib/systemd/system/getty@.service.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-journal-upload.service → /usr/lib/systemd/system/systemd-journal-upload.service.
|
||||
Removed /var/tmp/inst1/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service → /usr/lib/systemd/system/systemd-timesyncd.service.
|
||||
Removed /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-resolved.service.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-resolved.service → /usr/lib/systemd/system/systemd-resolved.service.
|
||||
Removed /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-networkd.service.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-networkd.service → /usr/lib/systemd/system/systemd-networkd.service.
|
||||
|
||||
(after)
|
||||
Removed /var/tmp/inst1/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/ctrl-alt-del.target → /usr/lib/systemd/system/exit.target.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/machines.target → /usr/lib/systemd/system/machines.target.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/sockets.target.wants/systemd-journal-remote.socket → /usr/lib/systemd/system/systemd-journal-remote.socket.
|
||||
Created symlink /var/tmp/inst1/etc/systemd/system/multi-user.target.wants/systemd-journal-upload.service → /usr/lib/systemd/system/systemd-journal-upload.service.
|
||||
|
||||
(cherry picked from commit 25ea92778d5f4339e07c152a99d16223f43ad681)
|
||||
---
|
||||
src/shared/install.c | 23 +++++++++++++++++++++--
|
||||
1 file changed, 21 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 8c45725f5a..9ce8e4d390 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -393,6 +393,21 @@ void unit_file_dump_changes(int r, const char *verb, const UnitFileChange *chang
|
||||
log_error_errno(r, "Failed to %s: %m.", verb);
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * Checks if two paths or symlinks from wd are the same, when root is the root of the filesystem.
|
||||
+ * wc should be the full path in the host file system.
|
||||
+ */
|
||||
+static bool chroot_symlinks_same(const char *root, const char *wd, const char *a, const char *b) {
|
||||
+ assert(path_is_absolute(wd));
|
||||
+
|
||||
+ /* This will give incorrect results if the paths are relative and go outside
|
||||
+ * of the chroot. False negatives are possible. */
|
||||
+
|
||||
+ a = strjoina(path_is_absolute(a) ? root : wd, "/", a);
|
||||
+ b = strjoina(path_is_absolute(b) ? root : wd, "/", b);
|
||||
+ return path_equal_or_files_same(a, b);
|
||||
+}
|
||||
+
|
||||
static int create_symlink(
|
||||
const LookupPaths *paths,
|
||||
const char *old_path,
|
||||
@@ -401,7 +416,7 @@ static int create_symlink(
|
||||
UnitFileChange **changes,
|
||||
unsigned *n_changes) {
|
||||
|
||||
- _cleanup_free_ char *dest = NULL;
|
||||
+ _cleanup_free_ char *dest = NULL, *dirname = NULL;
|
||||
const char *rp;
|
||||
int r;
|
||||
|
||||
@@ -442,7 +457,11 @@ static int create_symlink(
|
||||
return r;
|
||||
}
|
||||
|
||||
- if (path_equal(dest, old_path))
|
||||
+ dirname = dirname_malloc(new_path);
|
||||
+ if (!dirname)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ if (chroot_symlinks_same(paths->root_dir, dirname, dest, old_path))
|
||||
return 1;
|
||||
|
||||
if (!force) {
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,78 @@
|
||||
From 3f5a187dcf8ad2f0690046876d30d37630c11014 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Wed, 17 Aug 2016 22:15:54 -0400
|
||||
Subject: [PATCH] shared/install: properly report masked units listed in Also=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
A masked unit is listed in Also=:
|
||||
|
||||
$ systemctl cat test1 test2
|
||||
→# /etc/systemd/system/test1.service
|
||||
[Unit]
|
||||
Description=test service 1
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Also=test2.service
|
||||
Alias=alias1.service
|
||||
|
||||
→# /dev/null
|
||||
|
||||
$ systemctl --root=/ enable test1
|
||||
(before)
|
||||
Created symlink /etc/systemd/system/alias1.service → /etc/systemd/system/test1.service.
|
||||
Created symlink /etc/systemd/system/multi-user.target.wants/test1.service → /etc/systemd/system/test1.service.
|
||||
The unit files have no installation config (WantedBy, RequiredBy, Also, Alias
|
||||
settings in the [Install] section, and DefaultInstance for template units).
|
||||
This means they are not meant to be enabled using systemctl.
|
||||
Possible reasons for having this kind of units are:
|
||||
1) A unit may be statically enabled by being symlinked from another unit's
|
||||
.wants/ or .requires/ directory.
|
||||
2) A unit's purpose may be to act as a helper for some other unit which has
|
||||
a requirement dependency on it.
|
||||
3) A unit may be started when needed via activation (socket, path, timer,
|
||||
D-Bus, udev, scripted systemctl call, ...).
|
||||
4) In case of template units, the unit is meant to be enabled with some
|
||||
instance name specified.
|
||||
|
||||
(after)
|
||||
Created symlink /etc/systemd/system/alias1.service → /etc/systemd/system/test1.service.
|
||||
Created symlink /etc/systemd/system/multi-user.target.wants/test1.service → /etc/systemd/system/test1.service.
|
||||
Unit /etc/systemd/system/test2.service is masked, ignoring.
|
||||
|
||||
(cherry picked from commit f16517151310b88591f3501a59e23ae2a79e7f02)
|
||||
---
|
||||
src/shared/install.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 9ce8e4d390..9d9f4dff4f 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -1686,6 +1686,17 @@ static int install_context_apply(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+ /* We can attempt to process a masked unit when a different unit
|
||||
+ * that we were processing specifies it in DefaultInstance= or Also=. */
|
||||
+ if (i->type == UNIT_FILE_TYPE_MASKED) {
|
||||
+ unit_file_changes_add(changes, n_changes, UNIT_FILE_IS_MASKED, i->path, NULL);
|
||||
+ if (r >= 0)
|
||||
+ /* Assume that some *could* have been enabled here, avoid
|
||||
+ * "empty [Install] section" warning. */
|
||||
+ r += 1;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
if (i->type != UNIT_FILE_TYPE_REGULAR)
|
||||
continue;
|
||||
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,48 @@
|
||||
From e59e123d9c0692b6104deea954e1a2db172e22e1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Thu, 18 Aug 2016 21:39:39 -0400
|
||||
Subject: [PATCH] Revert "pid1: reconnect to the console before being
|
||||
re-executed"
|
||||
|
||||
This reverts commit affd7ed1a923b0df8479cff1bd9eafb625fdaa66.
|
||||
|
||||
> So it looks like make_console_stdio() has bad side effect. More specifically it
|
||||
> does a TIOCSCTTY ioctl (via acquire_terminal()) which sees to disturb the
|
||||
> process which was using/owning the console.
|
||||
|
||||
Fixes #3842.
|
||||
https://bugs.debian.org/834367
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1367766
|
||||
|
||||
(cherry picked from commit bd64d82c1c0e3fe2a5f9b3dd9132d62834f50b2d)
|
||||
---
|
||||
src/core/main.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/core/main.c b/src/core/main.c
|
||||
index f2adca7d2b..f59a55f166 100644
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -2016,9 +2016,6 @@ finish:
|
||||
log_error_errno(r, "Failed to switch root, trying to continue: %m");
|
||||
}
|
||||
|
||||
- /* Reopen the console */
|
||||
- (void) make_console_stdio();
|
||||
-
|
||||
args_size = MAX(6, argc+1);
|
||||
args = newa(const char*, args_size);
|
||||
|
||||
@@ -2066,6 +2063,9 @@ finish:
|
||||
arg_serialization = safe_fclose(arg_serialization);
|
||||
fds = fdset_free(fds);
|
||||
|
||||
+ /* Reopen the console */
|
||||
+ (void) make_console_stdio();
|
||||
+
|
||||
for (j = 1, i = 1; j < (unsigned) argc; j++)
|
||||
args[i++] = argv[j];
|
||||
args[i++] = NULL;
|
||||
--
|
||||
2.9.0
|
||||
|
@ -0,0 +1,65 @@
|
||||
From 0da0a63dba426aa351d733292df6ec41603b39b6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Thu, 18 Aug 2016 22:03:56 -0400
|
||||
Subject: [PATCH] systemd: ignore lack of tty when checking whether colors
|
||||
should be enabled
|
||||
|
||||
When started by the kernel, we are connected to the console, and we'll set TERM
|
||||
properly to some value in fixup_environment(). We'll then enable or disable
|
||||
colors based on the value of $SYSTEMD_COLORS and $TERM.
|
||||
|
||||
When reexecuting, TERM should be already set, so we can use this value.
|
||||
Effectively, behaviour is the same as before affd7ed1a was reverted, but instead
|
||||
of reopening the console before configuring color output, we just ignore what
|
||||
stdout is connected to and decide based on the variables only.
|
||||
|
||||
(cherry picked from commit 158fbf7661912adf0f42c93155499119811dde82)
|
||||
---
|
||||
src/basic/terminal-util.c | 15 +++++++++++----
|
||||
1 file changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/basic/terminal-util.c b/src/basic/terminal-util.c
|
||||
index df56d85317..47d31ad4d7 100644
|
||||
--- a/src/basic/terminal-util.c
|
||||
+++ b/src/basic/terminal-util.c
|
||||
@@ -1191,12 +1191,9 @@ int open_terminal_in_namespace(pid_t pid, const char *name, int mode) {
|
||||
return receive_one_fd(pair[0], 0);
|
||||
}
|
||||
|
||||
-bool terminal_is_dumb(void) {
|
||||
+static bool getenv_terminal_is_dumb(void) {
|
||||
const char *e;
|
||||
|
||||
- if (!on_tty())
|
||||
- return true;
|
||||
-
|
||||
e = getenv("TERM");
|
||||
if (!e)
|
||||
return true;
|
||||
@@ -1204,6 +1201,13 @@ bool terminal_is_dumb(void) {
|
||||
return streq(e, "dumb");
|
||||
}
|
||||
|
||||
+bool terminal_is_dumb(void) {
|
||||
+ if (!on_tty())
|
||||
+ return true;
|
||||
+
|
||||
+ return getenv_terminal_is_dumb();
|
||||
+}
|
||||
+
|
||||
bool colors_enabled(void) {
|
||||
static int enabled = -1;
|
||||
|
||||
@@ -1213,6 +1217,9 @@ bool colors_enabled(void) {
|
||||
colors = getenv("SYSTEMD_COLORS");
|
||||
if (colors)
|
||||
enabled = parse_boolean(colors) != 0;
|
||||
+ else if (getpid() == 1)
|
||||
+ /* PID1 outputs to the console without holding it open all the time */
|
||||
+ enabled = !getenv_terminal_is_dumb();
|
||||
else
|
||||
enabled = !terminal_is_dumb();
|
||||
}
|
||||
--
|
||||
2.9.0
|
||||
|
130
0015-shared-install-do-not-enable-masked-instances-4005.patch
Normal file
130
0015-shared-install-do-not-enable-masked-instances-4005.patch
Normal file
@ -0,0 +1,130 @@
|
||||
From 3cb3b0145ed8439eb604b43596e6456ed3292c46 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Sun, 21 Aug 2016 09:10:51 -0400
|
||||
Subject: [PATCH] shared/install: do not enable masked instances (#4005)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When told to enable a template unit, and the DefaultInstance specified in that
|
||||
unit was masked, we would do this. Such a unit cannot be started or loaded, so
|
||||
reporting successful enabling is misleading and unexpected.
|
||||
|
||||
$ systemctl mask getty@tty1
|
||||
Created symlink /etc/systemd/system/getty@tty1.service → /dev/null.
|
||||
$ systemctl --root=/ enable getty@tty1
|
||||
(unchanged)
|
||||
Failed to enable unit, unit /etc/systemd/system/getty@tty1.service is masked.
|
||||
|
||||
$ systemctl --root=/ enable getty@
|
||||
(before)
|
||||
Created symlink /etc/systemd/system/getty.target.wants/getty@tty1.service → /usr/lib/systemd/system/getty@.service.
|
||||
(now)
|
||||
Failed to enable unit, unit /etc/systemd/system/getty@tty1.service is masked.
|
||||
|
||||
The same error is emitted for enable and preset. And an error is emmited, not a
|
||||
warning, so the failure to enable DefaultInstance is treated the same as if the
|
||||
instance was specified on the command line. I think that this makes most sense,
|
||||
for most template units.
|
||||
|
||||
Fixes #2513.
|
||||
(cherry picked from commit 047d91f9c8cf1bcf5a30f428668babd619533944)
|
||||
---
|
||||
src/shared/install.c | 35 ++++++++++++++++++++++++++++-------
|
||||
1 file changed, 28 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/shared/install.c b/src/shared/install.c
|
||||
index 9d9f4dff4f..cb2a2e7e0d 100644
|
||||
--- a/src/shared/install.c
|
||||
+++ b/src/shared/install.c
|
||||
@@ -912,8 +912,8 @@ static int install_info_may_process(
|
||||
assert(i);
|
||||
assert(paths);
|
||||
|
||||
- /* Checks whether the loaded unit file is one we should process, or is masked, transient or generated and thus
|
||||
- * not subject to enable/disable operations. */
|
||||
+ /* Checks whether the loaded unit file is one we should process, or is masked,
|
||||
+ * transient or generated and thus not subject to enable/disable operations. */
|
||||
|
||||
if (i->type == UNIT_FILE_TYPE_MASKED) {
|
||||
unit_file_changes_add(changes, n_changes, -ERFKILL, i->path, NULL);
|
||||
@@ -1134,7 +1134,6 @@ static int unit_file_load(
|
||||
struct stat st;
|
||||
int r;
|
||||
|
||||
- assert(c);
|
||||
assert(info);
|
||||
assert(path);
|
||||
|
||||
@@ -1163,6 +1162,9 @@ static int unit_file_load(
|
||||
return 0;
|
||||
}
|
||||
|
||||
+ /* c is only needed if we actually load the file */
|
||||
+ assert(c);
|
||||
+
|
||||
fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
@@ -1275,7 +1277,6 @@ static int unit_file_search(
|
||||
char **p;
|
||||
int r;
|
||||
|
||||
- assert(c);
|
||||
assert(info);
|
||||
assert(paths);
|
||||
|
||||
@@ -1546,7 +1547,14 @@ static int install_info_symlink_wants(
|
||||
assert(paths);
|
||||
assert(config_path);
|
||||
|
||||
+ if (strv_isempty(list))
|
||||
+ return 0;
|
||||
+
|
||||
if (unit_name_is_valid(i->name, UNIT_NAME_TEMPLATE)) {
|
||||
+ UnitFileInstallInfo instance = {
|
||||
+ .type = _UNIT_FILE_TYPE_INVALID,
|
||||
+ };
|
||||
+ _cleanup_free_ char *path = NULL;
|
||||
|
||||
/* Don't install any symlink if there's no default
|
||||
* instance configured */
|
||||
@@ -1558,6 +1566,19 @@ static int install_info_symlink_wants(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+ instance.name = buf;
|
||||
+ r = unit_file_search(NULL, &instance, paths, SEARCH_FOLLOW_CONFIG_SYMLINKS);
|
||||
+ if (r < 0)
|
||||
+ return r;
|
||||
+
|
||||
+ path = instance.path;
|
||||
+ instance.path = NULL;
|
||||
+
|
||||
+ if (instance.type == UNIT_FILE_TYPE_MASKED) {
|
||||
+ unit_file_changes_add(changes, n_changes, -ERFKILL, path, NULL);
|
||||
+ return -ERFKILL;
|
||||
+ }
|
||||
+
|
||||
n = buf;
|
||||
} else
|
||||
n = i->name;
|
||||
@@ -1687,12 +1708,12 @@ static int install_context_apply(
|
||||
return r;
|
||||
|
||||
/* We can attempt to process a masked unit when a different unit
|
||||
- * that we were processing specifies it in DefaultInstance= or Also=. */
|
||||
+ * that we were processing specifies it in Also=. */
|
||||
if (i->type == UNIT_FILE_TYPE_MASKED) {
|
||||
unit_file_changes_add(changes, n_changes, UNIT_FILE_IS_MASKED, i->path, NULL);
|
||||
if (r >= 0)
|
||||
- /* Assume that some *could* have been enabled here, avoid
|
||||
- * "empty [Install] section" warning. */
|
||||
+ /* Assume that something *could* have been enabled here,
|
||||
+ * avoid "empty [Install] section" warning. */
|
||||
r += 1;
|
||||
continue;
|
||||
}
|
||||
--
|
||||
2.9.0
|
||||
|
23
systemd.spec
23
systemd.spec
@ -12,7 +12,7 @@
|
||||
Name: systemd
|
||||
Url: http://www.freedesktop.org/wiki/Software/systemd
|
||||
Version: 231
|
||||
Release: 3%{?gitcommit:.git%{gitcommitshort}}%{?dist}
|
||||
Release: 4%{?gitcommit:.git%{gitcommitshort}}%{?dist}
|
||||
# For a breakdown of the licensing, see README
|
||||
License: LGPLv2+ and MIT and GPLv2+
|
||||
Summary: A System and Service Manager
|
||||
@ -36,6 +36,22 @@ Source7: systemd-journal-remote.xml
|
||||
Source8: systemd-journal-gatewayd.xml
|
||||
Source9: 20-yama-ptrace.conf
|
||||
|
||||
Patch0001: 0001-systemctl-be-sure-to-be-quiet-with-systemctl-is-enab.patch
|
||||
Patch0002: 0002-logind-0-and-100-should-be-valid-for-UserTasksMax-38.patch
|
||||
Patch0003: 0003-systemd-ask-password-make-sure-directory-watch-is-st.patch
|
||||
Patch0004: 0004-Revert-logind-really-handle-KeyIgnoreInhibited-optio.patch
|
||||
Patch0005: 0005-man-explain-that-KeyIgnoreInhibited-only-apply-to-a-.patch
|
||||
Patch0006: 0006-systemctl-fix-preset-all-with-missing-etc-systemd-sy.patch
|
||||
Patch0007: 0007-shared-install-remove-unused-paramater-and-add-more-.patch
|
||||
Patch0008: 0008-shared-install-ignore-unit-symlinks-when-doing-prese.patch
|
||||
Patch0009: 0009-man-describe-what-symlinks-to-unit-do-and-specify-th.patch
|
||||
Patch0010: 0010-shared-install-move-root-skipping-into-create_symlin.patch
|
||||
Patch0011: 0011-shared-install-when-creating-symlinks-keep-existing-.patch
|
||||
Patch0012: 0012-shared-install-properly-report-masked-units-listed-i.patch
|
||||
Patch0013: 0013-Revert-pid1-reconnect-to-the-console-before-being-re.patch
|
||||
Patch0014: 0014-systemd-ignore-lack-of-tty-when-checking-whether-col.patch
|
||||
Patch0015: 0015-shared-install-do-not-enable-masked-instances-4005.patch
|
||||
|
||||
Patch0998: 0998-resolved-create-etc-resolv.conf-symlink-at-runtime.patch
|
||||
|
||||
# kernel-install patch for grubby, drop if grubby is obsolete
|
||||
@ -927,6 +943,11 @@ getent passwd systemd-journal-upload >/dev/null 2>&1 || useradd -r -l -g systemd
|
||||
%{_mandir}/man[1578]/systemd-nspawn.*
|
||||
|
||||
%changelog
|
||||
* Thu Aug 25 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 231-4
|
||||
- Fix preset-all (#1363858)
|
||||
- Fix issue with daemon-reload messing up graphics (#1367766)
|
||||
- A few other bugfixes
|
||||
|
||||
* Wed Aug 03 2016 Adam Williamson <awilliam@redhat.com> - 231-3
|
||||
- Revert preset-all change, it broke stuff (#1363858)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user