Commit graph

3991 commits

Author SHA1 Message Date
Lennart Poettering a24c64f03f journald: introduce new "systemd-journal" group and make it own the journal files
Previously all journal files were owned by "adm". In order to allow
specific users to read the journal files without granting it access to
the full "adm" powers, introduce a new specific group for this.

"systemd-journal" has to be created by the packaging scripts manually at
installation time. It's a good idea to assign a static UID/GID to this
group, since /var/log/journal might be shared across machines via NFS.

This commit also grants read access to the journal files by default to
members of the "wheel" and "adm" groups via file system ACLs, since
these "almost-root" groups should be able to see what's going on on the
system. These ACLs are created by "make install". Packagers probably
need to duplicate this logic in their postinst scripts.

This also adds documentation how to grant access to the journal to
additional users or groups via fs ACLs.
2013-03-05 18:59:03 +01:00
Lennart Poettering fc7b7e2e74 journald: stpcpy() + mempcpy() are awesome 2013-03-05 15:02:38 +01:00
Lennart Poettering 82499507b3 journald: drop splitting-by-audit entirely
Thinking about it we should probably not hide bugs by falling back to
audit when we have our own session information anyway.
2013-03-05 14:36:59 +01:00
Lennart Poettering 40adcda869 journald: be a bit more careful when spitting up journals by user id 2013-03-05 14:27:34 +01:00
Lennart Poettering 8a0889dfda journald: check session owner UID rather then audit ID when splitting up journal files
We should always go by our own cgroup hierarchy before using foreign
schemes such as audit, so let's do that for the split out logic too.
2013-03-05 14:23:27 +01:00
Harald Hoyer ac4785b031 Revert "fstab-generator: place initrd /sysroot mounts in initrd-fs.target"
This reverts commit 8330847e94.

Conflicts:
	src/fstab-generator/fstab-generator.c
2013-03-05 06:45:06 +01:00
Lennart Poettering 954449b82d logind: when registering a new session always use previous session info from cgroup path rather than audit
Previously for cases like "su" or "sudo" where a session is attempted to
be created from within an existing one we used the audit session ID to
detect this and in such a case we simple returned the session data of
the original session a second time.

With this change we will now use the cgroup path of the calling path to
determine the old session, i.e. we only rely on our own session
identification scheme, instead of audits.

We will continue to keep the audit session ID and ours in sync however,
to avoid unnecessary confusion.
2013-03-05 03:35:52 +01:00
Harald Hoyer 135b5212d4 fstab-generator: only handle block devices with root= kernel command line parameter
skip s.th. like root=nfs:... root=iscsi:... root=nbd:...
2013-03-04 21:00:56 +01:00
Harald Hoyer 8330847e94 fstab-generator: place initrd /sysroot mounts in initrd-fs.target
also do not overwrite /sysroot*.mount units already generated from fstab
2013-03-04 19:37:06 +01:00
Harald Hoyer 39b83cdab3 add initrd-fs.target and initrd-fs-pre.target 2013-03-04 19:33:50 +01:00
Kay Sievers da4993920c journal: split journal uid only when audit uid data is valid 2013-03-04 15:19:10 +01:00
Michal Schmidt a0b6422689 core/manager: fix conditions to start and stop watching running jobs
Harald encountered division by zero in manager_print_jobs_in_progress.
Clearly we had the watch enabled when we shouldn't - there were no
running jobs in m->jobs, only waiting ones. This is either a deadlock,
or maybe some of them would be detected as runnable in the next dispatch
of the run queue. In any case we mustn't crash.

Fix it by starting and stopping the watch based on n_running_jobs
instead of the number of all jobs.
2013-03-04 14:51:32 +01:00
Zbigniew Jędrzejewski-Szmek 19fbec1919 tmpfiles: use cleanup func. to save a few lines 2013-03-03 20:16:57 -05:00
Lukas Nykryn a6187d4ce8 tmpfiles: move exclamation mark into right place
Unary not has higher precedence than comparisons,
so the condition was bogus.
2013-03-03 20:16:57 -05:00
Zbigniew Jędrzejewski-Szmek bc41f93e90 core/path: install inotify watches top-down instead of bottom-up
When watches are installed from the bottom, it is always possible
to race, and miss a file creation event. The race can be avoided
if a watch is first established for a parent directory, and then for
the file in the directory. If the file is created in the time between,
the watch on the parent directory will fire.

Some messages (mostly at debug level) are added to help diagnose
pidfile issues.

