chiark / gitweb /
elogind.git
6 years agocore: add transient units
Lennart Poettering [Fri, 28 Jun 2013 02:12:58 +0000 (04:12 +0200)]
core: add transient units

Transient units can be created via the bus API. They are configured via
the method call parameters rather than on-disk files. They are subject
to normal GC. Transient units currently may only be created for
services (however, we will extend this), and currently only ExecStart=
and the cgroup parameters can be configured (also to be extended).

Transient units require a unique name, that previously had no
configuration file on disk.

A tool systemd-run is added that makes use of this functionality to run
arbitrary command lines as transient services:

$ systemd-run /bin/ping www.heise.de

Will cause systemd to create a new transient service and run ping in it.

6 years agodbus: fix minor memory leak when sending job change signals
Lennart Poettering [Fri, 28 Jun 2013 01:47:40 +0000 (03:47 +0200)]
dbus: fix minor memory leak when sending job change signals

6 years agounit: make sure the dropins we write are high-priority
Lennart Poettering [Thu, 27 Jun 2013 22:41:24 +0000 (00:41 +0200)]
unit: make sure the dropins we write are high-priority

6 years agodbus: hookup runtime property changes for mouns, services, sockets, swaps too
Lennart Poettering [Thu, 27 Jun 2013 21:21:21 +0000 (23:21 +0200)]
dbus: hookup runtime property changes for mouns, services, sockets, swaps too

6 years agodbus: make DeviceAllow=/DevicePolicy= writable
Lennart Poettering [Thu, 27 Jun 2013 21:13:17 +0000 (23:13 +0200)]
dbus: make DeviceAllow=/DevicePolicy= writable

6 years agodbus: make more cgroup attributes runtime settable
Lennart Poettering [Thu, 27 Jun 2013 19:50:35 +0000 (21:50 +0200)]
dbus: make more cgroup attributes runtime settable

6 years agodbus: add infrastructure for changing multiple properties at once on units and hook...
Lennart Poettering [Thu, 27 Jun 2013 19:14:56 +0000 (21:14 +0200)]
dbus: add infrastructure for changing multiple properties at once on units and hook some cgroup attributes up to it

This introduces two bus calls to make runtime changes to selected bus
properties, optionally with persistence.

This currently hooks this up only for three cgroup atributes, but this
brings the infrastructure to add more changable attributes.

This allows setting multiple attributes at once, and takes an array
rather than a dictionary of properties, in order to implement simple
resetting of lists using the same approach as when they are sourced from
unit files. This means, that list properties are appended to by this
call, unless they are first reset via assigning the empty list.

6 years agojournal-verify: Use proper printf placeholder
Jan Janssen [Thu, 27 Jun 2013 14:24:02 +0000 (16:24 +0200)]
journal-verify: Use proper printf placeholder

6 years agotest: Add list testcase
Jan Janssen [Wed, 26 Jun 2013 11:43:16 +0000 (13:43 +0200)]
test: Add list testcase

6 years agocore: general cgroup rework
Lennart Poettering [Thu, 27 Jun 2013 02:14:27 +0000 (04:14 +0200)]
core: general cgroup rework

Replace the very generic cgroup hookup with a much simpler one. With
this change only the high-level cgroup settings remain, the ability to
set arbitrary cgroup attributes is removed, so is support for adding
units to arbitrary cgroup controllers or setting arbitrary paths for
them (especially paths that are different for the various controllers).

This also introduces a new -.slice root slice, that is the parent of
system.slice and friends. This enables easy admin configuration of
root-level cgrouo properties.

This replaces DeviceDeny= by DevicePolicy=, and implicitly adds in
/dev/null, /dev/zero and friends if DeviceAllow= is used (unless this is
turned off by DevicePolicy=).

6 years agocore: don't do runaway fork()s if we hit a segfault from our segfault handler
Lennart Poettering [Thu, 27 Jun 2013 00:28:12 +0000 (02:28 +0200)]
core: don't do runaway fork()s if we hit a segfault from our segfault handler

6 years agokillall: do not use alloca() in argument list
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2013 23:48:32 +0000 (19:48 -0400)]
killall: do not use alloca() in argument list

It is not allowed.

6 years agojournalctl: highlight MESSAGE= in verbose output
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2013 23:48:24 +0000 (19:48 -0400)]
journalctl: highlight MESSAGE= in verbose output

