Commit Graph

360 Commits

Author SHA1 Message Date
Lennart Poettering b14eda963c logind: split up inhibit acquire policy 2012-09-18 01:16:23 +02:00
Lennart Poettering faa368e337 conf-parser: don't unescape parsed configuration strings by default
In many cases this might have a negative effect since we drop escaping
from strings where we better shouldn't have dropped it.

If unescaping makes sense for some settings we can readd it later again,
on a per-case basis.

https://bugs.freedesktop.org/show_bug.cgi?id=54522
2012-09-17 21:58:03 +02:00
Lennart Poettering c999977392 main: newer kernels return EINVAL if we invoke reboot() in a container lacking perms, deal with it 2012-09-17 19:05:33 +02:00
Lennart Poettering a866073d35 main: when transitioning from initrd to the main system log to kmsg
When the new PID is invoked the journal socket from the initrd might
still be around. Due to the default log target being journal we'd log to
that initially when the new main systemd initializes even if the kernel
command line included a directive to redirect systemd's logging
elsewhere.

With this fix we initially always log to kmsg now, if we are PID1, and
only after parsing the kernel cmdline try to open the journal if that's
desired.

(The effective benefit of this is that SELinux performance data is now
logged again to kmsg like it used to be.)
2012-09-17 17:47:47 +02:00
Kay Sievers 72edcff5db hwclock: always set the kernel's timezone
Properly tell the kernel at bootup, and any later time zone changes,
the actual system time zone.

Things like the kernel's FAT filesystem driver needs the actual time
zone to calculate the proper local time to use for the on-disk time
stamps.

https://bugzilla.redhat.com/show_bug.cgi?id=802198
2012-09-17 16:56:26 +02:00
Lennart Poettering 4096d6f587 main: bump up RLIMIT_NOFILE for systemd itself
For setups with many listening sockets the default kernel resource limit
of 1024 fds is not enough. Bump this up to 64K to avoid any limitations
in this regard. We are careful to pass on the kernel default to daemons
however, since normally resource limits are a good to enforce,
especially since select() can't handle fds > 1023.
2012-09-17 16:35:59 +02:00
Lennart Poettering bfba3256a0 service: don't hit an assert if a service unit changes type and we get a spurious event from before 2012-09-17 14:56:44 +02:00
Zbigniew Jędrzejewski-Szmek 4db17f291c build-sys: __secure_getenv lost dunder in libc 2.17 2012-09-17 00:21:25 +02:00
Dave Reisner c65a0b1466 socket: prevent signed integer overflow
src/core/socket.c:588:25: error: overflow in implicit constant conversion
src/core/socket.c:589:17: error: overflow in implicit constant conversion
2012-09-16 16:55:46 +02:00
Lennart Poettering 2fbe635a83 macro: introduce _cleanup_free_ macro for automatic freeing of scoped vars and make use of it 2012-09-13 22:30:26 +02:00
Lennart Poettering a1d41e17a5 rpm: expose preset dir as rpm macro and in systemd.pc 2012-09-13 22:17:46 +02:00
Auke Kok 095b2d7ab9 load-fragment: Expand specifiers in conditions.
Add specifier expansion to Path and String conditions.

Specifier expansion for conditions will help create instance
and user session units by allowing us to template conditions
based on the instance or user session parameters.

An example would be a system-wide user session service file
that conditionally runs based on whether a user has the
service configured through a configuration file in ~/.config/.
2012-09-13 21:54:34 +02:00
Thomas Hindoe Paaboel Andersen c53158818d man: fix a bunch of typos in docs
https://bugs.freedesktop.org/show_bug.cgi?id=54501
2012-09-13 19:34:24 +02:00
Lennart Poettering 7ceba24134 manager: fix the build 2012-09-13 19:29:46 +02:00
Lennart Poettering 915b375388 manager: extend performance measurement interface to include firmware/loader times
This only adds the fields to the D-Bus interfaces but doesn't fill them
in with anything useful yet. Gummiboot exposes the necessary bits of
information to use however and as soon as I get my fingers on a proper
UEFI laptop I'll hook up the remaining bits.