Should fix https://bugzilla.redhat.com/show_bug.cgi?id=917075.
2013-03-03 20:16:56 -05:00
Rob Clark bb26309dd0 udev: fix segfault with android rndis
The android gadget driver for network tethering over rndis somehow has a
parent device with a null subsystem.  Probably this is bug in android driver,
but it is easy enough to make systemd/udev behave gracefully and not
segfault.  And this will help for making linux distros with systemd
(like fedora) work on android devices.
2013-03-03 19:02:36 +01:00
Kay Sievers 1d600df55b udev: remove database conversion code 2013-03-03 18:35:22 +01:00
Kay Sievers 3f60bcb5e6 udev: firmware - do not created /run/udev/firmware-missing/
The userspace firmware loader is deprecated now, and will be entirely
removed when we depend on a kernel version with the built-in firmware
loader available.
2013-03-03 18:31:52 +01:00
Zbigniew Jędrzejewski-Szmek d288f79fb4 journald: do not barf when setting RateLimitInterval=0
Assertion 'interval > 0 || burst == 0' failed at src/journal/journald-rate-limit.c:78, function journal_rate_limit_new(). Aborting.
2013-03-03 09:11:28 -05:00
Zbigniew Jędrzejewski-Szmek 117dcc5793 core/service: use cleanup functions, wrap lines 2013-03-03 09:11:22 -05:00
Zbigniew Jędrzejewski-Szmek 28a79bd28b core/path: catch errors when adding watches
Errors because of oom conditions or descriptor exhaustion should not
be ignored. We probably cannot recover from those conditions.

Current behaviour wrt. insufficient permissions is described in the
man page. It might make sense in case of user sessions, so I left
it as is.
2013-03-03 08:55:53 -05:00
Zbigniew Jędrzejewski-Szmek e0207c8d91 core/path: modernize style 2013-03-03 08:55:53 -05:00
Zbigniew Jędrzejewski-Szmek a163db4419 core/path: use automatic cleanup
... and fix bogus return code on malloc failure.
2013-03-03 08:55:53 -05:00
Zbigniew Jędrzejewski-Szmek f8c16f42fb core/path: fix a leak in success path
... and use automatic cleanup.
2013-03-03 08:55:53 -05:00
Michal Schmidt 076a24adf4 job: print the "OK" status messages in normal green
The "OK" status messages should not draw attention to themselves.
It's better if they're not printed in bright/bold. Leave that
to errors and warnings.

Use a plain inconspicuous enterprisey green.
2013-03-02 17:56:32 +01:00
Michal Schmidt e970a72e94 manager: turn a superfluous check into assert
The crash that the check prevented has been fixed by commit 9e9e2b7.
2013-03-02 12:57:42 +01:00
Michal Schmidt 6b19ad24d3 unit: count deserialized job only after it's definitely installed
Installation of a deserialized job may fail (though purely in theory),
so increase the running job counter only when succeeding.
2013-03-02 12:29:04 +01:00
Tom Gundersen 3d22d1ab57 fstab-generator: initrd - mount selected entries from /sysroot/etc/fstab
We only mount "/usr" and entries marked with "x-initrd.mount".

This (together with the right unit files) is needed in the initramfs in order to
natively support mounting /usr (and friends) from the initramfs.

The way it is meant to work is:
 * wait for sysroot.mount to be mounted
 * do a daemon-reload to generate sysroot-usr.mount (++) from /sysroot/etc/fstab
 * wait for sysroot-usr.mount to be mounted
 * switch-root

Cc: Harald Hoyer <harald.hoyer@gmail.com>
Cc: Dave Reisner <d@falconindy.com>
2013-03-01 22:52:36 +01:00
Lukas Nykryn fea9740ae4 systemctl: check if iterator was initialized succesfully 2013-03-01 16:43:57 -05:00
Lukas Nykryn 34bf02818d manager: print p and then free it 2013-03-01 16:43:57 -05:00
Lukas Nykryn 4534824035 systemd-analyze: free unit_times only if it is not NULL 2013-03-01 16:43:57 -05:00
Lukas Nykryn 684ecf306a systemd-python: add missing check for return of PyDict_SetItem in _reader.c 2013-03-01 16:43:57 -05:00
Tom Gundersen 533740e161 fstab-generator: drop rootwait support
I originally added this to stay as compatible as possible with the kernel, but
as Lennart argued it is not really useful in the initramfs, so let's drop it (we
already don't support 'rootdealy').
2013-03-01 21:17:19 +01:00
Mantas Mikulėnas 41330ddb03 inhibit: make the output more readable
The columnar output can become pretty horrible. When GNOME inhibits
power/suspend/hibernate keys, the "WHAT" column's text extends to "WHO"
and even "WHY". At the same time, all texts in "WHY" are of the form

    GNOME handlin...sses
    Receiving sle...ions
    GNOME needs t...reen

