Commit Graph

360 Commits

Author SHA1 Message Date
Michal Schmidt 735e071271 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.
2012-12-07 18:55:19 +01:00
Michal Schmidt bce93b7ac7 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).
2012-12-07 17:44:50 +01:00
Michal Schmidt c678406681 umount: fix check for DM changed
delete_dm() returns 0 on success. The check for "r > 0" was likely
a copy&paste error from the loopback code where "r > 0" makes sense.
2012-12-07 17:34:21 +01:00
Michal Schmidt 2569a5ce16 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.
2012-12-07 17:28:30 +01:00
Zbigniew Jędrzejewski-Szmek 20ad4cfd8e core: add catalog entry and MESSAGE_ID for overmounting 2012-12-05 12:25:50 +01:00
Hermann Gausterer 5a6f9d2330 shutdown: fix typo 2012-11-28 21:22:39 +01:00
Tom Gundersen 140883405e shutdown: don't consider umounting of / and /usr failed
In the words of Homer: If you don't try, you can't fail.

This is a revert of 9279749b84.

It used to be necessary to consider the umounting failed to make sure /
and /usr were remounted read-only, but that is no longer necessary as
everything is now remounted read-only anyway.

Moreover, this avoids a warning at shutdown saying a filesystem was not
unmounted. As the umounting of / is never attempted there was no
corresponding warning message saying which fs that failed. This caused some
spurious bug-reports from concerned users.

Cc: Michael Biebl <biebl@debian.org>
2012-11-28 18:26:35 +01:00
Tom Gundersen 02eaa78835 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.
2012-11-28 18:26:35 +01:00
Lennart Poettering 8a3a1704c7 manager: fix build on 32bit systems 2012-11-25 19:46:16 +01:00
Lennart Poettering 8742514c1a timer: recalculate next elapse for calendar timer units when the system clock is changed 2012-11-25 00:33:59 +01:00
Lennart Poettering 0979f2855c build-sys: drop TARGET_UBUNTU
TARGET_UBUNTU is effectively the same as TARGET_DEBIAN. Given the Ubuntu
is unlikely to use systemd anytime soon there's no point in keeping this
separate.
2012-11-24 00:24:46 +01:00
Lennart Poettering 36697dc019 timer: implement calendar time events 2012-11-23 21:37:58 +01:00
Lennart Poettering 39d99a0793 locale: modernizations 2012-11-22 01:00:26 +01:00
Lennart Poettering e42e801b55 dbus: introduce _cleanup_dbus_error_free_ 2012-11-22 00:45:22 +01:00
Lennart Poettering 68b29a9fca manager: introduce watch_init() initializer for watches 2012-11-22 00:45:22 +01:00
Lennart Poettering 0b2665c33d automount: modernizations 2012-11-22 00:45:22 +01:00
Henrik Grindal Bakken cf37cd2f30 Add #ifdef guards around xattr usage
This adds #ifdef HAVE_ATTR_XATTR_H guards around all usage of xattr.
This unbreaks building with --disable-xattr when <attr/xattr.h> doesn't exist.
<attr/xattr.h> and usage of fsetxattr() without
2012-11-21 10:49:58 +01:00
Tom Gundersen e30431623a build-sys: make loadable module support optional
kmod is unecessary if loadable module support is disabled in the kernel,
so make the dependency optional.
2012-11-20 19:35:27 +01:00
Lennart Poettering 10f70492ae socket: improve error message when we cannot spawn the socket's service unit 2012-11-20 00:21:44 +01:00
Zbigniew Jędrzejewski-Szmek ac97e2c559 core/load-fragment: fix (potential) bad memory access
strncmp() could be used with size bigger then the size of the string,
because MAX was used instead of MIN.

If failing, print just the offending mount flag.
2012-11-19 17:13:37 +01:00
Zbigniew Jędrzejewski-Szmek c040936be2 core/load-fragment: be more precise in error messages
Whenever a message fails, mention the offending word, instead
of just giving the whole line. If one bad word causes just this
word to be rejected, print only the word. If one bad word causes
the whole line to be rejected, print the whole line too.

https://bugs.freedesktop.org/show_bug.cgi?id=56874
2012-11-19 17:13:05 +01:00
Zbigniew Jędrzejewski-Szmek 0a496c9836 rpm: udevadm is actually in bindir 2012-11-16 23:29:56 +01:00
Lennart Poettering 1b0fcd7411 rpm: update RPM macros to include definitions for more drop-in directories and for reloading/rebuilding configuration
More specifically this adds a number of macros that resolve to
directories for udev rules, hwdb entries, tmpfiles and sysctl.

Thsi also includes three new macros for rebuilding the hwbd/catalog
index when a package drops in new files
2012-11-16 20:07:14 +01:00
Lennart Poettering 3cdebc217c service: drop support for SysV scripts for the early boot
This remove distro-specific support for early-boot SysV init scripts.
(And leaves support for normal SysV scripts untouched).