When looking at verbose output, additional "work" is required to
pick out the interesting MESSAGE= lines from all the fields.

Also, show long fields in full in verbose output mode when
OUTPUT_FULL_WIDTH is specified.

6 years agoman: add CONSTANTS section to systemd.directives(7)
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2013 23:48:19 +0000 (19:48 -0400)]
man: add CONSTANTS section to systemd.directives(7)

6 years agoman: use <constant> for various constants which look ugly with quotes
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2013 23:47:34 +0000 (19:47 -0400)]
man: use <constant> for various constants which look ugly with quotes

6 years agoman: always supply quotes around literals
Zbigniew Jędrzejewski-Szmek [Wed, 26 Jun 2013 12:03:53 +0000 (08:03 -0400)]
man: always supply quotes around literals

When manpages are displayed on a terminal, <literal>s are indistinguishable
from surrounding text. Add quotes everywhere, remove duplicate quotes,
and tweak a few lists for consistent formatting.

https://bugzilla.redhat.com/show_bug.cgi?id=874631

6 years agosystemctl: conform to LSB with the "status" return code
Harald Hoyer [Tue, 25 Jun 2013 14:25:38 +0000 (16:25 +0200)]
systemctl: conform to LSB with the "status" return code

check for pid file existance before returning 1

6 years agoman: Small language improvements to sd_journal_open
David King [Tue, 25 Jun 2013 10:48:17 +0000 (11:48 +0100)]
man: Small language improvements to sd_journal_open

6 years agosystemctl: conform to LSB with the "status" return code
Harald Hoyer [Tue, 25 Jun 2013 11:06:51 +0000 (13:06 +0200)]
systemctl: conform to LSB with the "status" return code

http://fedoraproject.org/wiki/Packaging:SysVInitScript#Exit_Codes_for_the_Status_Action

https://bugzilla.redhat.com/show_bug.cgi?id=975016

6 years agojournald: always vacuum empty offline files
Zbigniew Jędrzejewski-Szmek [Tue, 25 Jun 2013 01:00:28 +0000 (21:00 -0400)]
journald: always vacuum empty offline files

Corrupted empty files are relatively common. I think they are created
when a coredump for a user who never logged anything before is
attempted to be written, but the write does not succeed because the
coredump is too big, but there are probably other ways to create
those, especially if the machine crashes at the right time.
Non-corrupted empty files can also happen, e.g. if a journal file is
opened, but nothing is ever successfully written to it and it is
rotated because of MaxFileSec=. Either way, each "empty" journal file
costs around 3 MB, and there's little point in keeping them around.

6 years agojournald: fix space limits reporting
Zbigniew Jędrzejewski-Szmek [Tue, 25 Jun 2013 01:02:16 +0000 (21:02 -0400)]
journald: fix space limits reporting

Reporting of the free space was bogus, since the remaining space
was compared with the maximum allowed, instead of the current
use being compared with the maximum allowed. Simplify and fix
by reporting limits directly at the point where they are calculated.

Also, assign a UUID to the message.

6 years agojournal/vacuum: cleanup
Zbigniew Jędrzejewski-Szmek [Mon, 24 Jun 2013 11:59:41 +0000 (07:59 -0400)]
journal/vacuum: cleanup

6 years agolibudev: Use correct type for sizeof
Jan Janssen [Sat, 22 Jun 2013 13:34:01 +0000 (15:34 +0200)]
libudev: Use correct type for sizeof

6 years agojournal-verify: allow unlinked data entries
Zbigniew Jędrzejewski-Szmek [Sun, 23 Jun 2013 00:04:08 +0000 (20:04 -0400)]
journal-verify: allow unlinked data entries

Sometimes an entry is not successfully written, and we end up with
data items which are "unlinked", not connected to, and not used by any
entry. This will usually happen when we write to write a core dump,
and the initial small data fields are written successfully, but
the huge COREDUMP= field is not written. This situation is hard
to avoid, but the results are mostly harmless. Thus only warn about
unused data items.

Also, be more verbose about why journal files failed verification.
This should help diagnose journal failure modes without resorting
to a hexadecimal editor.

https://bugs.freedesktop.org/show_bug.cgi?id=65235 (esp. see
system.journal attached to the bug report).

6 years agoman: Fix small typo
Michael Biebl [Fri, 21 Jun 2013 22:55:18 +0000 (00:55 +0200)]
man: Fix small typo

