1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
Commit Graph

1999 Commits

Author SHA1 Message Date
Kay Sievers
681cfc6c40 hostnamed, localed: move config files to subdir 2011-12-31 07:23:57 +01:00
Kay Sievers
00c36f274b hostnamed: move sources to subdirectory 2011-12-31 07:03:33 +01:00
Kay Sievers
1822350db1 localed: move sources to subdirectory 2011-12-31 06:50:34 +01:00
Kay Sievers
4668191d02 timedated: move sources to subdirectory 2011-12-31 06:40:48 +01:00
Kay Sievers
6c8a39b883 journal: silence gcc warnings 2011-12-31 03:55:35 +01:00
Lennart Poettering
c0f99c21f4 util: fix warning 2011-12-31 03:35:45 +01:00
Lennart Poettering
e81e801af6 journal: move symver file into subdirectory 2011-12-31 03:35:38 +01:00
Lennart Poettering
4deba28559 logind: move more files into subdirectory 2011-12-31 03:24:31 +01:00
Lennart Poettering
4bba9156da logind: move logind into its own subdirectory 2011-12-31 03:16:08 +01:00
Lennart Poettering
babfc09177 journal: automatically deduce journal metrics from file system sizes 2011-12-31 02:31:54 +01:00
Lennart Poettering
3a22a969c5 kmsg: drop unused variable 2011-12-31 01:08:06 +01:00
Lennart Poettering
271b032a05 socket: rename the PassCred= option to PassCredentials=, since we don't want to needlessly abbreviate options unless they are very well established 2011-12-31 01:07:49 +01:00
Lennart Poettering
dc1ecd78e9 Merge branch 'journal' 2011-12-31 00:59:37 +01:00
Lennart Poettering
74ef2d16ad journal: move max_use into metrics structure 2011-12-31 00:57:14 +01:00
Lennart Poettering
b3a0ad5ab1 journal: disable default debug logging 2011-12-30 22:29:23 +01:00
Lennart Poettering
783d2675ef journal: fix a few bad memory accesses and leaks 2011-12-30 22:16:04 +01:00
Lennart Poettering
8b18eb674c journald: forward all syslog messages to syslogd 2011-12-30 19:05:43 +01:00
Lennart Poettering
4b2d99d9f4 journal: add unit files and shared library glue 2011-12-30 17:50:37 +01:00
Lennart Poettering
f39e126e99 journald: add missing header 2011-12-30 16:01:33 +01:00
Lennart Poettering
adb2ce5f69 remount-api-vfs: handle another OOM condition 2011-12-30 15:34:21 +01:00
Lennart Poettering
54a7b863dd journald: don't recheck /var availability more often than 30s 2011-12-29 15:25:42 +01:00
Lennart Poettering
cf244689e9 journald: flush /run to /var as soon as it becomes available 2011-12-29 15:00:57 +01:00
Lennart Poettering
de97b26ac5 journald: increase rate limit burst rate 2011-12-29 15:00:05 +01:00
Lennart Poettering
2a59ea54f1 journal: never mmap beyond file size 2011-12-28 01:53:06 +01:00
Lennart Poettering
9cfb57c989 journald: when checking available disk space for rate limiting, cache the results temporarily 2011-12-27 23:18:09 +01:00
Lennart Poettering
85a131e8d8 journal: fix hash table lookup logic 2011-12-27 22:58:20 +01:00
Lennart Poettering
24b51289e3 journal: fix typo 2011-12-27 22:52:22 +01:00
Lennart Poettering
3306729574 udev: exclude loopback device from udev rule based sysctl application, since we can just apply that directly at boot 2011-12-27 22:52:15 +01:00
Lennart Poettering
6e409ce10d journald: implement sophisticated rate limiting 2011-12-27 22:51:46 +01:00
Lennart Poettering
fe6521272b journal: implement stdout transport 2011-12-23 20:50:48 +01:00
Lennart Poettering
6ad1d1c306 journald: enforce some syntax restrictions on field names sent from the client side 2011-12-22 00:35:04 +01:00
Lennart Poettering
440ee3665e journal: properly handle first inline bisect array entry 2011-12-21 22:32:52 +01:00
Lennart Poettering
e4e61fdbed journal: add missing compress.[ch] 2011-12-21 19:00:10 +01:00
Lennart Poettering
0d43c6944b journalctl: add command line parsing 2011-12-21 18:59:56 +01:00
Lennart Poettering
72f597065c journalctl: add json, export, short and verbose output modes 2011-12-21 18:17:22 +01:00
Lennart Poettering
807e17f05e journal: add inline compression support with XZ 2011-12-21 02:40:59 +01:00
Lennart Poettering
bc85bfee87 journal: fix space reservation limit enforcement 2011-12-20 02:38:36 +01:00
Lennart Poettering
466ccd92e2 journal: fix matches 2011-12-20 00:38:14 +01:00
Michal Schmidt
8f7f7a1bd3 log: never block on syslog in PID 1
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.
2011-12-20 00:23:51 +01:00
Michal Schmidt
9721b19968 dbus: no sync D-Bus connection flushing
Blocking on D-Bus in a system manager could lead to deadlock.
2011-12-20 00:23:51 +01:00
Michal Schmidt
cbd37330bc dbus: register to DBus asynchronously
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.
2011-12-20 00:17:14 +01:00
Dan Walsh
81c3f1f6ab label: fix labeling of symbolic links 2011-12-19 23:58:58 +01:00
Lennart Poettering
50f20cfdb0 journal: implement inotify-based live logging logic 2011-12-19 22:35:46 +01:00
Lennart Poettering
2e4a6ff47b hashmap: add hashmap_first_key() 2011-12-19 19:54:51 +01:00
Lennart Poettering
2b0ba69bb1 journald: filter fields send from client starting with underscore 2011-12-17 01:36:47 +01:00
Michal Schmidt
0b1f4ae635 execute: fix losing of start timestamps
Start timestamps were always cleared before saving exit timestamps.
Fix it by removing a condition that makes no sense any way I look at it.
2011-12-17 01:33:40 +01:00
Lennart Poettering
d0bbc21caa journal: introduce mandatory sd_journal_printf() priority parameter 2011-12-17 01:32:49 +01:00
Lennart Poettering
cab8ac6083 journal: enforce limits on open journal files 2011-12-17 01:13:55 +01:00
Lennart Poettering
7f3e62571a journal: add native protocol to journald, and client side API to send journal messages 2011-12-17 00:56:34 +01:00
Michal Schmidt
777b87e702 tmpfiles: add 'z', like 'Z' but not recursive 2011-12-16 18:27:35 +01:00
Michal Schmidt
062e01bbdb tmpfiles: apply chown, chmod for 'Z' entries too
If changing ownership or permissions is not desired, they can be
configured to '-' or omitted entirely.
2011-12-16 18:04:54 +01:00
Michal Schmidt
18d01523c8 service: use 'syslog+console' for sysv_console
The default output to 'tty' for SysV service was making it hard to debug
problems because error messages were missing from syslog.
2011-12-16 17:40:41 +01:00
Michal Schmidt
a8d8878329 tmpfiles: add RECURSIVE_RELABEL_PATH ('Z')
Feature requested by Dan Walsh.
2011-12-16 00:31:21 +01:00
Michal Schmidt
99e68c0b2d tmpfiles: separate a generic item glob processing function
Item glob processing will be useful for more than just removing.
2011-12-15 23:58:55 +01:00
Michal Schmidt
f05bc3f7f1 tmpfiles: use a common function to set owner/group/mode/label 2011-12-15 23:56:58 +01:00
Michal Schmidt
a08961233b tmpfiles: rename a couple of functions
remove_item -> remove_item_instance
remove_item_glob -> remove_item
2011-12-15 23:09:08 +01:00
Michal Schmidt
66ccd0387e tmpfiles: use an enum instead of plain char for item type
For better safety. gcc can warn about missing values in switch statements.
2011-12-15 23:09:08 +01:00
Michal Schmidt
c971700e41 systemctl: fix typo in 'is-enabled'
It prevented the action from working without dbus.
2011-12-15 21:03:02 +01:00
Gregs Gregs
b911442003 fsck: Fix typo in comment 2011-12-15 18:48:15 +01:00
Michal Schmidt
ce9593140b pam-module: add a couple of debugging prints 2011-12-14 01:25:47 +01:00
Michal Schmidt
cd0504d0a1 unit: check for unneeded dependencies even when unit stop was expected
systemd did not stop units marked as "StopWhenUnneeded=yes" when the requiring
unit was stopped on user's request.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=704197
2011-12-09 15:25:29 +01:00
Michal Schmidt
f60c2665f9 unit: fix false positive in check for unneeded unit
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.
2011-12-09 15:24:04 +01:00
Michal Schmidt
714d943f72 path: add missing pieces for PathModified
PATH_MODIFIED worked internally for PID files detection, but was unusable
in units.
2011-12-08 18:45:38 +01:00
Michal Schmidt
f7b9e331ed systemctl: print 'error' load state in red
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.
2011-12-06 01:30:16 +01:00
Michal Schmidt
9a46fc3b90 unit: garbage collect units with load 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
2011-12-06 00:52:37 +01:00
Bill Nottingham
d380a3bcd1 Allow 'list-unit-files' to run with --root.
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.
2011-12-05 22:04:42 +01:00
Michal Schmidt
2096e009a7 service: stop the service if ExecStartPost ends with a failure
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 "-".
2011-12-03 23:10:12 +01:00
Michal Schmidt
3a11183858 service: handle services with racy daemonization gracefully
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.
2011-12-03 21:50:27 +01:00
Michal Schmidt
e92238567b path: add PathModified (= PathChanged + IN_MODIFY) 2011-12-03 13:58:21 +01:00
Michal Schmidt
4b562198c7 path: refactor PathSpec usage
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.
2011-12-03 13:43:58 +01:00
Michal Schmidt
768147d13d path: use %m instead of strerror(errno)
and strerror(-errno) was just wrong.
2011-12-03 02:08:52 +01:00
Michal Schmidt
35d50f55f3 util: fix error checking after fgets()
fgets() does not set errno on EOF.
2011-12-03 02:08:52 +01:00
Michal Schmidt
1567308317 add a generator to pull rc-local.service in
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.
2011-12-02 11:29:48 +01:00
Michal Schmidt
1a2801529e syslog: use PassCred=yes for the /dev/log socket
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.
2011-11-30 11:00:28 +01:00
Michal Schmidt
75d3fc60f8 shutdownd: use PassCred=yes in the socket unit
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
2011-11-30 10:12:59 +01:00
Michal Schmidt
d68af58657 socket: add option for SO_PASSCRED
Add an option to enable SO_PASSCRED for unix sockets.
2011-11-30 09:52:34 +01:00
Michal Schmidt
f6cebb3bd5 let mount and swap units log to the configured defaults
Related-to: https://bugzilla.redhat.com/show_bug.cgi?id=750032
2011-11-19 03:16:55 +01:00
Michal Schmidt
1a4459d633 pam-module: treat "cron" in PAM_TTY as empty tty
cron sets PAM_TTY to "cron" and it has been doing it for a long time.
It cannot be changed because user configurations may depend on it.

