summaryrefslogtreecommitdiff
path: root/src/core/shutdown.c
Commit message (Collapse)AuthorAge
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | 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.
* Implement masking and overriding of generatorsZbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | | | | | | | | | | | | | | 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
* Simplify execute_directory()Zbigniew Jędrzejewski-Szmek2015-01-11
| | | | | | | | | 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.
* tree-wide: spelling fixesVeres Lajos2014-12-30
| | | | | | | https://github.com/vlajos/misspell_fixer https://github.com/torstehu/systemd/commit/b6fdeb618cf2f3ce1645b3315f15f482710c7ffa Thanks to Torstein Husebo <torstein@huseboe.net>.
* delta: diff returns 1 when files differ, ignore thisZbigniew Jędrzejewski-Szmek2014-11-29
| | | | https://bugs.debian/org/771397
* treewide: another round of simplificationsMichal Schmidt2014-11-28
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | 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.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | 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().
* manager: log some fatal errors at emergency levelZbigniew Jędrzejewski-Szmek2014-11-26
| | | | | | 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.
* shutdown: fix arguments to /run/initramfs/shutdownMichal Schmidt2014-11-06
| | | | | | | | | | | | | 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.
* s/commandline/command line/gHarald Hoyer2014-11-06
|
* shutdown: do final unmounting only if not running inside the containerMichal Sekletar2014-10-27
| | | | | | | | | | 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
* shutdown: pass own argv to /run/initramfs/shutdownMarius Tessmann2014-10-24
| | | | | | | | | | | | | | 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
* use the switch_root function in shutdownHarald Hoyer2014-08-28
| | | | | | removes code duplication also move switch-root to shared
* core: introduce "poweroff" as new failure action typesLennart Poettering2014-08-22
| | | | Also, change the default action on a system start-up timeout to powering off.
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-03
| | | | | | | | | | | | | | | | 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.
* firstboot: get rid of firstboot generator again, introduce ↵Lennart Poettering2014-07-07
| | | | | | | | 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.
* firstboot: add new component to query basic system settings on first boot, ↵Lennart Poettering2014-07-07
| | | | | | | | | | | | | | | | | | | | 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.
* shutdown: rework messages during shutdownZbigniew Jędrzejewski-Szmek2014-06-26
| | | | | | | | | | | | | 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.
* util: add timeout to generator executionLennart Poettering2014-03-06
|
* Remove unused variable and two function stubsZbigniew Jędrzejewski-Szmek2014-02-17
|
* Pass log config from systemd to systemd-shutdownZbigniew Jędrzejewski-Szmek2014-02-17
| | | | | | | 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.
* log: don't reopen /dev/console each time we call log_open()Lennart Poettering2013-12-18
| | | | Instead, force reopen it only if we really really have to.
* shutdown: during final killing spree also send SIGHUP in addition to SIGTERM ↵Lennart Poettering2013-11-25
| | | | | | to deal with shells This makes shutdown a bit faster if debug-shell.service is enabled.
* Remove duplicate includesKarel Zak2013-11-18
|
* shutdown: unify handling of reboot() syscall a bitLennart Poettering2013-11-08
|
* Support additional argument in rebootWaLyong Cho2013-11-07
| | | | | | 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.
* util: unify reading of /proc/cmdlineLennart Poettering2013-11-06
| | | | | | 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.
* shutdown: trim the cgroup tree on loop iterationLennart Poettering2013-11-06
| | | | | | | | 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
* build-sys: discover the path to kexec during build timeZbigniew Jędrzejewski-Szmek2013-07-15
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=55248
* shutdown: avoid malloc() if we canLennart Poettering2013-07-11
|
* shutdown: fix /proc/cmdline reading of 'quiet'Kay Sievers2013-07-11
|
* suppress status message output at shutdown when 'quiet' is givenKay Sievers2013-07-05
|
* shutdown: print a nice message before returning to initrdLennart Poettering2013-04-09
|
* shutdown: print a message when storage is finalizedLennart Poettering2013-04-08
|
* shutdown, umount: use verbs consistentlyMichal Schmidt2012-12-07
| | | | | | | | 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.
* shutdown, umount: logging improvementsMichal Schmidt2012-12-07
| | | | | | | | | 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).
* shutdown: downgrade a warningMichal Schmidt2012-12-07
| | | | | All messages of the kind "not all done, %d left" are log_info, except the one for DM devices. Make it info too.
* shutdown: don't pivot to /run/initramfs if already thereTom Gundersen2012-11-28
| | | | | This allows systemd-shutdown to be installed as /run/initramfs/shutdown and take care of the proper teardown of the rootfs.
* shutdown: readd explicit sync() when shutting downLennart Poettering2012-11-16
| | | | | | | | | 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.
* shutdown: in containers, invoke reboot(2), too. Then fallback to exit() if ↵Lennart Poettering2012-09-05
| | | | | | | CAP_SYS_BOOT is missing The kernel's PID namespaces support reboot(2) just fine, so let's make use of it if possible.
* shutdown: remove explicit sync() invocationsLennart Poettering2012-09-05
| | | | | | 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.
* switch-root: remount to MS_PRIVATELennart Poettering2012-08-12
| | | | | | | | | | 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
* shutdown: recursively mark root as private before pivotDave Reisner2012-08-10
| | | | | | | | | 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
* switch-root: don't wait for processesLennart Poettering2012-07-17
| | | | | When we transition from the initrd to the main system, don't reap processes, so that they can be handled normally after deserialization.
* Spelling fixes.Ville Skyttä2012-07-16
|
* shutdown: add missing includeLennart Poettering2012-07-13
|
* container: when shutting down in a container don't detach loop devicesLennart Poettering2012-07-13
| | | | We don't do device handling in containers, hence no loop devices either.
* core: go on a killing spree when transitioning from initrd to main systemLennart Poettering2012-07-13
|