Since we want to stabilize the D-Bus interface soon and include it in
the stability promise we should get the last fixes in, hence this change
now.
2012-09-13 18:54:32 +02:00
Lennart Poettering 742a862bb8 condition: add ConditionFileNotEmpty=
https://bugs.freedesktop.org/show_bug.cgi?id=54448
2012-09-11 01:29:46 +02:00
Lennart Poettering 2f6f1bc30c selinux: close stdin/stdout/stderr before loading selinux policy
Let's make sure libselinux doesn't spew to stderr
2012-09-10 13:14:56 +02:00
Lennart Poettering 9d576438a1 unit: don't allow units to be gc'ed that still are referenced via UnitRef 2012-09-10 10:12:10 +02:00
Lennart Poettering ac59a798f2 main: fix syntax of net_prio cgroup controller 2012-09-07 22:22:15 +02:00
Lennart Poettering cb7ec5645e 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.
2012-09-05 15:55:40 -07:00
Lennart Poettering 57371e5829 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.
2012-09-05 15:32:57 -07:00
Lennart Poettering be5412d854 main: jointly mount more controllers
After talking to the cgroup kernel folks at LPC we came to the
conclusion that it is probably a good idea to mount all CPU related
resp. all network related cgroup controllers together, both because they
are good defaults for admins and because this might prepare
for eventual kernel cleanups where the ability to mount them separately
is removed.
2012-09-03 18:59:05 -07:00
Lennart Poettering c0387ebfb6 swap: don't try to shutdown swaps on shutdown in a container 2012-09-03 18:59:05 -07:00
Lennart Poettering a5c3034fa7 swap: refuse start/stop of swaps in container 2012-09-03 18:59:05 -07:00
Lennart Poettering 024f268d63 shutdown: don't attempt read-only mounts in a container 2012-09-03 18:59:04 -07:00
Lennart Poettering 81270860a5 journal: suppress structured messages if they'd go to the console 2012-09-03 18:59:04 -07:00
Lennart Poettering 877d54e9b0 journal: generate structured journal messages for a number of events 2012-09-03 18:59:04 -07:00
Lennart Poettering 88fae6e044 shared: in code that might get called from suid programs use __secure_getenv() rather than getenv()
It's better to be safe than sorry.
2012-09-03 18:59:04 -07:00
Lukas Nykryn 032f81645b core: free word later in parse_proc_cmdline 2012-08-23 13:53:30 +02:00
Lukas Nykryn b5fb37899d load-fragment: initialize bool invert before use 2012-08-23 13:31:32 +02:00
Lennart Poettering 8d1b002a2e service: introduce a proper service result if the start limit is hit 2012-08-22 05:02:33 +02:00
Lennart Poettering c0d6e764d1 unit: add new ConditionHost= condition type 2012-08-22 01:51:53 +02:00
Lennart Poettering ddfa5101a2 main: fix PR_SET_CHILD_SUBREAPER warning version 2012-08-21 23:07:21 +02:00
Lennart Poettering 01ed0e2307 dev-setup: make NULL as parameter for dev_setup() equivalent to "" 2012-08-21 17:23:03 +02:00
Dave Reisner 8f0e73f250 dev-setup: allow a path prefix for use in chroots
With this adjustment, we can reuse this code elsewhere, such as in
nspawn.
2012-08-21 17:19:35 +02:00
Lennart Poettering 8b8ffe6828 core: fix error checking for PR_SET_CHILD_SUBREAPER 2012-08-21 16:48:02 +02:00
Lennart Poettering feb12d3ed2 journal: make libgcrypt dependency optional 2012-08-20 16:51:46 +02:00
Lukas Nykryn 96342de68d service: add options RestartPreventExitStatus and SuccessExitStatus
In some cases, like wrong configuration, restarting after error
does not help, so administrator can specify statuses by RestartPreventExitStatus
which will not cause restart of a service.

Sometimes you have non-standart exit status, so this can be specified
by SuccessfulExitStatus.
2012-08-14 14:46:03 +02:00
Lennart Poettering 8caf9d6836 umount: MS_MGC_VAL is so 90s 2012-08-13 16:30:10 +02:00
Lennart Poettering 1e41be2015 nspawn,namespaces: make sure we recursively bind mount things in
We want to make sure that everything from the host is also visible in
the sandbox.
2012-08-13 16:25:03 +02:00
Lennart Poettering aed5a52577 machine-id: properly mount transient machine ID read-only 2012-08-13 16:24:30 +02:00
Lennart Poettering ac0930c892 namespace: rework namespace support
- don't use pivot_root() anymore, just reuse root hierarchy
- first create all mounts, then mark them read-only so that we get the
  right behaviour when people want writable mounts inside of
  read-only mounts