6 years agoupdate TODO
Lennart Poettering [Fri, 21 Jun 2013 13:57:47 +0000 (15:57 +0200)]
update TODO

6 years agotmpfiles: fix error check
Lennart Poettering [Fri, 21 Jun 2013 13:57:42 +0000 (15:57 +0200)]
tmpfiles: fix error check

6 years agojournald: bump the journal per-unit ratelimit defaults
Lennart Poettering [Fri, 21 Jun 2013 13:56:45 +0000 (15:56 +0200)]
journald: bump the journal per-unit ratelimit defaults

Too many people kept hitting them, so let's increase the limits a bit.

https://bugzilla.redhat.com/show_bug.cgi?id=965803

6 years agokeymap: Apply to all Latitude and Precision models
Martin Pitt [Fri, 21 Jun 2013 04:34:38 +0000 (06:34 +0200)]
keymap: Apply to all Latitude and Precision models

https://launchpad.net/bugs/1193147

6 years agojournalctl,systemctl: show messages tagged with OBJECT_SYSTEMD_[USER_]_UNIT
Zbigniew Jędrzejewski-Szmek [Fri, 21 Jun 2013 02:25:49 +0000 (22:25 -0400)]
journalctl,systemctl: show messages tagged with OBJECT_SYSTEMD_[USER_]_UNIT

Replace mallocs with alloca while at it.

6 years agoMake sure we only show authentic coredump messages
Zbigniew Jędrzejewski-Szmek [Fri, 21 Jun 2013 01:48:26 +0000 (21:48 -0400)]
Make sure we only show authentic coredump messages

Before we only checked the MESSAGE_ID and COREDUMP_UNIT.
Those are both user-controlled fields.

For COREDUMP_USER_UNIT, relax the rules a bit, and also
allow messages from _UID=0.

6 years agojournal: allow callers to specify OBJECT_PID=
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jun 2013 04:24:34 +0000 (00:24 -0400)]
journal: allow callers to specify OBJECT_PID=

When journald encounters a message with OBJECT_PID= set
coming from a priviledged process (UID==0), additional fields
will be added to the message:

OBJECT_UID=,
OBJECT_GID=,
OBJECT_COMM=,
OBJECT_EXE=,
OBJECT_CMDLINE=,
OBJECT_AUDIT_SESSION=,
OBJECT_AUDIT_LOGINUID=,
OBJECT_SYSTEMD_CGROUP=,
OBJECT_SYSTEMD_SESSION=,
OBJECT_SYSTEMD_OWNER_UID=,
OBJECT_SYSTEMD_UNIT= or OBJECT_SYSTEMD_USER_UNIT=.

This is for other logging daemons, like setroubleshoot, to be able to
augment their logs with data about the process.

https://bugzilla.redhat.com/show_bug.cgi?id=951627

6 years agoAdd hasprefix macro to check prefixes of fixed length
Zbigniew Jędrzejewski-Szmek [Fri, 21 Jun 2013 02:40:10 +0000 (22:40 -0400)]
Add hasprefix macro to check prefixes of fixed length

6 years agologin: add an api to determine the slice a PID is located in to libsystemd-login
Lennart Poettering [Thu, 20 Jun 2013 23:46:27 +0000 (01:46 +0200)]
login: add an api to determine the slice a PID is located in to libsystemd-login

6 years agocore: only attempt to connect to a session bus if one likely exists.
Auke Kok [Thu, 20 Jun 2013 20:36:33 +0000 (13:36 -0700)]
core: only attempt to connect to a session bus if one likely exists.

6 years agoupdate TODO
Lennart Poettering [Thu, 20 Jun 2013 21:32:13 +0000 (23:32 +0200)]
update TODO

6 years agoman: fix example for DefaultEnvironment=
Lennart Poettering [Thu, 20 Jun 2013 21:31:21 +0000 (23:31 +0200)]
man: fix example for DefaultEnvironment=

The example mentioned Environment= rather than DefaultEnvironment=.

Also made some other clean-ups.

6 years agoman: document that shutdown() is only sometimes OK on sockets passed in via socket...
Lennart Poettering [Thu, 20 Jun 2013 21:25:23 +0000 (23:25 +0200)]
man: document that shutdown() is only sometimes OK on sockets passed in via socket activation

6 years agomanager: add DefaultEnvironment option
Umut Tezduyar [Sun, 9 Jun 2013 05:08:46 +0000 (07:08 +0200)]
manager: add DefaultEnvironment option

