IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Use a non-blocking syslog socket if logging from PID 1.
If sendmsg fails with EAGAIN, fall back to kmsg or console only for the
current message. Next message will try syslog again.
Chen Jie observed and analyzed a deadlock. Assuming systemd-kmsg-syslogd
is already stopped, but rsyslogd is not started yet:
1. systemd makes a synchronous call to dbus-daemon.
2. dbus-daemon wants to write something to syslog.
3. syslog needs to be started by systemd.
... but cannot be, because systemd is waiting in 1.
Solve this by avoiding synchronous D-Bus calls. I had to write an async
bus registration call. Interestingly, D-Bus authors anticipated this, in
documentation to dbus_bus_set_unique_name():
> The only reason to use this function is to re-implement the equivalent
> of dbus_bus_register() yourself. One (probably unusual) reason to do
> that might be to do the bus registration call asynchronously instead
> of synchronously.
Lennart's comments from IRC:
> though I think this doesn't fix the problem in its entirety
> simply because dbus_connection_open_private() itself is still synchronous
> i.e. the connect() call behind it is not async
> I think I listed that issue actually on some D-Bus todo list
> i.e. to make dbus_connection_get() fully async
> but that's going to be hard
> so your patch looks good
So it may not be perfect, but it's clearly an improvement.
I did not manage to reproduce the original deadlock with the patch.
A freshly started unit A was immediately considered unneeded just because
unit B, which Requires A, was starting later in the transaction.
Fix it by looking not only at the state of B, but also at its pending job.
Also fix a copied&pasted comment.
Be consistent in coloring of load states in list-units and status.
Print only 'error' in red.
There are no 'banned' or 'failed' states. Do not color 'masked', it's
not an error.
Units that failed to load were never cleaned up. It was possible to
reach the 128K limit of units by attempting to load a bunch of nonsense.
Bug observed by Reartes Guillermo in
https://bugzilla.redhat.com/show_bug.cgi?id=680122
To do so, move the check for the bus to the bus-using portion of
list_unit_files(), and ensure that get_config_path doesn't abort when
checking the runtime path with --root.
The handling of failures in ExecStartPost is inconsistent. If the
command times out, the service is stopped. But if the command exits
with a failure, the service keeps running.
It makes more sense to stop the service when ExecStartPost fails.
If this behaviour is not desired, the ExecStartPost command can be
prefixed with "-".
There are a lot of forking daemons that do not exactly follow the
initialization steps as described in daemon(7). It is common that they
do not bother waiting in the parent process for the child to write the
PID file before exiting. The daemons' developers often do not perceive
this as a bug and they're unwilling to change.
Currently systemd warns about the missing PID file and falls back to
guessing the main PID. Being not quite deterministic, the guess can be
wrong with bad consequences. If the guessing is disabled, determinism is
achieved at the cost of losing the ability of noticing when the main
process of the service dies.
As long as it does not negatively affect properly written services,
systemd should strive for compatibility even with services with racy
daemonization. It is possible to provide determinism _and_ main process
supervision to them.
If the PID file is not there, rather than guessing and considering the
service running immediately after getting the SIGCHLD from the ExecStart
(or ExecStartPost) process, we can keep the service in the activating
state for a bit longer. We can use inotify to wait for the PID file to
appear. Only when it finally does appear and we read a valid PID from
it, we'll move the service to the running state. If the PID file never
appears, the usual timeout kicks in and the service fails.
path_*() functions operate on "Path *p" and they do not touch PathSpec
internals directly.
pathspec_*() functions operate on "PathSpec *s". The PathSpec class will
be useful outside of path.c.
rc-local.service acts as an ordering barrier even if its condition is
false, because conditions are evaluated when the service is about to be
started.
To avoid the ordering barrier in a legacy-free system, add a generator
to pull rc-local.service into the transaction only if the script is
executable.
If/when we rewrite SysV compatibility into a generator, this one can become
a part of it.
Both kmsg-syslogd and the real syslog service want to receive
SCM_CREDENTIALS. With socket activation it is too late to set
SO_PASSCRED in the services.
Since Linux 3.2 in order to receive SCM_CREDENTIALS it is not sufficient
to set SO_PASSCRED just before recvmsg(). The option has to be already
set when the sender sends the message.
With socket activation it is too late to set the option in the service.
It must be set on the socket right from the start.
See the kernel commit:
16e57262 af_unix: dont send SCM_CREDENTIALS by default
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=757628
To give the administrator more hints about failures occuring in spawning
of commands than just the exit code, log the strerror.
All fds are closed, so reopen the log.
Related-to: https://bugzilla.redhat.com/show_bug.cgi?id=752901
Several functions called from the "sd(EXEC)" process try to log messages
when all the file descriptors are already closed, including the logging
ones. The logging functions do not expect their fds to be closed and
they hit an assertion failure. The failure wants to be logged too,
so there is an infinite recursion, ended by a SIGSEGV.
When we close all fds, we must let log.c know about it.
The code should probably look like the statements above it.
Please verify, I just detected it using cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
A service that drops its privileges may not be able to remove it when it
exits. The stale pidfile is not a problem as long as the service
carefully recognizes it on its next start.
systemd would produce a warning after the service exits:
PID ... read from file ... does not exist. Your service or init
script might be broken.
Silence the warning in this case. Still warn if this error is detected
when loading the pidfile after service start.
Noticed by Miroslav Lichvar in
https://bugzilla.redhat.com/show_bug.cgi?id=752396
Zeroed .ut_tv values in wtmp confuse chkrootkit.
Reported and debugged by Norman Smith. This is based on his patch,
but modified to behave more like upstart did in F14 and cleaned up.
https://bugzilla.redhat.com/show_bug.cgi?id=743696
Some controllers have scaling problems when many empty cgroups exist.
Hence, as soon as we get a notification that a cgroup is empty, delete
it. This is also nice to keep the systemd-cgls output short.
Adds arguments --root= --runtime --no-legend.
Adds verbs link mask unmask reenable list-unit-files.
Also uses list-unit-files to make nicer enable and disable completions.
Rebased due to changes in systemctl.
This patch adds support for the Mageia Linux distribution:
http://www.mageia.org/
Mageia is a fork of Mandriva although some divergence has already occured
and thus inclusion of these changes upstream allow us to (hopefully)
migrate more rapidly to the new standard approaches systemd offers.
Indeed, we already use the preferred mechanism of OS identification via
the /etc/os-release file rather than a distro specific variation.
This patch mostly mirrors the patch added previously for Mandriva
support. In addition to those original authors, this patch was mostly
written by Dexter Morgan with help from Colin Guthrie and Eugeni Dodonov.
Devices with random keys (swap), should not be ordered before local-fs.target,
as this creates a cycle with systemd-load-random-seed.service (and also it
does not make sense, a swap device is not a local-fs).
Since remote-fs-pre.target is optional we cannot count on it to order
remote mounts after network.target, so let's add that order explicitly
in addition to remote-fs-pre.target.
https://bugzilla.redhat.com/show_bug.cgi?id=749940
We might have trimmed the cgroup tree previously, hence don't trust our
own "realized" flag, always recreate cgroup tree before applying our
attributes to make sure this actually works out.
https://bugzilla.redhat.com/show_bug.cgi?id=749687
After reexec PID 1 our bus connection is invalidated. Hence don't try to
reuse it, just terminate so that when we are spawned the next time we
just get a new one.
Spotted by Marti Raudsepp.
The problem was first noted in a bug report against Arch's initscripts.
Reported-by: Taylan Ulrich Bayırlı <taylanbayirli@gmail.com>
Reported-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
The first column is given the width of the widest entry,
if possible, otherwise all entries are ellipsized to fit
in ($COLUMNS - (width of second column)).
[ Added a few fixes, calculate state_cols too, respect '--no-legend',
better handling of '--full' -- michich ]
In the case of completion for the 'restart' verb, passing the invalid
unit name (the colums header) causes completion to cease functioning
entirely, with the error:
Failed to issue method call: Unit name UNIT is not valid.
This adds a small wrapper function for systemctl which can have common
options added to it.
When running on a kernel without audit support, systemd currently
writes a mysterious-sounding error to its log:
systemd[1]: Failed to connect to audit log: Protocol not supported
Better to suppress the audit_open() failure message when (and only
when) it is due to running on a kernel without audit support, since in
this case the admin probably does not mind systemd not writing to the
audit log. This way, more serious errors like ENOMEM and EACCES will
stand out more.
Services which claim to start in both rcN.d and rcS.d generate
loops which for some reason seems to usually end up with dbus not
starting and the whole machine being quite unhappy. We now rather
assume that if a service can be started in rcS, it should not also
start in rcN.d.
Fixes Debian bug #637037
HASHMAP_FOREACH is safe against the removal of the current entry, but
not against the removal of other entries. job_finish_and_invalidate()
can recursively remove other entries.
It triggered an assertion failure:
Assertion 'j->installed' failed at src/manager.c:1218, function
transaction_apply(). Aborting.
Fix the crash by iterating from the beginning when there is a
possibility that the iterator could be invalid.
It is O(n^2) in the worst case, but that's better than a crash.
https://bugzilla.redhat.com/show_bug.cgi?id=717325
As it turns out there are quite a number of SysV services too broken to
make the guessing work: instead of returning in the parent only after
the child is fully initialized they return immediately. The effect is
that the guessing in systemd might happen too early, at a time where the
final main process doesn't exist yet.
By turning this off we won't try to detect the main pid anymore, with
the effect that all processes of the service in question are considered
equally likely to be the main process.
src/pager.c: In function ‘pager_fallback’:
src/pager.c:35:13: warning: function might be possible candidate for attribute ‘noreturn’ [-Wmissing-noreturn]
On some systems the list of units in systemctl output came out wrong,
all on one line and with missing descriptions.
It turns out printf() really attempts to mmap 2G memory when INT_MAX is
passed as the field width. On machines with small virtual memory
without overcommit the mmap inside printf() failed.
Do not use INT_MAX for unlimited width.
KEYMAP are use to pass keymap configuration to initrd, but not to the
system itself. Since the initrd might get out of date we need to make
sure that changes made in userspace override the settings from the
cmdline, hence drpo any use of it all for these variables.
Provide nicer output by taking advantage of the available columns.
Expand UNIT and DESCRIPTION if possible. Economize the space:
- never give UNIT more width than it can use.
- if there's a shortage of space, give 25 columns to UNIT, even
if it would result in overflowing the total columns. The field would not
be useful below width 25.
- then if possible, assign up to 25 columns to DESCRIPTION.
- then split any remaining space evenly between UNIT and DESCRIPTION.
Keep the columns aligned even with '--full'.
Print the legend (the column headers and the footer with hints) by
default even to non-tty output. People seem to get confused by the
difference when they redirect the output.
Add a parameter to suppress the printing of the legend.
Related-to: https://bugzilla.redhat.com/show_bug.cgi?id=713567
In the very unlikely scenario where none of the external pagers is
available, use an internal implementation to pass stdin to stdout.
Don't bother with trying 'cat', because it's no more useful than the
internal pager.
https://bugzilla.redhat.com/show_bug.cgi?id=713707
In situations like this:
root@omap4430-panda:~# systemd-analyze
Startup finished in 1499ms (kernel) + 916ms (userspace) = 2416ms
The svg plot will only have the 0s marker and no subsequent markers for scale. This patch forces the 1s marker to always be drawn.
'man systemd.target' says:
Unless DefaultDependencies= is set to false, target units will
implicitly complement all configured dependencies of type
Wants=, Requires=, RequiresOverridable= with dependencies of type
After= if the units in question also have DefaultDependencies=true.
It did not work because of a forgotten negation.
signal_to_string:
Produce names for SIGRTMIN+n.
Never give an "n/a" result. In the worst case give the number itself as
a string.
signal_from_string:
Parse "RTMIN+n".
Parse any valid signal number.
CONDITION_PATH_IS_DIRECTORY, CONDITION_PATH_IS_SYMBOLIC_LINK and
CONDITION_FILE_IS_EXECUTABLE gave reversed results when the path
did not exist at all.
Warn if a service promises to write a PID file (using 'PIDFile=' in the
unit file or '# pidfile:' in SysV header), but fails to keep the
promise.
This warning will likely trigger also for the forking services with a
racy daemonization, which exit the original process before the PID file
is written.
This is useful for inetd-style per-connection services, so that they
again can simply specify StandardOutput=socket to connect all three fds
to the socket.
Return 0 only if the PID was really loaded. If no PIDFile= is defined,
return -ENOENT.
Only one caller cares about the return value of this function and this
change makes the usage nicer.
When some forking daemons receive a SIGHUP, they re-execute themselves
and consequently change to a new main PID. As long as they update the
PID file in the right order (before exiting the old PID), we can detect
that and avoid killing them.
The logic never worked since reading from the boot console is useless
when a service is started after boot. Hence drop this half-baked code,
since we now have a place document incompatibilities like this.
http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities
Otherwise, access-denied dbus errors were not caught, and only
caused a message to be printed out on the console. After this
change a proper popup window pops up :).
The new WrapLabel is there to work around a deficiency in GTK,
namely the fact that it is hard to make labels which are both
resizable and wrappable. The code is a port from libview.
Since the timezone is always local, it doesn't make much sense to
display it. The timestamp is now formatted without the timezone.
I guess it can be further improved, which should be easier now
that it is tucked-away in a separate function.
If we managed to reeexec the init system via the bus this allows us to
provide synchronous behaviour to callers. This is all lost if we then
repeat the reexecution via SIGTERM.
https://bugzilla.redhat.com/show_bug.cgi?id=698198
/run/initramfs usually contains the initrd so that we can jump back into
it on shutdown. It's usually relatively large and static data, hence we
should avoid relabelling of it. On my netbook this saves 6s. (6.6s
needed for relabelling /dev and /run goes down to 600ms -- still way too
much, but much better).
If a device node is specified, then adjust the bandwidth/weight of it,
otherwise find the backing block device of the file system the path
refers to and adjust its bandwidth/weight.
Hi,
MS_REC is not always defined in sys/mount.h. linux/fs.h should be
included, since it is always defined there.
--
Frederic Crozat <fcrozat@suse.com>
SUSE
>From 9f8a50decf45aaa4436b9fb3a0ab360f238b7d96 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Thu, 18 Aug 2011 15:42:29 +0200
Subject: [PATCH] nspawn: add missing include header for MS_REC.
We send SIGTERM (resp., SIGHUP) when we receive request for changing to
runlevel 'u' (resp., 'q').
As initctl is already async, we just send the signals rather than first
attempting to connect to sytemd over dbus and then falling back to kill.
If we need to retry, we print things like
'Not all file systems unmounted, 1 left'
We should also print something after we succeeded, so we don't leave
the impression we left stuff behind.
This new installer will replace the current code of "systemctl enable"
but also be available via D-Bus. It adds a couple of new features:
- Mask/Unmask calls
- Reenable call
- Preset call
- Support for enabling units temporarily (i.e. in /run/systemd instead
of /etc/systemd)
- Enumeration of installed units
- Support for out-of-search-path units
systemctl and D-Bus are not hooked up with this yet