- don't pass invalid combinations of MS_ constants to the kernel
2012-08-13 15:27:04 +02:00
Lennart Poettering f47fc35555 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
2012-08-12 01:31:03 +02:00
Dave Reisner 4bfa638d43 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
2012-08-10 17:59:33 +02:00
Lennart Poettering 64825d3c58 fix a couple of issues found with llvm-analyze 2012-08-08 23:54:21 +02:00
Michal Sekletar d568a3350e systemd: introduced new timeout types
Makes possible to specify separate timeout for start and stop of
the service.

[ Improved the manpage. Coding style fix. -- michich ]
2012-08-08 18:11:09 +02:00
Lennart Poettering b3ac5f8cb9 mount-setup: change system mount propagation to shared by default
In order to make containers work nicely out of the box it is highly
desirable to have the mount propagation mode for the root fs is set as
"shared" by default so that containers receive system mounts by default.
(See mount --make-shared for more information).

As it is unlikely that the kernel will change the default to "shared"
for this, do this early at boot-up from PID 1. Setups which prefer the
default of "private" should undo this change via invoking "mount
--make-private /" or a similar command after boot.

In the long run /etc/fstab should take the propagation mode as a mount
option like any other, so that this may be used to change the default
mode. However, if fstab is not around or doesn't list / we still should
default to shared as propagation mode, hence this change now.
2012-08-06 18:35:01 +02:00
Lennart Poettering 6afa301b8d main: fix typo 2012-08-06 16:41:29 +02:00
Shawn Landden 1421211924 continue work with error messages, log_oom()
Adds messages for formally silent errors: new "Failed on cmdline argument %s: %s".

Removes some specific error messages for -ENOMEM in mount-setup.c. A few specific
ones have been left in other binaries.
2012-08-06 16:37:01 +02:00
Zbigniew Jędrzejewski-Szmek 2cc5887620 automount: print mount point in debug message
Old: systemd[1]: Got direct mount request for ffff88003bb10c00, triggered by 14476 (fuser)
New: systemd[1]: Got direct mount request on /dev/mqueue, triggered by 2177 (ls)
2012-07-31 01:26:24 +02:00
Dave Reisner f8e9f2cc4b selinux: avoid inclusion of null_log without selinux
Avoids a compile time warning:

  warning: 'null_log' defined but not used [-Wunused-function]
2012-07-28 22:35:41 +02:00
Shawn Landden 0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
2012-07-26 11:48:26 +02:00
Michal Schmidt ac6a4abed3 unit: add missing deps in unit_dependency_table
also reorder the table according to the enum order.
2012-07-26 09:47:30 +02:00
Michal Schmidt 60649f17bd unit: make the table of inverse deps symmetric 2012-07-26 09:42:26 +02:00
Michal Schmidt b05afff1af dbus-unit: expose PartOf/ConsistsOf properties 2012-07-26 09:38:39 +02:00
Michal Sekletar 85e9a1010d systemd: added new dependency PartOf
This should address TODO item "new dependency type to "group" services
in a target". Semantic of new dependency is as follows. Once configured
it creates dependency which will cause that all dependent units get
stopped if unit they all depend on is stopped or restarted.  Usual use
case would be configuring PartOf=some.target in template unit file
and WantedBy=some.target in [Install] section and enabling desired
number of instances. In this case starting one instance won't pull in
target but stopping or starting target(in case of WantedBy is properly
configured) will cause stop/start of all instances.
2012-07-26 09:16:43 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Auke Kok d4447f4d95 main: set PR_SET_CHILD_REAPER for MANAGER_USER
Become the reaper for all children part of the user session. Tested
with several forking services.
2012-07-25 00:17:30 +02:00
Jim Meyering 956b78e8e3 sd-daemon: remove unnecessary memset calls
There is no point in clearing the bits of a "struct stat" when the very
next statement just calls stat or fstat to fill in that same memory.

[zj: two more places]
2012-07-23 00:06:06 +02:00
Lennart Poettering cba6e0627d units: apply default resource limits to socket/mount/swap processes too 2012-07-20 00:10:32 +02:00
Lennart Poettering c74f17d96c core: drop KillMode parameter from KillUnit() bus call
It made no sense, and since we are documenting the bus calls now and
want to include them in our stability promise we really should get it
cleaned up sooner, not later.
2012-07-20 00:10:32 +02:00
Lennart Poettering 4819ff0358 unit: split off KillContext from ExecContext containing only kill definitions 2012-07-20 00:10:31 +02:00
Shawn Landden c2f1db8f83 use #pragma once instead of foo*foo #define guards
#pragma once has been "un-deprecated" in gcc since 3.3, and is widely supported
in other compilers.