This complements existing functionality of setting variables
through 'systemctl set-environment', the kernel command line,
and through normal environment variables for systemd in session
mode.

6 years agojournalctl: show lines in full with --all
Zbigniew Jędrzejewski-Szmek [Thu, 20 Jun 2013 20:15:04 +0000 (16:15 -0400)]
journalctl: show lines in full with --all

In 31f7bf1 "logs-show: print multiline messages", I forgot
to take into account the fact that --all implies --full for
journalctl.

6 years agokernel-install: filter out "initrd=" from /proc/cmdline
Harald Hoyer [Thu, 20 Jun 2013 13:46:37 +0000 (15:46 +0200)]
kernel-install: filter out "initrd=" from /proc/cmdline

6 years agologind: uninitialized variable
Zbigniew Jędrzejewski-Szmek [Thu, 20 Jun 2013 04:51:10 +0000 (00:51 -0400)]
logind: uninitialized variable

6 years agobuild-sys: make intltool and distcheck happy
Zbigniew Jędrzejewski-Szmek [Thu, 20 Jun 2013 04:20:55 +0000 (00:20 -0400)]
build-sys: make intltool and distcheck happy

6 years agonspawn: '-C' option has been removed
Zbigniew Jędrzejewski-Szmek [Thu, 20 Jun 2013 04:01:15 +0000 (00:01 -0400)]
nspawn: '-C' option has been removed

Fixup for 9444b1f "logind: add infrastructure to keep track of
machines, and move to slices."

6 years agosd-login: update machine enumeration/notifications APIs for new /run/systemd/machines/
Lennart Poettering [Thu, 20 Jun 2013 02:03:38 +0000 (04:03 +0200)]
sd-login: update machine enumeration/notifications APIs for new /run/systemd/machines/

6 years agologind: make ListMachines bus call public
Lennart Poettering [Thu, 20 Jun 2013 02:00:28 +0000 (04:00 +0200)]
logind: make ListMachines bus call public

6 years agologind: add infrastructure to keep track of machines, and move to slices
Lennart Poettering [Thu, 20 Jun 2013 01:45:08 +0000 (03:45 +0200)]
logind: add infrastructure to keep track of machines, and move to slices

- This changes all logind cgroup objects to use slice objects rather
  than fixed croup locations.

- logind can now collect minimal information about running
  VMs/containers. As fixed cgroup locations can no longer be used we
  need an entity that keeps track of machine cgroups in whatever slice
  they might be located. Since logind already keeps track of users,
  sessions and seats this is a trivial addition.

- nspawn will now register with logind and pass various bits of metadata
  along. A new option "--slice=" has been added to place the container
  in a specific slice.

- loginctl gained commands to list, introspect and terminate machines.

- user.slice and machine.slice will now be pulled in by logind.service,
  since only logind.service requires this slice.

6 years agoDescribe handling of an AF_UNIX socket
Łukasz Stelmach [Wed, 19 Jun 2013 12:59:02 +0000 (14:59 +0200)]
Describe handling of an AF_UNIX socket

Describe how to handle an AF_UNIX socket, with Accept set to false,
received from systemd, upon exit.

Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agocore/dbus: properly export cgroup properties on sockets
Zbigniew Jędrzejewski-Szmek [Wed, 19 Jun 2013 22:09:54 +0000 (18:09 -0400)]
core/dbus: properly export cgroup properties on sockets

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

6 years agocgls,loginctl,systemctl: fix -l
Zbigniew Jędrzejewski-Szmek [Wed, 19 Jun 2013 22:08:14 +0000 (18:08 -0400)]
cgls,loginctl,systemctl: fix -l

Fixup for 98a6e13 "journalctl,loginctl,systemctl,systemd-cgls: add -l
as alias for --full".

6 years agojournal: add references to SSKG paper FSS is based on
Lennart Poettering [Tue, 18 Jun 2013 14:25:11 +0000 (16:25 +0200)]
journal: add references to SSKG paper FSS is based on

6 years agoupdate TODO
Lennart Poettering [Tue, 18 Jun 2013 14:06:05 +0000 (16:06 +0200)]
update TODO

6 years agojournalctl: properly print headers of empty journals
Zbigniew Jędrzejewski-Szmek [Tue, 18 Jun 2013 12:48:14 +0000 (08:48 -0400)]
journalctl: properly print headers of empty journals