https://bugzilla.redhat.com/show_bug.cgi?id=727315
2011-11-19 01:17:53 +01:00
Michal Schmidt
1dc9953709 pam-module: use the correct session type "unspecified"
logind does not understand "other".
2011-11-19 01:14:11 +01:00
Michal Schmidt
4c2630ebf2 execute: log errors from "sd(EXEC)"
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
2011-11-17 01:36:11 +01:00
Michal Schmidt
9ba353983a execute: make setup_pam() return -errno when possible
The only caller currently checks if the result is non-zero,
so nothing changes there.
2011-11-17 00:16:22 +01:00
Michal Schmidt
4d8a7798e7 execute: avoid logging to closed fds
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.
2011-11-16 23:52:10 +01:00
Thomas Jarosch
085c98af4e Fix same expression on both sides of '&&'
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>
2011-11-14 18:08:27 +01:00
Michal Schmidt
5831e9b726 job: colored status messages on boot
The lack or green/red status marks on boot has been described by some
users as "critical", "dramatic", "dealbreaker", "showstopper". Seriously.
2011-11-11 00:27:02 +01:00
Michal Schmidt
c5419d4239 service: don't warn if the pidfile still exists after SIGCHLD
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
2011-11-10 10:18:08 +01:00
Lennart Poettering
1e2579fdeb Merge branch 'master' into journal 2011-11-08 19:44:16 +01:00
Lennart Poettering
de190aef08 journal: implement multiple field matches 2011-11-08 18:20:03 +01:00
Lennart Poettering
9b3c575ed9 macro: fix ALIGN_TO macro definition 2011-11-08 18:18:48 +01:00
Michal Schmidt
4743137a4b utmp: for DEAD_PROCESS write the current time to wtmp
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
2011-11-07 01:10:35 +01:00
Michal Schmidt
fa4ad7ceca utmp: initialize store with the found entry, not with the lookup key 2011-11-07 01:10:35 +01:00
Michal Schmidt
b8e47420b3 utmp: no need to zero a struct before overwriting it with memcpy 2011-11-07 01:10:34 +01:00
Michal Schmidt
0ad26e09de utmp: remove unneded parameters
With these functions no caller ever passes anything else than 0
for 't' (meaning the current time will be used).
2011-11-07 01:09:53 +01:00
Lennart Poettering
353fa6a21a cgroup: immediately remove all cgroups which run empty
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.
2011-11-03 19:42:53 +01:00
Lennart Poettering
263653e103 Merge remote-tracking branch 'zbigniew/systemadm_changes' 2011-11-02 14:08:49 +01:00
Ran Benita
f5a613c03c bash-completion: rename file since it is no longer for systemctl only 2011-11-02 13:07:47 +01:00
Ran Benita
3cdbf916d3 bash-completion: add completions for systemd-loginctl
This script is straightforward and should give proper completions for
all of systemd-loginctl's verbs.
2011-11-02 13:07:43 +01:00
Ran Benita
8aea83c718 bash-completion: update with new verbs and arguments
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.
2011-11-02 13:07:36 +01:00
Dexter Morgan
6fdae8a6a4 Add Mageia support
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.
2011-11-02 02:16:39 +01:00
Tom Gundersen
87e75fddbb cryptsetup-generator: avoid ordering cycle on swap
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).
2011-11-01 23:42:41 +01:00
Lennart Poettering
7fc2a89a73 mount: order remote mounts after both network.target and remote-fs-pre.target
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
2011-11-01 22:28:59 +01:00
Lennart Poettering
6ddaf1ca4a cgroup: always recreate cgroup before we try to apply attributes
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
2011-11-01 22:02:36 +01:00
Lennart Poettering
f632a6634d initctl: don't use dbus connection after PID 1 got respawned
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.
2011-11-01 18:21:32 +01:00
Thomas Jarosch
7670e5a2aa condition: Fix file descriptor leak in test_capability()
Detected by cppcheck.
2011-11-01 17:02:32 +01:00
Tom Gundersen
7c2ec00930 random-seed: convert poolsize from bits to bytes
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>
2011-11-01 14:45:52 +01:00
Lennart Poettering
bb53abeb8c plymouth: fix ply proto endianess issues
Plymouth enforces LE even for the local Ply proto, hence we should do
the conversion properly for BE arch compat.