This patch splits each inhibit entry into four lines, allowing the full
text to fit in a normal-width terminal.
2013-03-01 19:22:30 +01:00
Lennart Poettering 41be2ca14d coredump: bump coredump truncation size from 24M to 768M
In the long run we really should make this runtime configurable.
2013-03-01 19:22:30 +01:00
Michal Schmidt 9e9e2b722c core: fix running jobs counters after reload/reexec
All active units will call unit_notify() during coldplug, so we just
make sure we're counting from zero again and get the correct result for
n_on_console.

For n_running_jobs we likewise reset it to zero and then count
the running jobs as we encounter them in deserialization.
2013-03-01 18:38:22 +01:00
Harald Hoyer 945d1442ed fstab-generator: set "ro" as default for sysroot.mount 2013-03-01 17:52:05 +01:00
Harald Hoyer 3fb5a0feb4 fstab-generator: fix commit 92094b7 2013-03-01 17:07:44 +01:00
Oleksii Shevchuk bf6dcfa6a7 unit: fix the race in deserialization.
unit_notify is fired in deserelization code (particulary in
service_set_state). Units passed in random order, and there is possibility,
that unit with StopWhenUnneeded=yes passed before it actual dependecies. In
that case unit will be stopped as unneeded, because deps in UNIT_INACTIVE state
yet.

So, reuse similar logic (unit.c:1421) to avoid this race
2013-03-01 15:11:35 +01:00
Harald Hoyer 92094b75fb fstab-generator: parse_new_root_from_proc_cmdline() don't use "defaults"
Don't use "defaults" as default option string.

"defaults,<anyotheroption>" does not
even work for the mount unit mount options.
2013-03-01 15:05:28 +01:00
Harald Hoyer 5a82a91a99 manager: prevent segfault in manager_print_jobs_in_progress() 2013-03-01 15:05:28 +01:00
Harald Hoyer e2cb60fa97 cryptsetup-generator: fix the kernel command line strategy for luks.uuid
If rd.luks.uuid or luks.uuid is specified on the kernel command, only
generate units for these UUIDs. Additionally use the information in
/etc/crypttab unless rd.luks.crypttab=0 or luks.crypttab=0 is specified.
2013-03-01 15:05:28 +01:00
Lennart Poettering 487060c239 specifier: when resolving specifier strings when loading configuration, don't misunderstand parse failures as OOM
http://lists.freedesktop.org/archives/systemd-devel/2013-February/009179.html
2013-03-01 14:54:55 +01:00
Frederic Crozat 3f8ee79182 fstab,mount: detect rbind as bind mount
Correctly detect rbind mount option as bind mount.

Fixes https://bugzilla.novell.com/show_bug.cgi?id=804575.
2013-03-01 14:43:18 +01:00
Daniel Wallace ffa7cd15cd journalctl: add --user-unit= switch
Add --user-unit= to make it possible to query for user logs by the name
of the service.
2013-03-01 14:39:04 +01:00
Lennart Poettering 242c4e1cc4 path-lookup: downgrade again the messages where we log for units
This partially reverts 7ad94c716d.

After that commit commands such as "systemctl enable" and friends
printed the search path information multiple times in its output, which
is ugly.

If we want the search paths to be printed at a higher log level, then we
should do this in PID 1 only, i.e. split the printing out of the normal
path lookup logic and invoke that explicitly from PID 1 but not in the
auxiliary tools.
2013-03-01 14:07:20 +01:00
Lennart Poettering d6cb60c7a0 Revert "systemctl: try to reload daemon after enable/disable only when not running in a chroot"
This reverts commit 5522a1fa87.

I am an idiot, the chroot case was already filtered out, so no point in
checking this again.
2013-03-01 14:04:18 +01:00
Lennart Poettering 5522a1fa87 systemctl: try to reload daemon after enable/disable only when not running in a chroot
http://lists.freedesktop.org/archives/systemd-devel/2013-February/009208.html
2013-03-01 13:59:49 +01:00
Lukas Nykryn 82910f1358 pager: add K to less environment
Using less as a pager sometimes breaks terminal when output
is interrupted by ctrl-c.

Reproducer: run 'sudo journalctl' ctrl-c.

Thanks mbriza@redhat.com for the solution.
2013-03-01 13:51:43 +01:00
Lukas Nykryn d89d6c86d9 journalctl: add --reverse option to show the newest lines first 2013-03-01 12:51:24 +01:00