6 years agoudev: handle network controllers in nonstandard domains
Sean McGovern [Wed, 12 Jun 2013 13:32:47 +0000 (09:32 -0400)]
udev: handle network controllers in nonstandard domains

Onboard network controllers are not always on PCI domain 0.

[Kay: use int instead of long, add [P] to slot naming, remove sysname var]

6 years agocore: unref slice ref after use
Lennart Poettering [Tue, 18 Jun 2013 00:07:35 +0000 (02:07 +0200)]
core: unref slice ref after use

6 years agocore: expose a "Slice" property on Unit objects on the bus
Lennart Poettering [Mon, 17 Jun 2013 23:00:13 +0000 (01:00 +0200)]
core: expose a "Slice" property on Unit objects on the bus

6 years agounits: add default units for system.slice, user.slice, machine.slice
Lennart Poettering [Mon, 17 Jun 2013 22:59:54 +0000 (00:59 +0200)]
units: add default units for system.slice, user.slice, machine.slice

6 years agocore: add new .slice unit type for partitioning systems
Lennart Poettering [Mon, 17 Jun 2013 19:33:26 +0000 (21:33 +0200)]
core: add new .slice unit type for partitioning systems

In order to prepare for the kernel cgroup rework, let's introduce a new
unit type to systemd, the "slice". Slices can be arranged in a tree and
are useful to partition resources freely and hierarchally by the user.

Each service unit can now be assigned to one of these slices, and later
on login users and machines may too.

Slices translate pretty directly to the cgroup hierarchy, and the
various objects can be assigned to any of the slices in the tree.

6 years agorules: only run systemd-sysctl when a network device is added
Ross Lagerwall [Thu, 13 Jun 2013 09:45:12 +0000 (10:45 +0100)]
rules: only run systemd-sysctl when a network device is added

Otherwise, when a network device is renamed, systemd-sysctl is run twice
with the same network device name: once for ACTION="add" and once for
ACTION="move".

6 years agomount: when learning about the root mount from mountinfo, don't add conflicting dep...
Lennart Poettering [Mon, 17 Jun 2013 19:12:53 +0000 (21:12 +0200)]
mount: when learning about the root mount from mountinfo, don't add conflicting dep for umount.target

That way systemd won't try to umount it at shutdown.

6 years agorpm: define a %_userunitdir macro
Lennart Poettering [Mon, 17 Jun 2013 16:37:07 +0000 (18:37 +0200)]
rpm: define a %_userunitdir macro

6 years agojournalctl,loginctl,systemctl,systemd-cgls: add -l as alias for --full
Daniel Albers [Mon, 17 Jun 2013 09:36:35 +0000 (11:36 +0200)]
journalctl,loginctl,systemctl,systemd-cgls: add -l as alias for --full

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

6 years agoman: update systemd-analyze invocation
Zbigniew Jędrzejewski-Szmek [Fri, 14 Jun 2013 12:53:15 +0000 (08:53 -0400)]
man: update systemd-analyze invocation

6 years agosystemd-analyze: Show critical chains for listed units
Gabriel de Perthuis [Tue, 11 Jun 2013 20:29:32 +0000 (22:29 +0200)]
systemd-analyze: Show critical chains for listed units

6 years agoman: improve readability of "_TRANSPORT=" section in systemd.journal-fields(7)
Jason St. John [Wed, 12 Jun 2013 17:45:14 +0000 (19:45 +0200)]
man: improve readability of "_TRANSPORT=" section in systemd.journal-fields(7)

The list and descriptions of valid transports was difficult to read, so
break the long sentence up into discrete man page list items to improve
readability.

6 years agoman: add sd_j_open_files to return values section
Zbigniew Jędrzejewski-Szmek [Fri, 14 Jun 2013 03:32:15 +0000 (23:32 -0400)]
man: add sd_j_open_files to return values section

6 years agojournald: do not calculate free space too early
Zbigniew Jędrzejewski-Szmek [Fri, 14 Jun 2013 03:32:14 +0000 (23:32 -0400)]
journald: do not calculate free space too early

Since the system journal wasn't open yet, available_space() returned 0.

Before:
systemd-journal[22170]: Allowing system journal files to grow to 4.0G.
systemd-journal[22170]: Journal size currently limited to 0B due to SystemKeepFree.

