Commit graph

103 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 65cd79f7f5 man: add FILES section to systemd-journald.service(8) 2013-07-15 22:20:17 -04:00
Zbigniew Jędrzejewski-Szmek 31a7eb86f1 systemd: do not output status messages once gettys are running
Make Type=idle communication bidirectional: when bootup is finished,
the manager, as before, signals idling Type=idle jobs to continue.
However, if the boot takes too long, idling jobs signal the manager
that they have had enough, wait a tiny bit more, and continue, taking
ownership of the console. The manager, when signalled that Type=idle
jobs are done, makes a note and will not write to the console anymore.

This is a cosmetic issue, but quite noticable, so let's just fix it.

Based on Harald Hoyer's patch.

https://bugs.freedesktop.org/show_bug.cgi?id=54247
http://unix.stackexchange.com/questions/51805/systemd-messages-after-starting-login/
2013-07-15 21:34:57 -04:00
Lennart Poettering 71445ae75b core: send out "Reloading" signal before and after doing a full reload/reexec of PID 1
Since we'll unload all units/job during a reload, and then readd them it
is really useful for clients to be aware of this phase hence sent a
signal out before and after. This signal is called "Reloading" (despite
the fact that it is also sent out during reexecution, which we consider
a special case in this context) and has one boolean parameter which is
true for the signal sent before the reload, and false for the signal
after the reload. The UnitRemoved/JobRremoved and UnitNew/JobNew due to
the reloading are guranteed to be between the pair of Reloading
messages.
2013-07-10 23:41:03 +02:00
Lennart Poettering 6fa4853328 core: serialize/deserialize bus subscribers 2013-07-10 23:41:03 +02:00
Lennart Poettering cf1265e188 core: make GC more aggressive
Since we should allow registering/unregistering transient units with the
same name in a tight-loop, we need to make the GC more aggressive, so
that dead units are cleaned up immediately instead of later.

hence, execute the GC sweep on every event loop iteration and clean up
units. This of course, means we need to be careful with adding units to
the GC queue, which we already are since we execute check_gc() of each
unit type already when adding something to the queue.
2013-07-02 17:46:57 +02:00
Lennart Poettering ede3a79675 core: split out unit bus path unescaping into unit_name_from_dbus_path() 2013-07-02 01:48:55 +02:00
Lennart Poettering c2756a6840 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.
2013-06-28 04:12:58 +02:00
Lennart Poettering 4ad490007b 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=).
2013-06-27 04:17:34 +02:00
Auke Kok ed002560a1 core: only attempt to connect to a session bus if one likely exists. 2013-06-20 23:37:04 +02:00
Umut Tezduyar 97d0e5f83b 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.
2013-06-20 16:27:45 -04:00
Thomas Hindoe Paaboel Andersen d9acfb71db analyze: show unit file loading on plot
This will add another color to the legend called "Loading unit files"
Like the generators it will mark a part of the systemd bar indicating
the time spent while loading unit files.
2013-06-02 22:26:13 +02:00
Umut Tezduyar 518d10e985 analyze: show generators on plot 2013-06-02 22:26:05 +02:00
Zbigniew Jędrzejewski-Szmek 1058cbf2ad systemctl: suggest 'systemctl daemon-reload' without --system
--system is default anyway, and some poor user might type 9
characters without needing to.
2013-05-30 20:44:41 -04:00
Zachary Cook 4f8d551ff0 systemd: record efi timestamps after /sys is mounted
This partially reverts commit c3a170f3, which moved
efi_get_boot_timestamps too early in main(), before
/sys is assured to be mounted

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

[tomegun: in particular /sys/firmware/efi/efivars needs to be
mounted, which is not a problem if a systemd-initramfs containing
the correct module is being used. But not everyone uses an
initramfs...]
2013-05-29 15:36:05 +02:00
Eelco Dolstra f49fd1d57a Start ctrl-alt-del.target irreversibly
This makes ctrl-alt-del reboots more robust, just like "systemctl
reboot".
2013-05-09 18:13:33 -04:00
Lennart Poettering 31afa0a44c unit: rework stop pending logic
When a trigger unit wants to know if a stop is queued for it, we should
just check precisely that and do not check whether it is actually
stopped already. This is because we use these checks usually from state
change calls where the state variables are not updated yet.

