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

2090 Commits

Author SHA1 Message Date
Lennart Poettering
731a676c20 systemd: reconnect to syslog as soon as the journal is fully up 2012-01-11 03:16:24 +01:00
Lennart Poettering
3ebcdf8cd9 journalctl: always show monotonic timestamp even if it's from an old boot 2012-01-11 03:02:10 +01:00
Lennart Poettering
4dcc1cb415 unit: implement new PropagateReloadTo=/PropagateReloadFrom= operations 2012-01-11 02:52:34 +01:00
Lennart Poettering
bd1a698180 shutdown: add link to root storage daemon text 2012-01-11 02:52:34 +01:00
Lennart Poettering
8f53a7b8ea service: brutally slaughter processes that are running in the cgroup when we enter START_PRE and START 2012-01-11 02:52:34 +01:00
Lennart Poettering
7e4ab3c5a6 shutdown: exclude processes with argv[0][0] from killing 2012-01-10 05:03:59 +01:00
Lennart Poettering
bf96736674 journalctl: display source timestamp, not journald timestamp, if known 2012-01-07 05:00:28 +01:00
Lennart Poettering
67a122058b journalctl: add new short-monotonic output mode 2012-01-07 04:41:30 +01:00
Lennart Poettering
6c1e6b98bd journald: add kmsg source 2012-01-07 04:10:21 +01:00
Lennart Poettering
aaf53376aa journald: remove inner loop debug message 2012-01-07 04:10:21 +01:00
Kay Sievers
ebd91b34d7 fix compiler warning 2012-01-07 02:12:43 +01:00
Lennart Poettering
e4bac488f9 sd-id128: let's make our API a bit smaller, since sd_id128_make_v4_uuid() is dispensable 2012-01-07 01:37:39 +01:00
Lennart Poettering
39f7f5c108 journalctl: rename --new-id to --new-id128 in order not to introduce yet another new name 2012-01-07 01:37:15 +01:00
Lennart Poettering
dd338f01f5 build-sys: move .pc files next to the matching sources 2012-01-07 01:36:36 +01:00
Lennart Poettering
4ff77f66af load-fragment: fix parsing of Socket= setting 2012-01-07 01:26:08 +01:00
Lennart Poettering
509b6efbbe main: fix spelling 2012-01-07 01:26:08 +01:00
Lennart Poettering
effb1102d3 journald: introduce systemd_journald.forward_to_kmsg=1 (and friends) to enable kmsg forwarding globally via kernel cmdline 2012-01-07 01:26:08 +01:00
Lennart Poettering
98736c68fe journald: shorten the time we wait for a forwarding syslog 2012-01-06 23:11:28 +01:00
Lennart Poettering
57020a3abf unit: properly update references to units which are merged
When we merge units that some kind of object points to, those pointers
might become invalidated, and needs to be updated. Introduce a UnitRef
struct which links up all the unit references, to ensure corrected
references.

At the same time, drop configured_sockets in the Service object, and
replace it by proper UNIT_TRIGGERS resp. UNIT_TRIGGERED_BY dependencies,
which allow us to simplify a lot of code.
2012-01-06 23:08:54 +01:00
Lennart Poettering
73aa0c00df service: add dependencies on configured sockets 2012-01-06 19:23:03 +01:00
Lennart Poettering
4c0bebc335 kmsg-syslogd: remove kmsg-syslogd, since it's entirely obsoleted and replaced by journald 2012-01-06 03:11:17 +01:00
Lennart Poettering
64f5002a3a special: fix name of journal socket unit 2012-01-06 02:48:38 +01:00
Lennart Poettering
706343f492 journal: introduce log target 'journal' for executed processes 2012-01-06 02:48:38 +01:00
Lennart Poettering
db5973704b stdout: remove stdout-syslog-bridge since it is now obsoleted by journald 2012-01-06 02:48:38 +01:00
Michal Schmidt
5c0100a537 util: switch the console to text mode on reset
In case we're taking over the console after a killed X server.