I've been using and maintaining (rebasing) this patch for a while now, as
it annoyed me to see #ifndef fooblahfoo, etc all over the place,
almost arrogant about the annoyance of having to define all these names to
perform a commen but neccicary functionality, when a completely superior
alternative exists.

I havn't sent it till now, cause its kindof a style change, and it is bad
voodoo to mess with style that has been established by more established
editors. So feel free to lambast me as a crazy bafoon.

v2 - preserve externally used headers
2012-07-19 12:30:59 +02:00
Lennart Poettering 31f92a7df4 manager: use a private notify sockets in containers to avoid problems with shared abstract socket namespaces 2012-07-19 02:17:50 +02:00
Lennart Poettering 3d141780b8 killall: avoid gcc warning about wait name clash 2012-07-19 02:17:11 +02:00
Lennart Poettering d4943dc755 service: don't print a warning if we are in autorestart state, and can't start a unit just yet 2012-07-18 02:42:43 +02:00
Lennart Poettering a8bb2e6503 service: make start jobs wait, not fail, when an automatic restart is queued
When an automatic restart is already queued, then make subsequent start
jobs wait until the restart can be handled (i.e. after the holdhoff
time), instead of simply fail.
2012-07-18 02:28:08 +02:00
Lennart Poettering 6b78f9b435 unit: don't serialize job state, only unit state across switch-root 2012-07-18 01:46:52 +02:00
Lennart Poettering cee530bb23 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.
2012-07-17 17:44:26 +02:00
Zbigniew Jędrzejewski-Szmek 9ba0bc4e0f systemd: add --version option
systemd --version mirrors systemctl --version:

$ ./systemd --version
systemd 186
other
+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT -LIBCRYPTSETUP

This information can be retrieved by other means (systemctl, etc.),
but it's easier for a newbie if 'systemd --version' says something
useful. And 'systemd --help' is already there, so let's complement
that with '--version'.
2012-07-17 16:34:23 +02:00
Lennart Poettering b9a0e01068 execute: free syscall filter array after use 2012-07-17 15:55:23 +02:00
Lennart Poettering 8351ceaea9 execute: support syscall filtering using seccomp filters 2012-07-17 04:17:53 +02:00
Lennart Poettering e616d1c674 core: fix name of dbus call parameter 2012-07-16 19:11:27 +02:00
Lennart Poettering e06c73cc91 unit: set default working directory to the user's home directory when running in user mode 2012-07-16 12:44:42 +02:00
Lennart Poettering d05c5031ad unit: introduce %s specifier for the user shell 2012-07-16 12:34:54 +02:00
Auke Kok b2896c905b unit: printf specifiers %u and %h: $USER and $HOME.
These printf specifiers allow us to refer to $HOME and $USER
in unit files. These are particularly helpful in instanced
units that have "User=" set, and in systemd --user domains.

The specifiers will return the pw_name and pw_dir fields
if the unit file has a User= field.

If the unit file does not have a User= field, the value
substituted is either $USER or $HOME from the environment,
or, if unset, the values from pw_name or pw_dir.

This patch is somewhat after Ran Benita's original patch,
which didn't get merged. I've split up the 2 specifiers
and extended them to do what is logically expected from
these specifiers.

Note that expansion is done at `start` time, not after
the units are parsed. Using `systemctl show` will just
show the specifiers.
2012-07-16 12:25:25 +02:00
Ville Skyttä 49f43d5f91 Spelling fixes. 2012-07-16 12:16:29 +02:00
Kay Sievers d0bfe5243a unit: avoid re-definition of enum for older gcc versions
<koen> | ./src/shared/unit-name.h:29:23: error: redefinition of typedef 'UnitType'
<koen> | ./src/core/unit.h:30:23: note: previous declaration of 'UnitType' was here
2012-07-15 15:53:43 +02:00
Lennart Poettering 7f2cddae09 unit: rename BindTo= to BindsTo=
all other dependencies are in 3rd person. Change BindTo= accordingly to
BindsTo=.