If distributions wish to continue to allow early-boot SysV scripts in
their distribution-specific way they should either maintain this patch
downstream manually, or write a generator for them, or simply ship all
those scripts with a .service wrapper.
2012-11-16 18:46:36 +01:00
Lennart Poettering 93bd157722 umount: always remount read-only before unmounting in final shutdown loop 2012-11-16 18:36:28 +01:00
Lennart Poettering 891a4918ef switch-root: try pivot_root() before overmounting /
We should always try to umount the old root dir if possible, instead of
overmounting it -- if that's possible.

The initial ("first") kernel rootfs can never be umounted, hence
for the usual nitrd case we never bothered using pivot_root() and
hence with fully unmounting it. However, fedup now tranisitions twice
during boot, and in that case it is highly desirable that the "second"
root dir is entirely unmounted when we switch to the "third". This patch
makes that possible.

The pivot_root() needs a directory in the "third" root dir, to move the
"second" root dir to. We use /mnt for that, under the assumption that
this directory is likely to exist, and is not itself a mount point.
2012-11-16 18:21:09 +01:00
Lennart Poettering 0049f05a8b 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.
2012-11-16 01:35:11 +01:00
Zbigniew Jędrzejewski-Szmek f72daa64dc dbus-manager: modernize style 2012-11-15 16:30:24 +01:00
Eelco Dolstra 645a9e5a2b dbus-manager: fix a fatal dbus abort in bus_manager_message_handler()
If ListUnitFiles fails, or an OOM occurs, then dbus_message_unref()
will be called twice on "reply", causing systemd to crash.  So remove
the call to dbus_message_unref(); it is unnecessary because of
the cleanup attribute on "reply".

