b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file. |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
6bedfcbb2970e06a4d3280c8fb62083d252ede73 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files. |
b9e74c399458a1146894ce371e7d85c60658110c |
|
29-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
core: rework crash handling
This introduces a new systemd.crash_reboot=1 kernel command line option
that triggers a reboot after crashing.
This also cleans up crash VT handling. Specifically, it cleans up the
configuration setting, to be between 1..63 or a boolean. This is to
replace the previous logic where "-1" meant disabled. We continue to
accept that setting, but only document the boolean syntax instead.
This also brings the documentation of the default settings in sync with
what actually happens.
The CrashChVT= configuration file setting is renamed to CrashChangeVT=,
following our usual logic of not abbreviating unnecessarily. The old
setting stays support for compat reasons.
Fixes #1300 |
287419c119ef961db487a281162ab037eba70c61 |
|
21-Sep-2015 |
Alban Crequy <alban.crequy@gmail.com> |
containers: systemd exits with non-zero code
When a systemd service running in a container exits with a non-zero
code, it can be useful to terminate the container immediately and get
the exit code back to the host, when systemd-nspawn returns. This was
not possible to do. This patch adds the following to make it possible:
- Add a read-only "ExitCode" property on PID 1's "Manager" bus object.
By default, it is 0 so the behaviour stays the same as previously.
- Add a method "SetExitCode" on the same object. The method fails when
called on baremetal: it is only allowed in containers or in user
session.
- Add support in systemctl to call "systemctl exit 42". It reuses the
existing code for user session.
- Add exit.target and systemd-exit.service to the system instance.
- Change main() to actually call systemd-shutdown to exit() with the
correct value.
- Add verb 'exit' in systemd-shutdown with parameter --exit-code
- Update systemctl manpage.
I used the following to test it:
| $ sudo rkt --debug --insecure-skip-verify run \
| --mds-register=false --local docker://busybox \
| --exec=/bin/chroot -- /proc/1/root \
| systemctl --force exit 42
| ...
| Container rkt-895a0cba-5c66-4fa5-831c-e3f8ddc5810d failed with error code 42.
| $ echo $?
| 42
Fixes https://github.com/systemd/systemd/issues/1290 |
76ef789d264f9eb7d7624b994aa6eead1dacfac4 |
|
09-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: make use of log_error_errno() return value
Turns this:
r = -errno;
log_error_errno(errno, "foo");
into this:
r = log_error_errno(errno, "foo");
and this:
r = log_error_errno(errno, "foo");
return r;
into this:
return log_error_errno(errno, "foo"); |
75f86906c52735c98dc0aa7e24b773edb42ee814 |
|
07-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
basic: rework virtualization detection API
Introduce a proper enum, and don't pass around string ids anymore. This
simplifies things quite a bit, and makes virtualization detection more
similar to architecture detection. |
288a74cce597f81d3ba01d8a5ca7d2ba5b654b7e |
|
11-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add terminal-util.[ch] |
0b452006de98294d1690f045f6ea2f7f6630ec3b |
|
10-Apr-2015 |
Ronny Chevalier <chevalier.ronny@gmail.com> |
shared: add process-util.[ch] |
2eec67acbb00593e414549a7e5b35eb7dd776b1b |
|
23-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use. |
e801700e9acdde60078eb1d41b41b06369b83541 |
|
12-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Implement masking and overriding of generators
Sometimes it is necessary to stop a generator from running. Either
because of a bug, or for testing, or some other reason. The only way
to do that would be to rename or chmod the generator binary, which is
inconvenient and does not survive upgrades. Allow masking and
overriding generators similarly to units and other configuration
files.
For the systemd instance, masking would be more common, rather than
overriding generators. For the user instances, it may also be useful
for users to have generators in $XDG_CONFIG_HOME to augment or
override system-wide generators.
Directories are searched according to the usual scheme (/usr/lib,
/usr/local/lib, /run, /etc), and files with the same name in higher
priority directories override files with the same name in lower
priority directories. Empty files and links to /dev/null mask a given
name.
https://bugs.freedesktop.org/show_bug.cgi?id=87230 |
4968105790c65af58d4ab42bffa2a4bedc0be8ee |
|
12-Jan-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Simplify execute_directory()
Remove the optional sepearate opening of the directory,
it would be just too complicated with the change to
multiple directories.
Move the middle of execute_directory() to a seperate
function to make it easier to grok. |
f131770b1465fbf423881f16ba85523a05f846fe |
|
31-Dec-2014 |
Veres Lajos <vlajos@gmail.com> |
tree-wide: spelling fixes
https://github.com/vlajos/misspell_fixer
https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa
Thanks to Torstein Husebo <torstein@huseboe.net>. |
820d3acfe924e58965d14b4711d5df31c5db199a |
|
29-Nov-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
delta: diff returns 1 when files differ, ignore this
https://bugs.debian/org/771397 |
4a62c710b62a5a3c7a8a278b810b9d5b5a0c8f4f |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: another round of simplifications
Using the same scripts as in f647962d64e "treewide: yet more log_*_errno
+ return simplifications". |
56f64d95763a799ba4475daf44d8e9f72a1bd474 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: use log_*_errno whenever %m is in the format string
If the format string contains %m, clearly errno must have a meaningful
value, so we might as well use log_*_errno to have ERRNO= logged.
Using:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/'
Plus some whitespace, linewrap, and indent adjustments. |
da927ba997d68401563b927f92e6e40e021a8e5c |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values. |
0a1beeb64207eaa88ab9236787b1cbc2f704ae14 |
|
28-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
treewide: auto-convert the simple cases to log_*_errno()
As a followup to 086891e5c1 "log: add an "error" parameter to all
low-level logging calls and intrdouce log_error_errno() as log calls
that take error numbers", use sed to convert the simple cases to use
the new macros:
find . -name '*.[ch]' | xargs sed -r -i -e \
's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/'
Multi-line log_*() invocations are not covered.
And we also should add log_unit_*_errno(). |
4104970ef78e40e976215cdb0d1b9170a213cc4b |
|
26-Nov-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
manager: log some fatal errors at emergency level
This adds a new log_emergency() function, which is equivalent to
log_error() for non-PID-1, and logs at the highest priority for PID 1.
Some messages which occur before freezing are converted to use it. |
4b5d8d0f22ae61ceb45a25391354ba53b43ee992 |
|
06-Nov-2014 |
Michal Schmidt <mschmidt@redhat.com> |
shutdown: fix arguments to /run/initramfs/shutdown
Our initrd interface specifies that the verb is in argv[1].
This is where systemd passes it to systemd-shutdown, but getopt
permutes argv[]. This confuses dracut's shutdown script:
Shutdown called with argument '--log-level'. Rebooting!
getopt can be convinced to not permute argv[] by having '-' as the first
character of optstring. Let's use it. This requires changing the way
non-option arguments (in our case, the verb) are processed.
This fixes a bug where the system would reboot instead of powering off. |
3f85ef0f05ffc51e19f86fb83a1c51e8e3cd6817 |
|
06-Nov-2014 |
Harald Hoyer <harald@redhat.com> |
s/commandline/command line/g |
d89b5fed9ea5d9ec293585cb85bb27b56ea6ac9c |
|
27-Oct-2014 |
Michal Sekletar <msekleta@redhat.com> |
shutdown: do final unmounting only if not running inside the container
If we run in the container then we run in a mount namespace. If namespace dies
then kernel should do unmounting for us, hence we skip unmounting in containers.
Also, it may be the case that we no longer have capability to do umount,
because we are running in the unprivileged container.
See: http://lists.freedesktop.org/archives/systemd-devel/2014-October/023536.html |
a2726e5cedfa5edeabd7e0784be11bc578555ac5 |
|
24-Oct-2014 |
Marius Tessmann <mus.svz@gmail.com> |
shutdown: pass own argv to /run/initramfs/shutdown
Since commit b1e90ec515408aec2702522f6f68c4920b56375b systemd passes
its log settings to systemd-shutdown via command line parameters.
However, systemd-shutdown doesn't pass these parameters to
/run/initramfs/shutdown, causing it to fall back to the default log
settings.
This fixes the following bugs about the shutdown not being quiet
despite "quiet" being in the kernel parameters:
https://bugs.freedesktop.org/show_bug.cgi?id=79582
https://bugs.freedesktop.org/show_bug.cgi?id=57216 |
5a4bf02ff57e4dd3453f2b868c72fe45f60033a3 |
|
28-Aug-2014 |
Harald Hoyer <harald@redhat.com> |
use the switch_root function in shutdown
removes code duplication
also move switch-root to shared |
f07756bfe25c64119704c93a634162d6c88b5c89 |
|
22-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
core: introduce "poweroff" as new failure action types
Also, change the default action on a system start-up timeout to powering off. |
601185b43da638b1c74153deae01dbd518680889 |
|
04-Aug-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Unify parse_argv style
getopt is usually good at printing out a nice error message when
commandline options are invalid. It distinguishes between an unknown
option and a known option with a missing arg. It is better to let it
do its job and not use opterr=0 unless we actually want to suppress
messages. So remove opterr=0 in the few places where it wasn't really
useful.
When an error in options is encountered, we should not print a lengthy
help() and overwhelm the user, when we know precisely what is wrong
with the commandline. In addition, since help() prints to stdout, it
should not be used except when requested with -h or --help.
Also, simplify things here and there. |
e26807239bd65bc17535a53cd540f38600e7ef24 |
|
07-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
firstboot: get rid of firstboot generator again, introduce ConditionFirstBoot= instead
As Zbigniew pointed out a new ConditionFirstBoot= appears like the nicer
way to hook in systemd-firstboot.service on first boots (those with /etc
unpopulated), so let's do this, and get rid of the generator again. |
418b9be50018303cde79b423d4701b7fd86ddbdc |
|
07-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
firstboot: add new component to query basic system settings on first boot, or when creating OS images offline
A new tool "systemd-firstboot" can be used either interactively on boot,
where it will query basic locale, timezone, hostname, root password
information and set it. Or it can be used non-interactively from the
command line when prepareing disk images for booting. When used
non-inertactively the tool can either copy settings from the host, or
take settings on the command line.
$ systemd-firstboot --root=/path/to/my/new/root --copy-locale --copy-root-password --hostname=waldi
The tool will be automatically invoked (interactively) now on first boot
if /etc is found unpopulated.
This also creates the infrastructure for generators to be notified via
an environment variable whether they are running on the first boot, or
not. |
8c9778383b2cf64c45323bb10b741aa3beae28ca |
|
26-Jun-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
shutdown: rework messages during shutdown
When running in 'quiet' mode, the only message printed from shutdown
binary would be 'Cannot finalize remaining file systems and devices,
giving up.', the only log line at error level before switch back to
initramfs. This is misleading, because in initramfs everything will
be cleaned up properly.
Avoid printing anything at error level before the attempt to switch
back to initramfs. Rework the messages to contain a bit more
information what is still remaining, to help people diagnose shutdown
issues. |
aa62a8936f5983770e90b791083d55107659f7a1 |
|
06-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: add timeout to generator execution |
06beed6dc6abeb392b3e2ca8c46fa3169616651e |
|
18-Feb-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Remove unused variable and two function stubs |
b1e90ec515408aec2702522f6f68c4920b56375b |
|
17-Feb-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Pass log config from systemd to systemd-shutdown
If PID 1 debug logging is enabled, it is nice to keep those settings
when switching to systemd-shutdown binary, independently of whether
this was done through /proc/cmdline options, or through runtime
manipulations. |
99f098257f5e4135609edc3df965ebf27975df18 |
|
18-Dec-2013 |
Lennart Poettering <lennart@poettering.net> |
log: don't reopen /dev/console each time we call log_open()
Instead, force reopen it only if we really really have to. |
0bee65f0622c4faa8ac8ae771cc0c8a936dfa284 |
|
25-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
shutdown: during final killing spree also send SIGHUP in addition to SIGTERM to deal with shells
This makes shutdown a bit faster if debug-shell.service is enabled. |
4561be3a64534a911ee405ffb51950a624a0cd3f |
|
19-Nov-2013 |
Karel Zak <kzak@redhat.com> |
Remove duplicate includes |
477def8097245a124f8ff51d17415cf78cde691b |
|
08-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
shutdown: unify handling of reboot() syscall a bit |
37185ec80ad372907a2a9388735655a7334babb6 |
|
07-Nov-2013 |
WaLyong Cho <walyong.cho@samsung.com> |
Support additional argument in reboot
reboot syscall can be performed with an additional argument. In some
systems this functionality can be useful to modify the mode of the
next boot performed by the bootloader. |
74df0fca09b3c31ed19e14ba80f996fdff772417 |
|
06-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
util: unify reading of /proc/cmdline
Instead of individually checking for containers in each user do this
once in a new call proc_cmdline() that read the file only if we are not
in a container. |
41f85451d36f14bfc2f78e687167eba9a2d4d67c |
|
06-Nov-2013 |
Lennart Poettering <lennart@poettering.net> |
shutdown: trim the cgroup tree on loop iteration
This way we leave the cgroup empty before exiting in a container which
makes sure the container manager will get cgroup notification event
https://bugs.freedesktop.org/show_bug.cgi?id=68370
https://bugzilla.redhat.com/show_bug.cgi?id=988883 |
7801356442578ff6e1c65844eb9e65c819af4660 |
|
16-Jul-2013 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
build-sys: discover the path to kexec during build time
https://bugs.freedesktop.org/show_bug.cgi?id=55248 |
f6940be7825755d77ade4cd42231aab9e3580623 |
|
11-Jul-2013 |
Lennart Poettering <lennart@poettering.net> |
shutdown: avoid malloc() if we can |
8577e67245fc5d38bfdc32349388769895202bc4 |
|
11-Jul-2013 |
Kay Sievers <kay@vrfy.org> |
shutdown: fix /proc/cmdline reading of 'quiet' |
ec26be514ff3c5367b21f9881369080bda54fd2d |
|
05-Jul-2013 |
Kay Sievers <kay@vrfy.org> |
suppress status message output at shutdown when 'quiet' is given |
30d743f43007ed5a3db1f9a053b6d87c0940adb2 |
|
09-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
shutdown: print a nice message before returning to initrd |
5989dbb2334473270265357622326496e16747d1 |
|
08-Apr-2013 |
Lennart Poettering <lennart@poettering.net> |
shutdown: print a message when storage is finalized |
735e0712710a1dc26da0febafb91b242b2687f3f |
|
07-Dec-2012 |
Michal Schmidt <mschmidt@redhat.com> |
shutdown, umount: use verbs consistently
Mounts are "unmounted".
Swaps are "deactivated", not "turned off" nor "disabled".
Loop and DM devices are "detached", not "deleted".
Especially the deleting sounded a bit scary. |
bce93b7ac7642426039863493694d8c12812e2a7 |
|
07-Dec-2012 |
Michal Schmidt <mschmidt@redhat.com> |
shutdown, umount: logging improvements
In bugreports about hangs during the late shutdown we are often missing
important information - what were we trying to unmount/detach when it hung.
Instead of printing what we successfully unmounted, print what we are
going to unmount/detach. And add messages to mark the completion of
categories (mount/swap/loop/DM). |
2569a5ce16638d99f1ebaaa7774d183496d8b8e8 |
|
07-Dec-2012 |
Michal Schmidt <mschmidt@redhat.com> |
shutdown: downgrade a warning
All messages of the kind "not all done, %d left" are log_info, except
the one for DM devices. Make it info too. |
02eaa78835fb994dbe609296d9b9d0c9b463cc1c |
|
28-Nov-2012 |
Tom Gundersen <teg@jklm.no> |
shutdown: don't pivot to /run/initramfs if already there
This allows systemd-shutdown to be installed as /run/initramfs/shutdown
and take care of the proper teardown of the rootfs. |
0049f05a8bb82c3e084bacc5945596761d706c55 |
|
16-Nov-2012 |
Lennart Poettering <lennart@poettering.net> |
shutdown: readd explicit sync() when shutting down
As it turns out reboot() doesn't actually imply a file system sync, but
only a disk sync. Accordingly, readd explicit sync() invocations
immediately before we invoke reboot().
This is much less dramatic than it might sounds as we umount all
disks/read-only remount them anyway before going down. |
cb7ec5645e0edf154f0cc8414f5914cb433d0dfe |
|
06-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
shutdown: in containers, invoke reboot(2), too. Then fallback to exit() if CAP_SYS_BOOT is missing
The kernel's PID namespaces support reboot(2) just fine, so let's make
use of it if possible. |
57371e5829a61e5ee6c9f98404dfc729d6c62608 |
|
06-Sep-2012 |
Lennart Poettering <lennart@poettering.net> |
shutdown: remove explicit sync() invocations
The kernel implicitly does sync() anyway, hence there is no need to do
that in userspace explicitly. This makes the "-n" switch to halt(8) a
noop. |
f47fc35555565c4b161c2e44b357b4dbaf3a997d |
|
12-Aug-2012 |
Lennart Poettering <lennart@poettering.net> |
switch-root: remount to MS_PRIVATE
The kernel does not allow switching roots if things are mounted
MS_SHARED. As a work-around, remount things MS_PRIVATE before switching
roots.
This should be fixed in the kernel for good.
https://bugzilla.redhat.com/show_bug.cgi?id=847418 |
4bfa638d43c05e8db052cd55818765bb3575a405 |
|
10-Aug-2012 |
Dave Reisner <dreisner@archlinux.org> |
shutdown: recursively mark root as private before pivot
Because root is now recursively marked as shared on bootup, we need to
recursively mark root as private. This prevents a pivot_root failure on
shutdown:
Cannot finalize remaining file systems and devices, giving up.
pivot failed: Invalid argument |
cee530bb23b78c0dfd18b0c2718cfe41286396df |
|
17-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
switch-root: don't wait for processes
When we transition from the initrd to the main system, don't reap
processes, so that they can be handled normally after deserialization. |
49f43d5f91a99b23f745726aa351d8f159774357 |
|
16-Jul-2012 |
Ville Skyttä <ville.skytta@iki.fi> |
Spelling fixes. |
39d6464ce3ae529eabba68e7dc57259b7d4ee8ac |
|
13-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
shutdown: add missing include |
910212e738e5ecdc0ceebfcc5009d688415eaefc |
|
13-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
container: when shutting down in a container don't detach loop devices
We don't do device handling in containers, hence no loop devices either. |
bd3fa1d2434aa28564251ac4da34d01537de8c4b |
|
13-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
core: go on a killing spree when transitioning from initrd to main system |
cd3bd60a2e4bb08526d953a323bbe1a0ace78b9e |
|
10-Jul-2012 |
Lennart Poettering <lennart@poettering.net> |
switch-root: reopen /dev/console before we switch root |
d2e54fae5ca7a0f71b5ac8b356a589ff0a09ea0a |
|
31-May-2012 |
Kay Sievers <kay@vrfy.org> |
mkdir: append _label to all mkdir() calls that explicitly set the selinux context |
6edd7d0a09171ea5ae8e01b7b1cbcb0bdfbfeb16 |
|
08-May-2012 |
Lennart Poettering <lennart@poettering.net> |
sleep: implement suspend/hibernate as first class targets |
b55d0651c0433aee6bbec0516a0c2eb001c3fc31 |
|
24-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
shutdown: don't complain if we cannot lock memory, to make container shutdowns clean |
ff644623750b4f672a79cab6cc52e8681e55a044 |
|
22-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
shutdown: don't try to shut down DM devices in a container |
146de8175e11c877908f20f8ed1b5a3805455c0a |
|
12-Apr-2012 |
Lennart Poettering <lennart@poettering.net> |
shutdown: move shutdown to core since it replaces PID 1 |