Of course, the dependency is widely used, hence we parse the old name
too for compatibility.
2012-07-13 23:34:40 +02:00
Lennart Poettering 39d6464ce3 shutdown: add missing include 2012-07-13 21:54:28 +02:00
Harald Hoyer a504223d9a main: only reopen /dev/console if we switch-root to a custom init
There's no point in reopening /dev/console if we reopen it anyway
afterwards.
2012-07-13 14:46:14 +02:00
Lennart Poettering 910212e738 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.
2012-07-13 14:42:25 +02:00
Lennart Poettering bd3fa1d243 core: go on a killing spree when transitioning from initrd to main system 2012-07-13 14:41:57 +02:00
Lennart Poettering b7def68494 util: rename join() to strjoin()
This is to match strappend() and the other string related functions.
2012-07-13 13:41:01 +02:00
Lennart Poettering dbc655d58d selinux: turn of libselinux' internal logging 2012-07-10 19:28:26 +02:00
Lennart Poettering cd3bd60a2e switch-root: reopen /dev/console before we switch root 2012-07-10 19:19:59 +02:00
Malte Starostik 36fcd77e02 mount: fix for complex automounts
If accessing an automount point triggers more changes to
/proc/self/mountinfo than just to add the directly wanted mount, these
changes can lead to spurious -ENODEV notifications on the automount unit
causing the request to fail when in fact the mount will be setup right
afterwards.
2012-07-10 18:27:03 +02:00
Zbigniew Jędrzejewski-Szmek f69614f811 unit: Move UnitLoadState definitions from core/unit.c to shared/unit-name.c
This makes it possible to use them from systemctl without linking
against the core.
2012-07-10 17:18:49 +02:00
Lennart Poettering bcbe497e5a unit: get rid of UnitVTable.suffix, which is now unused 2012-07-10 17:16:50 +02:00
Lennart Poettering 5f73969991 unit-name: remove unit_name_is_valid_no_type() and move unit_name_is_valid() to unit-name.h 2012-07-10 17:07:32 +02:00
Zbigniew Jędrzejewski-Szmek 0a9f8ed00c unit: Move UnitType definitions from core/unit.c to shared/unit-name.c
This makes it possible to use them from systemctl without linking
against the core. A string->enum lookup table is added.
2012-07-10 16:48:08 +02:00
Auke Kok 8401e9f91d MeeGo: Remove build support for MeeGo distribution.
The MeeGo distribution is still a supported distribution, but
will probably not see an updated version of systemd anymore.

Most of the development is focussing on Tizen now, and the
generic support for building --with-distro=other is more than
adequate enough.

This patch removes the support as a custom configuration build
target in systemd. People who are still building this for
the MeeGo distribution should build as "other" distro.
2012-07-09 16:37:46 +02:00
Lennart Poettering 451b34cc1d service: flush the start counter in "systemctl reset-failed" 2012-07-04 00:23:42 +02:00
Lennart Poettering c9bc076461 mount-setup: don't complain if we try to fix the label of a dir beneath a mount but can't due to EROFS 2012-07-03 16:25:50 +02:00
Lennart Poettering 9946996cda load-fragment: a few modernizations 2012-07-03 16:10:04 +02:00
Lennart Poettering 26a1efdf61 core: mention if we are run from an initial RAM disk 2012-07-02 11:38:32 +02:00
Lennart Poettering 29252e9e5b manager: turn notify socket into abstract namespace socket again
sd_notify() should work for daemons that chroot() as part of their
initilization, hence it's a good idea to use an abstract namespace
socket which is not affected by chroot.
2012-07-02 10:43:57 +02:00
Lennart Poettering 33c5fae939 manager: serialize/deserialize job counters across reexec/reload 2012-06-29 19:47:38 +02:00
Lennart Poettering b4efdf9720 remount-fs: also remount /usr according to fstab 2012-06-29 16:14:43 +02:00
Michal Schmidt 8eba616fc0 mount: load only if we there's mountinfo or fragment
Having information from /proc/self/mountinfo is sufficient to consider a
mount unit loaded.

When there's no mountinfo, the loading of the fragment for the mount
unit is not optional. No extra dependency links must be added when the
loading fails.

https://bugzilla.redhat.com/show_bug.cgi?id=835848
2012-06-29 02:10:41 +02:00
Michal Schmidt 1a4ac87500 mount: split adding of extras from mount_load() 2012-06-29 02:04:30 +02:00
Lennart Poettering c20f5ac765 main: print detected virtualiaztion at boot 2012-06-28 14:05:17 +02:00
Michal Schmidt e62abb6268 modules-load: use correct va_list logging function 2012-06-28 00:52:14 +02:00
Lennart Poettering af6da548aa core: make systemd.confirm_spawn=1 actually work
This adds a timeout if the TTY cannot be acquired and makes sure we
always output the question to the console, never to the TTY of the
respective service.
2012-06-26 12:21:43 +02:00
Michal Schmidt 0c7f15b3a9 service: pass via FAILED/DEAD before going to AUTO_RESTART
With misconfigured mysql, which uses Restart=always, the following two
messages would loop indefinitely and the "systemctl start" would never
finish:
  Job pending for unit, delaying automatic restart.
  mysqld.service holdoff time over, scheduling restart.