This change splits unit_pending_inactive() into two calls
unit_inactive_or_pending() and unit_stop_pending(). The former checks
state and pending jobs, the latter only pending jobs.
2013-04-25 22:01:49 -03:00
Harald Hoyer c3a170f3d3 systemd: record the timestamps as early as possible
The time for systemd initialization and selinux policy loading
is accounted to the initrd or the kernel, which is wrong.

Instead of:

Startup finished in 5.559s (firmware) + 36ms (loader) + 665ms (kernel) +
975ms (initrd) + 1.410s (userspace) = 8.647s

the more correct output is:

Startup finished in 5.559s (firmware) + 36ms (loader) + 665ms (kernel) +
475ms (initrd) + 1.910s (userspace) = 8.647s
2013-04-25 09:13:05 +02:00
Zbigniew Jędrzejewski-Szmek ef42202ac8 Add set_consume which always takes ownership
Freeing in error path is the common pattern with set_put().
2013-04-24 00:25:04 -04:00
Harald Hoyer 7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Zbigniew Jędrzejewski-Szmek 44df3e637f systemd: ignore hw timestamps in containers
They are irrelevant and misleading.

E.g. systemd-analyze:

  Startup finished in 6d 4h 15min 32.330s (kernel) + 49ms 914us (userspace) = 6d 4h 15min 32.380s

becomes

Startup finished in 53.735ms (userspace) = 53.735ms

which looks much better :)
2013-04-17 00:09:16 -04:00
Harald Hoyer b3680f49e2 Do not serialize environment, when switching root
When switching root, i.e. LANG can be set to the locale of the initramfs
or "C", if it was unset. When systemd deserializes LANG in the real root
this would overwrite the setting previously gathered by locale_set().

To reproduce, boot with an initramfs without locale.conf or change
/etc/locale.conf to a different language than the initramfs and check a
daemon started by systemd:

$ tr "$\000" '\n' </proc/$(pidof sshd)/environ | grep LANG
LANG=C

To prevent that, serialization of environment variables is skipped, when
serializing for switching root.

https://bugzilla.redhat.com/show_bug.cgi?id=949525
2013-04-08 14:45:19 +02:00
Zbigniew Jędrzejewski-Szmek b92bea5d2a Use initalization instead of explicit zeroing
Before, we would initialize many fields twice: first
by filling the structure with zeros, and then a second
time with the real values. We can let the compiler do
the job for us, avoiding one copy.

A downside of this patch is that text gets slightly
bigger. This is because all zero() calls are effectively
inlined:

$ size build/.libs/systemd
         text    data     bss     dec     hex filename
before 897737  107300    2560 1007597   f5fed build/.libs/systemd
after  897873  107300    2560 1007733   f6075 build/.libs/systemd

… actually less than 1‰.

A few asserts that the parameter is not null had to be removed. I
don't think this changes much, because first, it is quite unlikely
for the assert to fail, and second, an immediate SEGV is almost as
good as an assert.
2013-04-05 19:50:57 -04:00
Lennart Poettering 5c0d398dfc util: add a bit of syntactic sugar to run short code fragments with a different umask 2013-04-04 03:39:39 +02:00
Lennart Poettering 2fa4092c28 util: make time formatting a bit smarter
Instead of outputting "5h 55s 50ms 3us" we'll now output "5h
55.050003s". Also, while outputting the accuracy is configurable.

Basically we now try use "dot notation" for all time values > 1min. For
>= 1s we use 's' as unit, otherwise for >= 1ms we use 'ms' as unit, and
finally 'us'.

This should give reasonably values in most cases.
2013-04-04 02:56:56 +02:00
Zbigniew Jędrzejewski-Szmek 7989e1f2d7 Partially revert e62d8c3944
The ~80 chars per line part wasn't well received.
2013-03-31 19:50:30 -04:00
Zbigniew Jędrzejewski-Szmek e62d8c3944 Modernization
Use _cleanup_ and wrap lines to ~80 chars and such.
2013-03-31 14:36:12 -04:00
Michal Sekletar c17ec25e4d core: reuse the same /tmp, /var/tmp and inaccessible dir
All Execs within the service, will get mounted the same
/tmp and /var/tmp directories, if service is configured with
PrivateTmp=yes. Temporary directories are cleaned up by service
itself in addition to systemd-tmpfiles. Directory which is mounted
as inaccessible is created at runtime in /run/systemd.
2013-03-15 22:56:40 -04:00
Michal Schmidt 6282c859bd util, manager: and mempset() and use it
Just like mempcpy() is almost identical to memcpy() except the useful
return value, so is the relation of mempset() to memset().
2013-03-13 14:14:13 +01:00
Michal Schmidt 5052495bba manager: use more stpcpy() 2013-03-13 14:14:00 +01:00
Michal Schmidt 5b176ee064 manager: push back animation timer whenever a job finishes
The running jobs animation is supposed to hide itself when jobs are
progressing sufficiently fast.
2013-03-13 00:13:24 +01:00
Enrico Scholz f1324eaa68 manager: remove timer fd explicitly from epoll
Forked processes can keep the old fd alive triggering epoll over and
over again else.