Tracked down by Harald Hoyer.

https://bugzilla.redhat.com/show_bug.cgi?id=744415
2011-11-01 14:20:31 +01:00
Zbigniew Jędrzejewski-Szmek
1c0a113fd3 systemctl: make list-unit-files output more economical
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 ]
2011-10-24 19:40:05 +02:00
Dave Reisner
74eeab044e systemctl-completion: always invoke with --no-legend
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.
2011-10-19 08:14:13 +02:00
Jonathan Nieder
5a8d081c58 audit: do not complain if kernel lacks audit
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.
2011-10-17 21:04:59 +02:00
Tollef Fog Heen
e51db373c2 service: Drop rcN.d runlevels from SysV services that also exist in rcS.d
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
2011-10-17 21:02:42 +02:00
Michal Schmidt
563ba9ea6e manager: fix a crash in isolating
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
2011-10-17 11:29:27 +02:00
Lennart Poettering
8f9b6cd9eb journal: automaticall reset location when the set of matches changes 2011-10-15 02:53:04 +02:00
Lennart Poettering
8725d60ae4 journal: implement seek to head/tail 2011-10-15 02:45:58 +02:00
Lennart Poettering
e892bd1797 journal: unify code for up and for down traversal 2011-10-15 01:38:44 +02:00
Lennart Poettering
de7b95cdc3 journal: properly implement matching with multiple matches 2011-10-15 01:13:37 +02:00
Lennart Poettering
1cc101f1e5 journal: if two entries match with everything but seqnums, they are still identical 2011-10-14 16:52:42 +02:00
Lennart Poettering
7210bfb370 journal: move field index from file into journal object 2011-10-14 05:38:40 +02:00
Lennart Poettering
ae2cc8efc1 journal: when the same entry is in two files, skip over them in sync 2011-10-14 05:34:19 +02:00
Lennart Poettering
c2373f848d journal: synchronize seqnum across files 2011-10-14 05:12:58 +02:00
Lennart Poettering
161e54f871 journal: fix field retrieval by name 2011-10-14 04:52:56 +02:00
Lennart Poettering
3fbf9cbb02 journal: implement parallel file traversal 2011-10-14 04:44:50 +02:00
Lennart Poettering
0ac38b7072 journal: implementation rotation 2011-10-13 05:19:35 +02:00
Lennart Poettering
250d54b5be journalctl: find journal files in right path 2011-10-12 05:29:08 +02:00
Lennart Poettering
69e5d42db0 journal: add cgroup path to entries 2011-10-12 05:28:39 +02:00
Lennart Poettering
ed49ef3f34 journal: place machin journals in machine specific subdirectories 2011-10-12 05:06:09 +02:00
Lennart Poettering
7c99e0c1fc util: fix build 2011-10-12 04:42:38 +02:00
Lennart Poettering
38ac38b298 journal: only fallocate() what we really need to avoid slowness on file systems which do not support fallocate natively 2011-10-12 04:41:27 +02:00
Lennart Poettering
689b9a22f7 Merge branch 'master' into journal 2011-10-12 04:29:11 +02:00
Lennart Poettering
64685e0cea util: properly detect what the last capability is 2011-10-11 22:30:31 +02:00
Lennart Poettering
1835f23c2a service: don't try to guess PID for SysV services anymore
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.
2011-10-11 20:21:06 +02:00
Lennart Poettering
c70ac211b4 localed: make sure s-s-k doesn't create any X11 config files anymore 2011-10-11 20:20:01 +02:00
Zbigniew Jędrzejewski-Szmek
30fa646835 localed: shorten generate-kbd-model-map
Output is identical.
2011-10-11 15:41:38 +02:00
Zbigniew Jędrzejewski-Szmek
adda7d8b97 pager: add _noreturn_ to pager_fallback()
src/pager.c: In function ‘pager_fallback’:
src/pager.c:35:13: warning: function might be possible candidate for attribute ‘noreturn’ [-Wmissing-noreturn]
2011-10-11 15:41:32 +02:00
Lennart Poettering
62590f23c1 unit: introduce ConditionCapability 2011-10-11 15:16:52 +02:00
Lennart Poettering
688c56ff7d logind: fail gracefully if too many sessions are created
https://bugzilla.redhat.com/show_bug.cgi?id=744726
2011-10-11 04:43:01 +02:00
Lennart Poettering
a724d2ed79 timedate: fall back to /etc/sysconfig/clock on Fedora, for compatibility with legacy 2011-10-11 04:23:35 +02:00
Lennart Poettering
21e557edcc units: introduce local-fs-pre.target and remote-fs-pre.target
This hook target enables services to order themselves between
network.target and remote mounts, which is needed for GFS2 and similar
systems.
2011-10-11 03:33:53 +02:00
Dave Reisner
e8fbe35df8 sd-login.h: correct spelling mistakes in comments 2011-10-11 02:51:59 +02:00
Miklos Vajna
b5dc29c079 hostname-setup: Frugalware switched to /etc/hostname 2011-10-11 02:47:35 +02:00
Paolo Bonzini
53273a6aef readahead: lower max file size for readahead
https://bugs.freedesktop.org/show_bug.cgi?id=41336
2011-10-11 01:44:56 +02:00
Thomas Jarosch
678abaf91e util: fix close() call on wrong variable
Detected by "cppcheck" (actually it detected a file descriptor leak)
2011-10-10 22:30:57 +02:00
Thomas Jarosch
10d975f54c tmpfiles: fix file descriptor leak
Detected by "cppcheck"
2011-10-10 22:28:04 +02:00
Kay Sievers
e5396fed3f test_virtualization: do not try to compare id in !virt context 2011-10-09 16:36:45 +02:00
Lennart Poettering
cec736d21f journal: implement parallel traversal in client 2011-10-08 02:21:05 +02:00
Lennart Poettering
f4b4781191 journal: split user logs into their own journal files 2011-10-07 23:03:07 +02:00
Lennart Poettering
260a2be455 journal: replace linked list by hashmap when merging files 2011-10-07 22:02:06 +02:00
Lennart Poettering
dad503169b journal: store XOR combination of entry data object hashes to identify hash lines 2011-10-07 22:02:06 +02:00
Lennart Poettering
87d2c1ff6a journal: add preliminary incomplete implementation 2011-10-07 22:02:05 +02:00
Lennart Poettering
7dfe96eebc hashmap: use different version of DJB's hash algorithm that uses shifting instead of multiplication 2011-10-07 21:00:48 +02:00
Lennart Poettering
3887b5abcb logind: properly generate session creation response on dbus
This fixes the various reported issues with dbus message parsing when
running su.
2011-10-04 02:28:22 +02:00
Michal Schmidt
798e258d30 systemctl: fix corrupted output of units
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.
2011-09-29 21:25:50 +02:00
Lennart Poettering
a0ccd2acab localed: handle multiple X11 kbd layouts
https://bugs.freedesktop.org/show_bug.cgi?id=41341
2011-09-29 19:44:34 +02:00
Lennart Poettering
f176b5c296 systemctl: fix error message when no connection to systemd is available 2011-09-29 16:00:29 +02:00
Lennart Poettering
8185a5090a systemctl: fix detection whether the dbus connection is available 2011-09-29 15:32:10 +02:00
Lennart Poettering
e99fa3cba5 vconsole: don't parse Fedora's KEYMAP= kernel parameters anymore
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.
2011-09-28 04:34:17 +02:00
Lennart Poettering
fb9de93dd3 localed: add SetX11Keyboard() and SetVConsoleKeyboard() bus calls 2011-09-28 04:34:17 +02:00
Kay Sievers
958ae0d751 analyze: always draw top kernel, initramfs, userspace bars
Based on Koen Kooi's patch. Renamed initrd to initramfs.
2011-09-27 12:57:28 +02:00
Michal Schmidt
4deb3b9391 systemctl: better width and alignment of fields
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'.
2011-09-27 12:10:33 +02:00
Michal Schmidt
ebed32bfe8 systemctl: print the legend regardless of stdout type, add --no-legend
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
2011-09-27 12:10:27 +02:00
Michal Schmidt
4a8e40ebd0 pager: add a trivial internal pager
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
2011-09-27 11:57:24 +02:00
Lennart Poettering
4e2b0f9b14 service: fix up std output/error before we add dependencies to the bridge socket 2011-09-23 17:42:21 +02:00
Lennart Poettering
5dc4c17fd5 virt: add missing header inclusion 2011-09-23 17:20:45 +02:00
Lennart Poettering
8095200d05 condition: optionally test against type of virtualization (vm vs. container) 2011-09-23 17:09:49 +02:00
Lennart Poettering
b52aae1d93 util: move virtualization detection into its own files, and extend return codes 2011-09-23 17:00:33 +02:00
Koen Kooi
f2b33002cd analyze: report startup time in plot mode as well
It now prints something like "Startup finished in 1507ms (kernel) + 850ms (userspace) = 2357ms" below the legend.
2011-09-23 16:28:28 +02:00
Koen Kooi
70daa62332 analyze: always draw 1s marker for scale
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.
2011-09-23 16:28:27 +02:00
Michal Schmidt
a65cb51f29 unit: fix complementing of requirement deps with After deps for targets
'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.
2011-09-23 16:28:27 +02:00
Lennart Poettering
799f46d36f util: don't fail if no id was passed to detect_container() 2011-09-23 16:28:27 +02:00
Lennart Poettering
65bc2c2114 util: detect systemd-nspawn without relying on ns cgroup tree 2011-09-23 16:28:27 +02:00
Lennart Poettering
3bb1c6b04f nspawn: set env var container=systemd-nspawn, following the scheme lxc introduced 2011-09-23 16:28:27 +02:00
Lennart Poettering
d77c31f8f3 loginctl: fix typo 2011-09-23 16:28:27 +02:00
Lennart Poettering
3e085b6c59 llvm-analyze: change a few things to make llvm-analyze show fewer false positives 2011-09-23 16:28:27 +02:00
Lennart Poettering
de3756ab99 llvm-analyze: fix some bugs found by llvm-analyze 2011-09-23 16:28:27 +02:00
Michal Schmidt
4e240ab0c9 util: improve signal_to_string, signal_from_string
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.
2011-09-23 10:30:19 +02:00
Michal Schmidt
764e9b5f07 manager: fix job mode for SIGRTMIN+1, +2
The test did not work as intended and always resulted in JOB_REPLACE.
2011-09-23 10:18:07 +02:00
Michal Schmidt
1f8fef5a44 condition: fix reversed tests if path does not exist at all
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.
2011-09-23 02:10:00 +02:00
Lennart Poettering
f8440af5fe coverity: change a few things so that coverity doesn't show so many false positives 2011-09-23 01:45:34 +02:00
Lennart Poettering
8ea913b2ea coverity: fix a couple of bugs found by coverity 2011-09-23 01:45:34 +02:00
Lennart Poettering
a82e5507a6 unit: don't recheck conditions when a unit is already starting but unit_start() is invoked 2011-09-22 21:32:18 +02:00
Michal Schmidt
5375410bb2 service: warn if a service fails to write its PID file
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.
2011-09-22 13:18:52 +02:00
Lennart Poettering
878587bddd selinux: reopen log when loading the SELinux policy fails 2011-09-22 04:05:40 +02:00
Lennart Poettering
4dfc092a71 service: if StandardInput=socket and StandardOutput=inherit imply socket for output, don't imply default output
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.
2011-09-22 03:29:51 +02:00
Lennart Poettering
a65f4aeb63 udev: asynchronously mount fuse/confifgs as soon as the kmods are loaded 2011-09-22 03:02:15 +02:00
Lennart Poettering
d3354f66c2 mount: pull in quota tools from fstab lines with 'quota' option, too
https://bugzilla.redhat.com/show_bug.cgi?id=736360
2011-09-21 20:19:43 +02:00
Lennart Poettering
57981b9812 job: after converting a job from restart to start readd it to run queue
When we converted a restart job it's time to look again whether any of
its dependencies are now runnable.