After:
systemd-journal[22178]: Allowing system journal files to grow to 4.0G.
systemd-journal[22178]: Journal size currently limited to 3.0G due to SystemKeepFree.

Also, when failing to write a message, show how much space was needed:
"Failed to write entry (26 items, 260123456 bytes) despite vacuuming, ignoring: ...".

6 years agojournal: use initialization instead of zeroing
Zbigniew Jędrzejewski-Szmek [Fri, 14 Jun 2013 03:32:14 +0000 (23:32 -0400)]
journal: use initialization instead of zeroing

6 years agobuild-sys: add 'man' target
Zbigniew Jędrzejewski-Szmek [Wed, 12 Jun 2013 17:40:54 +0000 (13:40 -0400)]
build-sys: add 'man' target

Useful when working just on the documentation.

6 years agogitignore: Add test-journal-interleaving
Jan Janssen [Wed, 12 Jun 2013 11:05:15 +0000 (13:05 +0200)]
gitignore: Add test-journal-interleaving

6 years agobuild-sys: don't install quotaon.service twice
Ross Burton [Tue, 11 Jun 2013 16:16:37 +0000 (17:16 +0100)]
build-sys: don't install quotaon.service twice

quotaon.service is already installed through dist_systemunit_DATA, so it doesn't
need to be added to nodist_systemunit_DATA.  Installing the same file twice
results in a race condition where the install process can fail.

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

[zj: actually remove quotaon.service from the other list.]

6 years agobootchart: fix typos in copyright notices
Jason St. John [Tue, 11 Jun 2013 16:26:03 +0000 (18:26 +0200)]
bootchart: fix typos in copyright notices

"Corporation" was misspelled as "Coproration"

6 years agoupdate TODO
Lennart Poettering [Tue, 11 Jun 2013 06:55:42 +0000 (08:55 +0200)]
update TODO

6 years agojournald: do not overwrite syslog facility when parsing priority
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jun 2013 22:10:12 +0000 (18:10 -0400)]
journald: do not overwrite syslog facility when parsing priority

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

6 years agobuild-sys: remove SD_JOURNAL_SYSTEM_ONLY(3) from Makefile
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jun 2013 19:08:02 +0000 (15:08 -0400)]
build-sys: remove SD_JOURNAL_SYSTEM_ONLY(3) from Makefile

6 years agoman: add note that sd_journal_open_files is racy
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jun 2013 14:22:08 +0000 (10:22 -0400)]
man: add note that sd_journal_open_files is racy

6 years agojournal: letting (interleaved) seqnums go
Zbigniew Jędrzejewski-Szmek [Sat, 8 Jun 2013 02:01:03 +0000 (22:01 -0400)]
journal: letting (interleaved) seqnums go

In the following scenario:
  server creates system.journal
  server creates user-1000.journal
both journals share the same seqnum_id.
Then
  server writes to user-1000.journal first,
  and server writes to system.journal a bit later,
and everything is fine.
The server then terminates (crash, reboot, rsyslog testing,
whatever), and user-1000.journal has entries which end with
a lower seqnum than system.journal. Now
  server is restarted
  server opens user-1000.journal and writes entries to it...
BAM! duplicate seqnums for the same seqnum_id.

Now, we usually don't see that happen, because system.journal
is closed last, and opened first. Since usually at least one
message is written during boot and lands in the system.journal,
the seqnum is initialized from it, and is set to a number higher
than than anything found in user journals. Nevertheless, if
system.journal is corrupted and is rotated, it can happen that
an entry is written to the user journal with a seqnum that is
a duplicate with an entry found in the corrupted system.journal~.
When browsing the journal, journalctl can fall into a loop
where it tries to follow the seqnums, and tries to go the
next location by seqnum, and is transported back in time to
to the older duplicate seqnum. There is not way to find
out the maximum seqnum used in a multiple files, without
actually looking at all of them. But we don't want to do
that because it would be slow, and actually it isn't really
possible, because a file might e.g. be temporarily unaccessible.

Fix the problem by using different seqnum series for user
journals. Using the same seqnum series for rotated journals
is still fine, because we know that nothing will write
to the rotated journal anymore.

Likely related:
https://bugs.freedesktop.org/show_bug.cgi?id=64566
https://bugs.freedesktop.org/show_bug.cgi?id=59856
https://bugs.freedesktop.org/show_bug.cgi?id=64296
https://bugs.archlinux.org/task/35581
https://bugzilla.novell.com/show_bug.cgi?id=817778