In service_enter_dead() always set the state to SERVICE_FAILED/DEAD first
before setting SERVICE_AUTO_RESTART. This is to allow running jobs to
complete. OnFailure will be also triggered at this point, so there's no
need to do it again from service_stop() (where it was added in commit
f0c7b229).

Note that OnFailure units should better trigger only after giving up
auto-restarting, but that's for another patch to solve.

https://bugzilla.redhat.com/show_bug.cgi?id=832039
2012-06-26 11:42:52 +02:00
Michal Schmidt e201a0384d service: fix incorrect argument
The last argument to service_enter_dead() is bool allow_restart, not
a service result.
2012-06-26 11:32:30 +02:00
Lennart Poettering 2aac569ab4 bus: drop HaveWatchdog option
Clients should always watch /dev/watchdog directly, instead of going
indirect. Let's keep our stacks small.
2012-06-26 00:03:43 +02:00
Lennart Poettering 35eb6b124e cryptsetup: fix escaping when generating cryptsetup units 2012-06-25 20:16:15 +02:00
Lennart Poettering 93a1d735ac units: rename fsck@.service to systemd-fsck@.service
The rule is that units that encapsulate our own code are prefixed with
"systemd-". Since the fsck units invoke our own code, hence add the
missing prefix. Since a long long time the fsck units didn't invoke the
naked fsck binaries anymore, and it is unlikely that this well ever
change. On the opposite: the code in systemd-fsck will probably get more
complex over time to handle fsck progress to plymouth forwarding.

Same for quotacheck (but not quotaon!)
2012-06-25 14:28:50 +02:00
Lennart Poettering 8ff290af3b unit: drop the Names= option
Names= is a source of errors, simply because alias names specified like
this only become relevant after a unit has been loaded but cannot be
used to load a unit.

Let's get rid of the confusion and drop this field. To establish alias
names peope should use symlinks, which have the the benefit of being
useful as key to load a unit, even though they are not taken into
account if unit names are listed but they haven't been explicitly
referenced before.
2012-06-22 16:24:57 +02:00
Lennart Poettering a3a3e5b6ae dbus: don't expose SysVInitPath and SysVRcndPath on the bus
People should use systemd.pc if anything at all to determine these
directories, and people should not assume that the bus fields are part
of the supported API, so let's just drop this.
2012-06-22 16:18:51 +02:00
Lennart Poettering d081dffbd3 core: remove sysv_console option
This option never made much sense. It was originally intended to make
sure that the usual startup output of sysv scripts goes to the terminal.
However, since SysV scripts started from a terminal would not output to
that terminal, but rather /dev/console this effect was more often than
not actually taking place. Nowadays systemd has much nicer boot time
status output than SysV which makes the sysv output redundant. Finally,
all output of services goes to the journal anyway, and is not lost.

Hence, let's drop this option, and simplify things a bit.
2012-06-22 13:16:28 +02:00
Lennart Poettering b0193f1c1f systemctl: automatically turn paths and unescaped unit names into proper unit names
This makes sure that

  systemctl status /home

is implicitly translated to:

  systemctl status /home.mount

Similar, /dev/foobar becomes dev-foobar.device.

Also, all characters that cannot be part of a unit name are implicitly
escaped.
2012-06-22 13:08:48 +02:00
Lennart Poettering 66a78c2b95 cryptsetup: allow configuration of LUKS disks via the kernel cmdline
This generalizes a bit of the functionality already available in dracut.
2012-06-22 10:11:06 +02:00
Lennart Poettering c66e7bc7a1 man: document all kernel command line options we understand 2012-06-22 01:35:52 +02:00
Eelco Dolstra 62bca2c657 journal: set the _SYSTEMD_UNIT field for messages from terminated processes
As described in

  https://bugs.freedesktop.org/show_bug.cgi?id=50184

the journal currently doesn't set fields such as _SYSTEMD_UNIT
properly for messages coming from processes that have already
terminated.  This means among other things that "systemctl status" may
not show some of the output of services that wrote messages just
before they exited.

This patch fixes this by having processes that log to the journal
write their unit identifier to journald when the connection to
/run/systemd/journal/stdout is opened.  Journald stores the unit ID
and uses it to fill in _SYSTEMD_UNIT when it cannot be obtained
normally (i.e. from the cgroup).  To prevent impersonating another
unit, this information is only used when the caller is root.