https://bugzilla.redhat.com/show_bug.cgi?id=771563
2012-01-06 01:34:02 +01:00
Michal Schmidt
df465b3f44 util: fix switching to console unicode mode
The KDSKBMODE ioctl wants a value directly, not its address.
2012-01-06 01:28:30 +01:00
Lennart Poettering
eff406331a login: implement sd_session_get_service() 2012-01-05 23:14:22 +01:00
Lennart Poettering
4cd9a9d9ec journal: rename syslog tag to identifier since that's what we call it on the server side. 2012-01-05 21:46:48 +01:00
Lennart Poettering
258cdffc2f journal: rename priority_prefix to level_prefix, since that's how we call it in PID 1 2012-01-05 21:39:59 +01:00
Lennart Poettering
86b9b8e70d sd-journal: close reading side of sd_journal_stream_fd() file descriptors 2012-01-05 21:39:31 +01:00
Lennart Poettering
54fe0cdbe3 execute: talk directly to the journald, instead to the stdout-syslog-bridge 2012-01-05 21:39:08 +01:00
Lennart Poettering
33eb8abfa5 journal: store used transport in journal 2012-01-05 20:24:34 +01:00
Lennart Poettering
259d2e7620 journal: move sockets into their own subdir 2012-01-05 20:24:16 +01:00
Lennart Poettering
55d7bfc19b journalctl: rework short output mode to rebuild full syslog message 2012-01-05 20:11:47 +01:00
Lennart Poettering
8ab49c12dc headers: fix git URLs for source files 2012-01-05 18:25:36 +01:00
Lennart Poettering
2f9dec073b build-sys: add stub makefiles to subdirs 2012-01-05 16:29:21 +01:00
Lennart Poettering
8665a38793 journal: fix include in sd-journal.h 2012-01-05 16:28:43 +01:00
Lennart Poettering
55ee336cdc journalctl: add --new-id switch to generate a new 128Bit id 2012-01-05 16:28:17 +01:00
Lennart Poettering
ea41a8a973 journal: add missing sd-messages.h 2012-01-05 16:27:38 +01:00
Lennart Poettering
81527be142 build-sys: move public header files into a dir of their own 2012-01-05 16:01:58 +01:00
Lennart Poettering
67e5cc4f3e util: never ellipsize welcome message 2012-01-05 15:39:07 +01:00
Lennart Poettering
224f2ee221 journald: add configuration file options to forward all logged data to kmsg, console, syslog 2012-01-05 15:39:03 +01:00
Lennart Poettering
674f828369 log: minor optimization 2012-01-05 14:55:35 +01:00
Lennart Poettering
81beb7508e util: when printing status updates during boot, take terminal width into account 2012-01-05 14:55:35 +01:00
Zbigniew Jędrzejewski-Szmek
9cf3ab0e16 fix compilation error with 'PathSpec redefined' 2012-01-05 00:56:21 +01:00
Kay Sievers
4726299357 logind: add needed include for sd_notify() 2012-01-05 00:52:56 +01:00
Kay Sievers
2edfe21d03 conf-parser: silence compiler warning 2012-01-05 00:46:55 +01:00
Lennart Poettering
e6960940b6 journald: parse configuration file 2012-01-04 20:40:04 +01:00
Lennart Poettering
df50185b43 journal: beef up journal output of systemctl and journalctl 2012-01-04 18:33:36 +01:00
Lennart Poettering
fd8ee359a0 journal: it's not a problem if the realtime jumps, hence don't ensure monotonicity of realtime for entries we write 2012-01-04 18:32:50 +01:00
Lennart Poettering
f4fb21c151 systemctl: shortcut log output for non-service, non-socket, non-mount, non-swap units 2012-01-04 15:35:59 +01:00
Lennart Poettering
94fb446e55 journald: store _SYSTEMD_UNIT= instead of _SYSTEMD_SERVICE= field, since processes might also be related to mount, swap or socket units, not just services 2012-01-04 15:35:30 +01:00
Lennart Poettering
e91af489a2 journalctl: only output 10 most recent lines in --follow mode 2012-01-04 15:27:31 +01:00
Lennart Poettering
6f003b4304 journalctl: fix counting of -n parameter 2012-01-04 04:00:14 +01:00
Lennart Poettering
cf5eb6a110 journal: fix reverse traversing of entries 2012-01-04 03:45:50 +01:00
Lennart Poettering
b4e5f92017 journal: add missing error check 2012-01-04 03:45:24 +01:00
Lennart Poettering
9c4e3f2624 journal: don't mind too much if we can't find a monotonic timestamp 2012-01-04 03:45:14 +01:00
Lennart Poettering
b1a0ab7148 journald: don't rotate on startup 2012-01-04 02:33:11 +01:00
Lennart Poettering
a99c349d0d journal: when increasing window, make sure to use the increased window 2012-01-04 02:21:04 +01:00
Lennart Poettering
4bbdcdb301 journal: apply seek check before resizing window, and refresh stat data if necessary 2012-01-04 02:16:38 +01:00
Lennart Poettering
b788cc23aa journal: add memory barrier before linking in newly created entries 2012-01-04 02:15:45 +01:00
Lennart Poettering
4b067dc9d2 journal: add missing error check 2012-01-04 02:15:08 +01:00
Lennart Poettering
2100675e9f journalctl: add -n switch 2012-01-04 02:14:42 +01:00
Lennart Poettering
8e9e6d567a sd128: rename SD_FORMAT_ID128_STR to SD_ID128_FORMAT_STR to follow naming scheme 2012-01-04 02:13:41 +01:00
Lennart Poettering
eaff7bd849 sd128: add format string macros for outputting sd_id128_t variables 2012-01-04 02:09:05 +01:00
Lennart Poettering
bad75c274a journald: fix _SYSTEMD_CGROUP= values 2012-01-03 23:41:55 +01:00
Lennart Poettering
bda061759c logind: send out Lock signal when locking 2012-01-03 23:08:15 +01:00
Lennart Poettering
976c088a02 logind: don't watch vcsa if nobody cares 2012-01-03 21:50:02 +01:00
Lennart Poettering
addedec48b logind: if we can't open /dev/tty0, assume there is no VT subsystem and don't pretend we could do VT switching 2012-01-03 21:47:54 +01:00
Daniel Walsh
dc4b020064 namespace: remount namespace root dir for SLAVE to avoid propagation of mounts from the namespace to the host
https://bugzilla.redhat.com/show_bug.cgi?id=752540
2012-01-03 21:12:10 +01:00
Lennart Poettering
86aa7ba4f9 systemctl: hook up systemctl with the journal 2012-01-03 21:08:58 +01:00
Lennart Poettering
adf7d506b5 journal: never fail if we cannot access /var, just print a warning 2012-01-03 21:08:58 +01:00
Lennart Poettering
52f4f45bf4 journald: treat a read-only /var identical to an unmounted one 2012-01-03 21:08:58 +01:00
Lennart Poettering
85d83bf41c journald: add _SYSTEMD_SESSION, _SYSTEMD_OWNER_UID, _SYSTEMD_SERVICE to all entries 2012-01-03 21:08:58 +01:00
Lennart Poettering
000a2c9886 sd-id128: add _public_ to all exports, and add validity checks for all parameters 2012-01-03 21:08:58 +01:00
Lennart Poettering
a5344d2c3b journal: add _public_ to all sd-journal calls, and add parameter checks 2012-01-03 21:08:58 +01:00
Lennart Poettering
9847946e12 login: introduce sd_pid_get_service() 2012-01-03 21:08:58 +01:00
Lennart Poettering
b72491a2fd nspawn: get rid of BUFFER_SIZE, use LINE_MAX instead 2012-01-03 21:08:57 +01:00
Lennart Poettering
4f3656e1ce readahead: bring export definition of sd-readahead in line with sd-daemon 2012-01-03 21:08:57 +01:00
Lennart Poettering
4cfc6dbe52 socket: only add dependency on kmsg socket to socket units which have any kind of exec program specified 2012-01-03 21:08:57 +01:00
Lennart Poettering
776a564f54 build-sys: move kbd-model-map to locale/ 2012-01-03 21:08:57 +01:00
Lennart Poettering
b4d0195b05 cryptsetup: split off cryptsetup into its own subdir 2012-01-03 21:08:57 +01:00
Lennart Poettering
927f62bd54 login: move systemd-user-sessions.service into login/, too 2011-12-31 19:45:41 +01:00
Lennart Poettering
e5e83e8362 build-sys: make readahead and vconsole optional 2011-12-31 19:45:41 +01:00
Kay Sievers
bb765041af gnome-ask-password-agent: require libnotify >= 0.7.0 2011-12-31 18:15:27 +01:00
Lennart Poettering
be5f4385d6 login: move the PAM module to src/login/ since it is just a client to logind 2011-12-31 18:06:56 +01:00
Lennart Poettering
5e2c93666f test: rename test directory 2011-12-31 18:06:56 +01:00
Lennart Poettering
9c5b60ca5f login: move libsystemd-login.pc.in into src/login/ 2011-12-31 13:37:23 +01:00
Kay Sievers
d4a66a7f96 libsystemd-id128: restructure Makefile.am 2011-12-31 08:53:06 +01:00
Kay Sievers
7e8f489ad5 journal: restructure Makefile.am 2011-12-31 08:36:52 +01:00
Kay Sievers
609518c1d2 binfmt: move sources to subdirectory 2011-12-31 07:40:31 +01:00
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