Possibly related:
https://bugs.freedesktop.org/show_bug.cgi?id=64293

6 years agotests: add testcase for duplicate seqnums
Zbigniew Jędrzejewski-Szmek [Sat, 8 Jun 2013 01:54:20 +0000 (21:54 -0400)]
tests: add testcase for duplicate seqnums

6 years agotests: add testcase for skipping-entries-on-direction-change-bug
Marius Vollmer [Fri, 7 Jun 2013 04:50:21 +0000 (00:50 -0400)]
tests: add testcase for skipping-entries-on-direction-change-bug

This test case failed until a3e6f050de8.

Taken from https://bugs.freedesktop.org/show_bug.cgi?id=65255.

6 years agojournal: change direction tests to use the same convention (cp </> np)
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jun 2013 03:30:46 +0000 (23:30 -0400)]
journal: change direction tests to use the same convention (cp </> np)

The order was different in various places, which makes it harder to
read to code. Also consistently use ternany for all direction checks.

Remove one free(NULL).

6 years agojournal: remember last direction of search and keep offset cache
Zbigniew Jędrzejewski-Szmek [Fri, 7 Jun 2013 02:28:05 +0000 (22:28 -0400)]
journal: remember last direction of search and keep offset cache

The fields in JournalFile are moved around to avoid wasting
7 bytes because of alignment.

6 years agojournalctl: allow the user to specify the file(s) to use
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 23:30:17 +0000 (19:30 -0400)]
journalctl: allow the user to specify the file(s) to use

This is useful for debugging and feels pretty natural. For example
answering the question "is this big .journal file worth keeping?"
is made easier.

6 years agojournal: add sd_journal_open_files
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 23:39:26 +0000 (19:39 -0400)]
journal: add sd_journal_open_files

This allows the caller to explicitly specify which journal files
should be opened. The same functionality could be achieved before
by creating a directory and playing around with symlinks. It
is useful to debug stuff and explore the journal, and has been
requested before.

Waiting is supported, the journal will notice modifications on
the files supplied when opening the journal, but will not add
any new files.

6 years agotests: add test for empty journal files
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 23:17:56 +0000 (19:17 -0400)]
tests: add test for empty journal files

The headers are currently not printed properly: some "(null)"s appear.

6 years agojournalctl: print monotonic timestamp in --header
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 23:15:43 +0000 (19:15 -0400)]
journalctl: print monotonic timestamp in --header

6 years agojournalctl: print proper IDs with --header
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 22:40:44 +0000 (18:40 -0400)]
journalctl: print proper IDs with --header

The same buffer was used for two different IDs, messing up
the output.

6 years agoUse stdint.h macros instead of casts to print uint64_t values
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 22:44:16 +0000 (18:44 -0400)]
Use stdint.h macros instead of casts to print uint64_t values

Casts are visually heavy, and can obscure unwanted truncations.

6 years agoProperly check for overflow in offsets
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 23:33:45 +0000 (19:33 -0400)]
Properly check for overflow in offsets

6 years agojournalctl: no color for --reboot-- when not on tty
Zbigniew Jędrzejewski-Szmek [Thu, 6 Jun 2013 00:33:42 +0000 (20:33 -0400)]
journalctl: no color for --reboot-- when not on tty

6 years agojournal: loop less in MATCH_AND_TERM conditionals
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 04:56:03 +0000 (00:56 -0400)]
journal: loop less in MATCH_AND_TERM conditionals

AND term usually don't have many subterms (4 seems to be the maximum
sensible number, e.g. _BOOT_ID && _SYSTEMD_UNIT && _PID && MESSAGE_ID).
Nevertheless, the cost of checking each subterm can be relatively
high, especially when the nested terms are compound, and it
makes sense to minimize the number of checks.

Instead of looping to the end and then again over the whole list once
again after at least one term changed the offset, start the loop at
the term which caused the change. This way ½ terms in the AND match
are not checked unnecessarily again.

6 years agojournalctl: add --system/--user flags
Zbigniew Jędrzejewski-Szmek [Tue, 4 Jun 2013 23:33:34 +0000 (19:33 -0400)]
journalctl: add --system/--user flags

--user basically gives messages from your own systemd --user services.
--system basically gives messages from PID 1, kernel, and --system
services. Those two options are not exahustive, because a priviledged
user might be able to see messages from other users, and they will not
be shown with either or both of those flags.