This doesn't fix the general problem of getting metadata about
messages from terminated processes (which requires some kernel
support), but it allows "systemctl status" and similar queries to do
the Right Thing for units that log via stdout/stderr.
2012-06-22 00:14:08 +02:00
Lennart Poettering 590f18a27c rpm: include RPM macro definition for .spec snippets
Let's try to standardize a bit the RPM macros used for
installing/uninstalling services.

This only covers the non-SysV compat bits, since that tends to vary
widely between the various distros.

Usage:

Add %{?systemd_requires} to the header of the spec file. And then:

%post
%systemd_post foobar.service

%preun
%systemd_preun foobar.service

%postun
%systemd_postun foobar.service

And, instead of the latter, in case the service shall be restarted on updates:

%postun
%systemd_postun_restart foobar.service
2012-06-21 22:14:17 +02:00
Michal Sekletar 9722ef2565 systemd: return error when asked to stop unknown unit
Command systemctl stop foo.service, will print error message, when
foo.service is unknown to systemd, i.e. there is no unit file loaded for
this service.
https://bugzilla.redhat.com/show_bug.cgi?id=732874
2012-06-19 11:38:22 +02:00
Lukas Nykryn 98709151f3 service: timeout for oneshot services
Add possibility to specify timeout for oneshot services.

[ https://bugzilla.redhat.com/show_bug.cgi?id=761656
  Added minor fixups. -- michich ]
2012-06-15 16:04:06 +02:00
Michal Schmidt 48899192a7 unit-name: introduce unit_dbus_path_from_name()
Use the same function in core and in systemctl.
get_unit_path() in systemctl becomes unnecessary.
2012-06-13 18:42:02 +02:00
Kay Sievers f96096dbbf silence gcc warning on 32 bit 2012-06-04 22:27:39 +02:00
Kay Sievers 8600c525cb remove support for deprecated /proc/self/oom_adj 2012-06-04 16:41:10 +02:00
Lennart Poettering 48ac500bb6 missing: define MS_STRICTATIME if not defined already 2012-06-01 21:25:29 +02:00
Lennart Poettering 213ba152fd journal: allow setting of a cutoff log level for disk storage, syslog, kmsg, console forwarding 2012-06-01 17:27:16 +02:00
Kay Sievers d2e54fae5c mkdir: append _label to all mkdir() calls that explicitly set the selinux context 2012-05-31 12:40:20 +02:00
Lennart Poettering aa0f64ac85 main: allow setting of timer slack for PID 1 2012-05-31 04:36:08 +02:00
Lennart Poettering d88a251b12 util: introduce a proper nsec_t and make use of it where appropriate 2012-05-31 04:27:03 +02:00
Daniel Drake 7c49259fc8 shutdown: Don't skip bind mounts on shutdown
This reverts commits d72238fcb3 and
f3accc08.

OLPC runs / as a bind-mount, so this must be remounted RO during
shutdown to avoid corruption.

As Lennert can't recall the exact reasons for making the shutdown
code skip bind mounts, revert to previous behaviour to solve the
issue for OLPC.

http://lists.freedesktop.org/archives/systemd-devel/2012-April/004957.html
2012-05-30 23:17:03 +02:00
Lennart Poettering 7c0987d812 dbus: better don't expose options we better shouldn't exposed
NotifySocket= is hardly useful, people should use $NOTIFY_SOCKET if
anything.

RunningAs= suggests people had a choice of running user mode as PID 1 or
vice versa, so remove this too.
2012-05-30 21:43:11 +02:00
Lennart Poettering c485d3ba09 service: mark compat options as such
This moves FsckPassNo= and SysVStartPriority= into its own
"Compatibility Options" section in the man page to clarify that these
options are not useful for anything but establishing a limited amount of
compatibility.