[zj: modified to leave one dbus_message_unref() alone, per Colin
Walters' comment.]
2012-11-15 16:29:53 +01:00
Holger Hans Peter Freyther bb11271068 sched: Only setting CPUSchedulingPriority=rr doesn't work
A service that only sets the scheduling policy to round-robin
fails to be started. This is because the cpu_sched_priority is
initialized to 0 and is not adjusted when the policy is changed.

Clamp the cpu_sched_priority when the scheduler policy is set. Use
the current policy to validate the new priority.

Change the manual page to state that the given range only applies
to the real-time scheduling policies.

Add a testcase that verifies this change:

$ make test-sched-prio; ./test-sched-prio
[test/sched_idle_bad.service:6] CPU scheduling priority is out of range, ignoring: 1
[test/sched_rr_bad.service:7] CPU scheduling priority is out of range, ignoring: 0
[test/sched_rr_bad.service:8] CPU scheduling priority is out of range, ignoring: 100
2012-11-15 16:16:45 +01:00
Zbigniew Jędrzejewski-Szmek 0f67f1efae core: lift restriction on order of - and @ in ExecStart 2012-11-15 16:01:22 +01:00
Oleksii Shevchuk 7e1a84f552 core: interpret \; token in ExecStart as escaped ;
Some commands (like 'find') take a semicolon as separate arg. With
current parser implementation there is no way to pass one.

Patch adds token \;
2012-11-15 16:01:10 +01:00
Oleksii Shevchuk a66f3bea8b core/load-fragment-gperf: add missing CONDITION_FILE_NOT_EMPTY
Unit files couldn't be properly parsed, because of
absent ConditionFileNotEmpty in load-fragment table.
2012-11-15 16:00:03 +01:00
Oleksii Shevchuk 774de5a97f core: fix %h, %s, %p handling in templates in user session 2012-11-15 15:59:50 +01:00
Olivier Brunel f09a7d2554 systemd: highlight ordering cycle deletions
Having unit(s) removed/not started, even if it solved the issue and allowed
to boot successfully, should still be considered an error, as something
clearly isn't right.

This patch elevates the log message from warning to error, and adds a status
message to make things more obvious.
2012-11-15 15:59:39 +01:00
Dave Reisner e4f44e734c Revert "Implement SocketUser= and SocketGroup= for [Socket]"
This was never intended to be pushed.

This reverts commit aea54018a5.
2012-11-06 09:54:17 -05:00
Dave Reisner aea54018a5 Implement SocketUser= and SocketGroup= for [Socket]
Since we already allow defining the mode of AF_UNIX sockets and FIFO, it
makes sense to also allow specific user/group ownership of the socket
file for restricting access.
2012-11-05 21:17:55 -05:00
Kay Sievers 6aa220e019 mount-setup: try mounting 'efivarfs' only if the system bootet with EFI 2012-11-04 17:03:48 +01:00
Kay Sievers 3dfb265083 kmod-setup: mounting efivarfs, *after* we tried to mount it, is pointless
The mount() system call, which we issue before loading modules, will trigger
a modprobe by the kernel and block until it returns. Trying to load it again
later, will have exactly the same result as the first time.
2012-11-04 17:00:57 +01:00
Kay Sievers 1022373284 kmod-setup: add conditional module loading callback 2012-11-04 16:54:19 +01:00
Dave Reisner 075ff6863d drop Arch Linux support for reading /etc/rc.conf 2012-11-03 20:11:52 -04:00
Dave Reisner 53d05b44f1 drop Arch Linux support for reading /etc/rc.conf 2012-11-03 19:59:42 -04:00
Lennart Poettering 669b04a492 service: drop special HTTP server target, as it is a bad idea anf Fedora specific
This was premarily intended to support the LSB facility $httpd which is
only known by Fedora, and a bad idea since it lacks any real-life
usecase.

Similar, drop support for some other old Fedora-specific facilities.

Also, document the rules for introduction of new facilities, to clarify
the situation for the future.
2012-10-31 02:55:04 +01:00
Michal Schmidt f8b69d1dfc shared, core: do not always accept numbers in string lookups
The behaviour of the common name##_from_string conversion is surprising.
It accepts not only the strings from name##_table but also any number
that falls within the range of the table. The order of items in most of
our tables is an internal affair. It should not be visible to the user.

I know of a case where the surprising numeric conversion leads to a crash.

We will allow the direct numeric conversion only for the tables where the
mapping of strings to numeric values has an external meaning. This holds
for the following lookup tables:
 - netlink_family, ioprio_class, ip_tos, sched_policy - their numeric
   values are stable as they are defined by the Linux kernel interface.
 - log_level, log_facility_unshifted - the well-known syslog interface.

We allow the user to use numeric values whose string names systemd does
not know. For instance, the user may want to test a new kernel featuring
a scheduling policy that did not exist when his systemd version was
released. A slightly unpleasant effect of this is that the
name##_to_string conversion cannot return pointers to constant strings
anymore. The strings have to be allocated on demand and freed by the
caller.
2012-10-30 15:41:15 +01:00
Auke Kok 0eb59ccfe6 SMACK: Add configuration options. (v3)
This adds SMACK label configuration options to socket units.

SMACK labels should be applied to most objects on disk well before
execution time, but two items remain that are generated dynamically
at run time that require SMACK labels to be set in order to enforce
MAC on all objects.

Files on disk can be labelled using package management.

For device nodes, simple udev rules are sufficient to add SMACK labels
at boot/insertion time.

Sockets can be created at run time and systemd does just that for
several services. In order to protect FIFO's and UNIX domain sockets,
we must instruct systemd to apply SMACK labels at runtime.

This patch adds the following options:

Smack - applicable to FIFO's.
SmackIpIn/SmackIpOut - applicable to sockets.

No external dependencies are required to support SMACK, as setting
the labels is done using fsetxattr(). The labels can be set on a
kernel that does not have SMACK enabled either, so there is no need
to #ifdef any of this code out.

For more information about SMACK, please see Documentation/Smack.txt
in the kernel source code.

v3 of this patch changes the config options to be CamelCased.
2012-10-30 03:40:42 +01:00
Lee, Chun-Yi f271dd9762 systemd: mount the EFI variable filesystem
Add efivarfs to the mount_table in mount-setup.c, so the EFI variable
filesystem will be mounted when systemd executed.

The EFI variable filesystem will merge in v3.7 or v3.8 linux kernel.

Cc: Kay Sievers <kay@vrfy.org>
Cc: Lennart Poettering <lennart@poettering.net>
Cc: Mantas Mikulėnas <grawity@gmail.com>
Cc: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
Cc: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
2012-10-30 03:40:42 +01:00
Olivier Brunel b61e88162a swap: fix swap behaviour with symlinks
Starting a swap unit pointing to (What) a symlink (e.g. /dev/mapper/swap
or /dev/disk/by-uuid/...) would have said unit marked active, following
the one using the "actual" device (/dev/{dm-1,sda3}), but that new unit
would be seen as inactive.
Since all requests to stop swap units would follow/redirect to it,
and it is seen inactive, nothing would be done (swapoff never called).

This is because this unit would be treated twice in
swap_process_new_swap, the second call to swap_add_one causing it to
eventually be marked inactive.
2012-10-29 09:04:25 +00:00
Zbigniew Jędrzejewski-Szmek 646134dc0d swap: modernize style 2012-10-29 09:03:56 +00:00
Zbigniew Jędrzejewski-Szmek 170ca19e4d swap: use automatic cleanup 2012-10-29 09:01:20 +00:00
Zbigniew Jędrzejewski-Szmek df326b8463 swap: introduce helper variable
Just for readability, no funcational change.
2012-10-29 09:00:56 +00:00