6 years agojournal: add ability to filter by current user
Zbigniew Jędrzejewski-Szmek [Wed, 5 Jun 2013 02:31:05 +0000 (22:31 -0400)]
journal: add ability to filter by current user

This is the just the library part.

SD_JOURNAL_CURRENT_USER flags is added to sd_j_open(), to open
files from current user.

SD_JOURNAL_SYSTEM_ONLY is renamed to SD_JOURNAL_SYSTEM,
and changed to mean to (also) open system files. This way various
flags can be combined, which gives them nicer semantics, especially
if other ones are added later.

Backwards compatibility is kept, because SD_JOURNAL_SYSTEM_ONLY
is equivalent to SD_JOURNAL_SYSTEM if used alone, and before there
we no other flags.

6 years agojournal: simplify match_free_if_empty
Zbigniew Jędrzejewski-Szmek [Sun, 2 Jun 2013 19:00:00 +0000 (15:00 -0400)]
journal: simplify match_free_if_empty

6 years agodev-setup: do not create a dangling /proc/kcore symlink
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jun 2013 12:50:59 +0000 (08:50 -0400)]
dev-setup: do not create a dangling /proc/kcore symlink

https://bugs.freedesktop.org/show_bug.cgi?id=65382
https://bugs.gentoo.org/472060?id=472060

6 years agojournalctl: fix verbose output when no logs are found
Zbigniew Jędrzejewski-Szmek [Mon, 10 Jun 2013 01:50:56 +0000 (21:50 -0400)]
journalctl: fix verbose output when no logs are found

$ journalctl -o verbose _EXE=/quiet/binary -f
-- Logs begin at Sun 2013-03-17 17:28:22 EDT. --
Failed to get realtime timestamp: Cannot assign requested address

JOURNAL_FOREACH_DATA_RETVAL is added, which allows the caller
to get the return value from sd_journal_enumerate_data. I think
we might want to expose this macro like SD_JOURNAL_FOREACH_DATA,
but for now it is in journal-internal.h.

There's a change in behaviour for output_*, not only in
output_verbose, that errors in sd_j_enumerate_data are not silently
ignored anymore.

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

6 years agoservice: don't report alien child as alive when it's not
Ross Lagerwall [Sun, 9 Jun 2013 16:28:44 +0000 (17:28 +0100)]
service: don't report alien child as alive when it's not

When a sigchld is received from an alien child, main_pid is set to
0 then service_enter_running calls main_pid_good to check if the
child is running.  This incorrectly returned true because
kill(main_pid, 0) would return >= 0.

This fixes an error where a service would die and the cgroup would
become empty but the service would still report as active (running).

6 years agoAllow for the use of @ in remote host calls
Daniel Wallace [Sun, 9 Jun 2013 20:54:39 +0000 (15:54 -0500)]
Allow for the use of @ in remote host calls

Without this you have to use %40 with the -H flag because dbus doesn't
like the @ sign being unescaped.

6 years agosystemctl: remove extra padding from status output
Zbigniew Jędrzejewski-Szmek [Sun, 9 Jun 2013 18:02:32 +0000 (14:02 -0400)]
systemctl: remove extra padding from status output

In 131601349 'systemctl: align all status fields to common column',
padding was calculated for 'ListenStream: ...', etc. Later on in
45a4f7233 'systemctl: tweak output of Listen: fields a bit' output
was changed to 'Listen: ... (stream)', but calculation didn't change.

Just remove the calculation, since now the result will be always 8,
and it it more important to have everything aligned to the widest
field ("Main-PID"), than to save a few columns, usually at most two
(e.g. "Listen").

Note: strlen is more natural, and is optimized to sizeof even
with -O0.

6 years agologs-show: print multiline messages
Zbigniew Jędrzejewski-Szmek [Wed, 24 Apr 2013 02:40:26 +0000 (22:40 -0400)]
logs-show: print multiline messages

[    0.019862] fedora kernel: CPU0: Thermal monitoring enabled (TM1)
[    0.019900] fedora kernel: Last level iTLB entries: 4KB 512, 2MB 0, 4MB 0
                              Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32
                              tlb_flushall_shift: 5
[    0.020118] fedora kernel: Freeing SMP alternatives: 24k freed

6 years agoupdate TODO
Lennart Poettering [Thu, 6 Jun 2013 14:25:38 +0000 (16:25 +0200)]
update TODO