Also stop exposing these options on the bus.
2012-05-30 21:42:07 +02:00
Lennart Poettering 939b8f14dc capabilities: when dropping capabilities system-wide also drop them from usermode helpers
This hooks things up with /proc/sys/kernel/usermodehelper/bset and
/proc/sys/kernel/usermodehelper/inheritable.
2012-05-29 23:35:17 +02:00
Lennart Poettering b6bfc7bbee swap: avoid bad memory access 2012-05-24 17:33:50 +02:00
Lennart Poettering ec8927ca59 main: add configuration option to alter capability bounding set for PID 1
This also ensures that caps dropped from the bounding set are also
dropped from the inheritable set, to be extra-secure. Usually that should
change very little though as the inheritable set is empty for all our uses
anyway.
2012-05-24 04:00:56 +02:00
Lennart Poettering e056b01d8a service: for Type=idle units consider START_PRE, START, START_POST all as ACTIVE
We want to avoid a deadlock when a service has ExecStartPre= programs
that wait for the job queue to run empty because of Type=idle, but which
themselves keep the queue non-empty because START_PRE was considered
ACTIVATING and hence the job not complete. With this patch we alter the
state translation table so that it is impossible ever to wait for
Type=idle unit, hence removing the deadlock.
2012-05-24 02:22:35 +02:00
Lennart Poettering 66b1a24790 man: properly document FsckPassNo= for mount units 2012-05-23 04:11:29 +02:00
Lennart Poettering 07719a21b6 manager: rework generator logic
Previously generated units were always placed at the end of the search
path. With this change there will be three unit dirs instead of one, to
place generated entries at the beginning, in the middle and at the end
of the search path:

beginning: for units that need to override all configuration, regardless
of user or vendor. Example use: system-update-generator uses this to
temporarily redirect default.target.

middle: for units that need to override vendor configuration, but not
vendor configuration. Example use: /etc/fstab should override vendor
supplied configuration (think /tmp), but should not override native user
configuration.

end: does not override anything but is available as well. Possible usage
might be to convert D-Bus bus service files to native units but allowing
vendor supplied native units to win.
2012-05-23 03:43:29 +02:00
Lennart Poettering 1b64d026af units: remove service sysv_path variable and replace it by generic unit_path
UnitPath= is also writable via native units and may be used by generators
to clarify from which file a unit is generated. This patch also hooks up
the cryptsetup and fstab generators to set UnitPath= accordingly.
2012-05-22 23:08:24 +02:00
Lennart Poettering 399c5f9633 mount: drop unused function 2012-05-22 19:50:10 +02:00
Lennart Poettering e6a2674500 execute: use a much lower idle timeout that default time
The idle timeout after all is for cosmetics only, hence avoid any
substantial delays just for it.
2012-05-22 19:26:15 +02:00
Lennart Poettering 6b1dc2bd3c mount: replace PID1 internal fstab parser with generator
Bit by bit we should remove non-unit parsing from PID 1 and move into
generators, to clean up our code base a bit and clearly separate
parsers.
2012-05-22 19:25:17 +02:00
Kay Sievers 745e2fb79a main: only fall back to /bin/sh in case /sbin/init does not exist 2012-05-22 19:17:40 +02:00
Harald Hoyer b46178e5c2 switch-root: do not use close old_root_fd after rm_rf_children()
rm_rf_children() has already closed the fd with closedir().
2012-05-22 16:15:09 +02:00
Lennart Poettering bf4df7c3b6 main: properly queue default.target after switched root
This also introduces rd.systemd.unit= to specify the unit to boot into
in the initrd.
2012-05-22 13:22:00 +02:00
Lennart Poettering 92a39ae198 mount: use the same fstab extension option syntax everywhere
The man page and the actual code differed, and this is now corrected
2012-05-22 02:00:53 +02:00
David Ward 2e9d6c1251 service: fix auto-restart handling in service_start()
Do not bypass the SERVICE_DEAD/SERVICE_FAILED state by manually issuing
a start job while an automatic restart is pending.
2012-05-22 01:57:21 +02:00
David Ward f0c7b229e1 service: fix auto-restart handling in service_stop()
When service_stop() handles a service in the SERVICE_AUTO_RESTART state,
it calls service_set_state() to transition it to the SERVICE_DEAD state.
However if the service failed, it should transition it to SERVICE_FAILED
instead, which will trigger its OnFailure units. To achieve this, we now
call service_enter_dead() in place of service_set_state(), which will
transition the service to either SERVICE_DEAD or SERVICE_FAILED as is
appropriate.

Also, some misleading comments are adjusted: service_stop() is not only
called on a user request, but also during an automatic restart in order
to handle dependencies.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=45511
2012-05-22 01:55:52 +02:00
David Ward feae8adb84 service: actually delay auto-restart if another job is pending
https://bugs.freedesktop.org/show_bug.cgi?id=45511
2012-05-22 01:53:30 +02:00
Frederic Crozat c93ff2e913 main: allow system wide limits for services 2012-05-21 21:13:27 +02:00
Lennart Poettering 2660882b52 main: rename a few fix to follow general naming style 2012-05-21 19:48:04 +02:00
Lennart Poettering 416693175b switch-root: move switch_root() call into its own .c file 2012-05-21 19:33:39 +02:00