https://bugzilla.redhat.com/show_bug.cgi?id=735013
2011-09-21 19:57:27 +02:00
Lennart Poettering
c72dcc5431 modules-load: filter out double modules 2011-09-21 03:56:55 +02:00
Michal Schmidt
13230d5d3c service: minor change in service_load_pid_file return value
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.
2011-09-21 02:25:17 +02:00
Michal Schmidt
0d60602c3b condition: add ConditionPathIsSymbolicLink 2011-09-21 01:42:02 +02:00
Lennart Poettering
8571962ca3 condition: always follow symlinks for condition checks, to mimic test 2011-09-21 01:07:25 +02:00
Michal Schmidt
db01f8b3f8 service: handle forking services that move to a new PID
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.
2011-09-21 00:57:41 +02:00
Lennart Poettering
ab7f148f81 unit: introduce ConditionPathIsMountPoint= 2011-09-21 00:50:40 +02:00
Lennart Poettering
a94e09a5b9 stdout-syslog-bridge: properly handle overly long log lines 2011-09-20 02:46:04 +02:00
Lennart Poettering
00ca7f0782 service: drop broken support for X-Interactive fields in LSB headers
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
2011-09-20 01:33:48 +02:00
Lennart Poettering
34a2dc4bfc condition: in ConditionPathIsExecutable follow symlinks
https://bugzilla.redhat.com/show_bug.cgi?id=737047
2011-09-20 01:28:07 +02:00
Zbigniew Jędrzejewski-Szmek
79b1e6cb80 systemadm: use colors for id too, remove color from fragment link 2011-09-20 01:07:28 +02:00
Zbigniew Jędrzejewski-Szmek
fe7e28146f systemadm: adjust row numbers after removing 'aliases' 2011-09-20 01:07:28 +02:00
Zbigniew Jędrzejewski-Szmek
8f38d5a4c6 systemadm: coalesce id and decription fields
This is just in interest of saving space (e.g. 5 lines for multi-user.target).
2011-09-20 01:07:28 +02:00
Zbigniew Jędrzejewski-Szmek
734b60d796 systemadm: catch exceptions generated by dbus
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 :).
2011-09-20 01:07:28 +02:00
Zbigniew Jędrzejewski-Szmek
37d3b881f1 systemadm: make the dependency listing selectable
There's no reason to forbid selecting the text.
2011-09-20 01:07:28 +02:00
Zbigniew Jędrzejewski-Szmek
8b1451ade7 systemadm: use bold for "requires", etc. 2011-09-20 01:07:28 +02:00
Zbigniew Jędrzejewski-Szmek
23b51f17b1 systemadm: use color for dependency links 2011-09-20 01:07:27 +02:00