https://bugs.freedesktop.org/show_bug.cgi?id=61697
2013-03-06 17:16:13 +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
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
Lukas Nykryn 34bf02818d manager: print p and then free it 2013-03-01 16:43:57 -05: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 5a82a91a99 manager: prevent segfault in manager_print_jobs_in_progress() 2013-03-01 15:05:28 +01:00
Michal Schmidt 03b717a3c4 core/manager: print status messages about running jobs
Sometimes the boot gets stuck until a timeout hits. The usual timeouts
are on the order of minutes, so users may lose patience.

Print animated status messages telling the names of units with running
jobs to make it easy to see what systemd is waiting for.

The animation looks cooler with a shorter interval, but 1 s is OK and
should not be too hard on slow serial console users.
2013-02-28 02:24:02 +01:00
Michal Schmidt 984a2be450 util, core: add support for ephemeral status lines
Ephemeral status lines do not end with a newline and they expect to be
overwritten by the next printed status line.
2013-02-28 02:23:27 +01:00
Michal Schmidt 6084e22e57 core/manager: make a couple of functions static
They're not used outside manager.c anymore.
2013-02-28 02:23:14 +01:00
Michal Schmidt 25cee55076 core: add manager_status_printf()
unit_status_printf() checks the state of the manager, not of the unit
as such. Move it to manager.c and rename it to manager_status_printf().

Temporarily keep unit_status_printf as a wrapper macro.
2013-02-28 00:14:40 +01:00
Michal Schmidt 23ade460e5 core, systemctl: add support for irreversible jobs
Add a new job mode: replace-irreversibly. Jobs enqueued using this mode
cannot be implicitly canceled by later enqueued conflicting jobs.
They can however still be canceled with an explicit "systemctl cancel"
call.
2013-02-22 16:06:17 +01:00
Lennart Poettering b872e9a059 build-sys: make EFI support build-time optional 2013-02-13 23:08:25 +01:00
Oleksii Shevchuk 4a9fd066f0 manager: pass environment over daemon-reexec
Fixes this bug:
alxchk > systemctl --user set-environment A=B
alxchk > systemctl --user show-environment | grep ^A=
A=B
alxchk > systemctl --user daemon-reexec
alxchk > systemctl --user show-environment | grep ^A=
alxchk >
2013-02-13 00:17:17 +01:00
Lennart Poettering 8b55b8c4e7 manager: clean environment before passing it on to others 2013-02-11 23:54:30 +01:00
Zbigniew Jędrzejewski-Szmek 7ad94c716d systemd: raise level of message about lookup paths
This can be pretty important for the user, and is not trivial
to figure out in all cases.

Also show failing path in error messages.
2013-02-06 23:16:17 -05:00
Zbigniew Jędrzejewski-Szmek 874310b7b6 systemd: do not remove empty paths from unit lookup path
The ability to start a new unit with 'systemctl start ...' should not
depend on whether there are other units in the directory. Previously,
an additional 'systemctl daemon-reload' would be necessary to tell
systemd to update the list of unit lookup paths.
2013-02-06 23:16:16 -05:00
Zbigniew Jędrzejewski-Szmek c3e31c7ba1 Replace autoconf int max test with simple define 2013-01-22 23:20:15 -05:00
Eelco Dolstra 2813720202 Fix some typos 2013-01-22 10:03:16 -05:00
Lennart Poettering 2e3d069236 core: if the bootloader supports it, determine firmware and boot loader delay
This allows us to print simple performance data of all parts of the boot now:

- firmware
- boot loader
- kernel
- initrd
- userspace

This only works for bootloaders which support passing TSC data via EFI
variables. As of now that's only gummiboot.
2013-01-19 04:22:09 +01:00
Zbigniew Jędrzejewski-Szmek d6a195a3c3 build-sys: add autoconf macro to pick macro for x32 compatibility 2013-01-18 17:04:50 -05:00