Commit graph

893 commits

Author SHA1 Message Date
Lennart Poettering ce38dbc84b nspawn: when running in a service unit, use systemd for restarts
THis way we can remove cgroup priviliges after setup, but get them back
for the next restart, as we need it.
2014-07-03 12:51:07 +02:00
Lennart Poettering 7caa86ac4d man: document systemd-update-done.service 2014-07-01 00:16:48 +02:00
Lennart Poettering 8ebf02d6f3 units: skip mounting /tmp if it is a symlink
We shouldn't get confused if people have symlinked /tmp somewhere, so
let's simply skip the mount then.
2014-06-30 22:49:10 +02:00
Tom Gundersen 3005a221f1 units: networkd - don't order wait-online.service before network.target
Reported by Michael Olbrich.
2014-06-30 13:06:33 +02:00
Tom Gundersen 1f87d09e98 units: local-fs.target - don't pull in default dependencies
Reported by Gerardo Exequiel Pozzi:

Looks like [commit a4a878d0] also changes a unrelated file
(units/local-fs.target) [partially]reverting the commit
40f862e3 (filesystem targets: disable default dependencies)

The side effect, at least in my case is that the "nofail" option in both
"crypttab" and "fstab" has partial effect does the default timeout
instead of continue normal boot without timeout.
2014-06-29 16:20:33 +02:00
Zbigniew Jędrzejewski-Szmek 0fdeb6e011 units: remove RefuseManualStart from units which are always around
In a normal running system, non-passive targets and units used during
early bootup are always started. So refusing "manual start" for them
doesn't make any difference, because a "start" command doesn't cause
any action.

In early boot however, the administrator might want to start on
of those targets or services by hand. We shouldn't interfere with that.

Note: in case of systemd-tmpfiles-setup.service, really running the
unit after system is up would break the system. So e.g. restarting
should not be allowed. The unit has "RefuseManualStop=yes", which
prevents restart too.
2014-06-28 00:06:30 -04:00
Cristian Rodríguez 0b73eab7a2 units/systemd-sysctl.service.in: run after load-modules
Modules might or will register new sysctl options.

[zj: This mechanism of adding modules just to reliably set sysctl
attributes is not ideal. Nevertheless, sysctl for dynamically created
attributes is simply broken, and this is the easiest workaround.]

https://bugzilla.redhat.com/show_bug.cgi?id=1022977
https://bugzilla.novell.com/show_bug.cgi?id=725412
2014-06-19 20:21:24 -04:00
Lennart Poettering 497d1986c1 units: order systemd-tmpfiles-clean.service after time-sync.target
That way, on systems lacking an RTC we don't false start removing aged
files too early.
2014-06-20 00:15:39 +02:00
Lennart Poettering a55954297d units: add missing caps so that GetAddresses() can work 2014-06-19 19:53:16 +02:00
Lennart Poettering 9542239eaf cryptsetup: introduce new cryptsetup-pre.traget unit so that services can make sure they are started before and stopped after any LUKS setup
https://bugzilla.redhat.com/show_bug.cgi?id=1097938
2014-06-18 00:09:46 +02:00
Kay Sievers 01b85ba3ad timesyncd: do not start in virtualized environments 2014-06-17 03:34:09 +02:00
Lennart Poettering 689d781b87 units: minor cleanups 2014-06-17 02:43:44 +02:00
Lennart Poettering 324d7a53b9 networkd: don't pull in systemd-networkd-wait-online service from systemd-networkd when enabling
networkd-wait-online should never exist in the default transaction,
unless explicitly enable or pulled in via things like NFS. However, just
enabling networkd shouldn't enable networkd-wait-online, since it's
common to use the former without the latter.
2014-06-17 02:43:44 +02:00
Lennart Poettering d54c499369 install: introduce new DefaultInstance= field for [Install] sections
The DefaultInstance= name is used when enabling template units when only
specifying the template name, but no instance.

Add DefaultInstance=tty1 to getty@.service, so that when the template
itself is enabled an instance for tty1 is created.

This is useful so that we "systemctl preset-all" can work properly,
because we can operate on getty@.service after finding it, and the right
instance is created.
2014-06-17 02:43:43 +02:00
Lennart Poettering 137243fd13 units: add a service to invoke ldconfig on system updates at boot 2014-06-16 12:33:22 +02:00
Lennart Poettering b63bb8a724 units: drop RefuseManualStart= from a couple of update services
The only update service we really need to guard like this is
systemd-tmpfiles-setup.service since if invoked manually might create
/var/run/nologin and thus blocking the user from login. The other
services are pretty much idempotent and don't suffer by this problem,
hence let's simplify them.
2014-06-16 12:25:49 +02:00
Lennart Poettering 2db7648aa8 units: bring systemd-tmpfiles-setup-dev.service closer to systemd-tmpfiles-setup.service
Among other things, order both services relative to
systemd-sysusers.service in the same direction.
2014-06-15 23:42:53 +02:00
Kay Sievers 3a0efd7030 sysusers: order before tmpfiles which need the ids 2014-06-14 22:17:15 +02:00
Lennart Poettering b532bdeae9 rpm: add RPM macros to apply sysusers, sysctl, and binfmt drop-ins
With this in place RPMs can make sure that whatever they drop in is
immeidately applied, and not delayed until next reboot.

This also moves systemd-sysusers back to /usr/bin, since hardcoding the
path to /usr/lib in the macros would mean compatibility breaks in
future, should we turn sysusers into a command that is actually OK for
people to call directly. And given that that is quite likely to happen
(since it is useful to prepare images with its --root= switch), let's
just prepare for it.
2014-06-13 20:11:59 +02:00
Lennart Poettering ecde7065f7 units: rebuild /etc/passwd, the udev hwdb and the journal catalog files on boot
Only when necessary of course, nicely guarded with the new
ConditionNeedsUpdate= condition we added.
2014-06-13 13:26:32 +02:00
Lennart Poettering a55654d598 core: add new ConditionNeedsUpdate= unit condition
This new condition allows checking whether /etc or /var are out-of-date
relative to /usr. This is the counterpart for the update flag managed by
systemd-update-done.service. Services that want to be started once after
/usr got updated should use:

        [Unit]
        ConditionNeedsUpdate=/etc
        Before=systemd-update-done.service

This makes sure that they are only run if /etc is out-of-date relative
to /usr. And that it will be executed after systemd-update-done.service
which is responsible for marking /etc up-to-date relative to the current
/usr.

ConditionNeedsUpdate= will also checks whether /etc is actually
writable, and not trigger if it isn't, since no update is possible then.
2014-06-13 13:26:32 +02:00
Lennart Poettering 8ea48dfcd3 update-done: add minimal tool to manage system updates for /etc and /var, if /usr has changed
In order to support offline updates to /usr, we need to be able to run
certain tasks on next boot-up to bring /etc and /var in line with the
updated /usr. Hence, let's devise a mechanism how we can detect whether
/etc or /var are not up-to-date with /usr anymore: we keep "touch
files" in /etc/.updated and /var/.updated that are mtime-compared with
/usr. This means:

Whenever the vendor OS tree in /usr is updated, and any services that
shall be executed at next boot shall be triggered, it is sufficient to
update the mtime of /usr itself. At next boot, if /etc/.updated and/or
/var/.updated is older than than /usr (or missing), we know we have to
run the update tools once. After that is completed we need to update the
mtime of these files to the one of /usr, to keep track that we made the
necessary updates, and won't repeat them on next reboot.

A subsequent commit adds a new ConditionNeedsUpdate= condition that
allows checking on boot whether /etc or /var are outdated and need
updating.

This is an early step to allow booting up with an empty /etc, with
automatic rebuilding of the necessary cache files or user databases
therein, as well as supporting later updates of /usr that then propagate
to /etc and /var again.
2014-06-13 13:26:32 +02:00
Lennart Poettering d4c049bfcd units: don't conditionalize sysctl service
We install two sysctl snippets ourselves, hence the condition will
always trigger, so no point in tryng to optimize things with this, it
just will make things slower, if anything.
2014-06-13 13:26:32 +02:00
Lennart Poettering db62b5b37e units: remove conditions from systemd-tmpfiles-setup
There's no point in conditionalizing systemd-tmpfiles at boot, since we
ship tmpfiles snippets ourselves, hence they will always trigger anyway.

Also, there's no reason to pull in local-fs.target from the service,
hence drop that.
2014-06-13 13:26:32 +02:00
Kay Sievers 0138a2dcc5 debug-shell: add condition for tty device to run on 2014-06-12 22:26:43 +02:00
Lennart Poettering 58e027023b units: order network-online.target after network.target
There might be implementations around where the network-online logic
might not talk to any network configuration service (and thus not have
to wait for it), hence let's explicitly order network-online.target
after network.target to avoid any ambiguities.
2014-06-11 15:00:45 +02:00
Lennart Poettering 96bf4ee252 units: time-sync.target probably makes sense, is not just sysv compat 2014-06-11 12:14:55 +02:00
Lennart Poettering a4a878d040 units: introduce network-pre.target as place to hook in firewalls
network-pre.target is a passive target that should be pulled in by
services that want to be executed before any network is configured (for
example: firewall scrips).

network-pre.target should be ordered before all network managemet
services (but not be pulled in by them).

network-pre.target should be order after all services that want to be
executed before any network is configured (and be pulled in by them).
2014-06-11 12:14:55 +02:00
Mantas Mikulėnas 62be1c9aab bus-proxy: fix misplaced s/system/session/ 2014-06-10 19:34:34 +02:00
Lennart Poettering 2e2b36084a bus-proxy: read the right policy when running in user mode 2014-06-10 17:56:51 +02:00
Lennart Poettering 55152b6ede units: pull in time-sync.target from systemd-timedated.service
After all, that's what we document for time-sync.target in
systemd.special(5), hence let's follow our own suggestion.
2014-06-06 16:20:33 +02:00
Lennart Poettering 3c52ad9237 units: fix minor typo 2014-06-06 14:38:04 +02:00
Lennart Poettering 1b8689f949 core: rename ReadOnlySystem= to ProtectSystem= and add a third value for also mounting /etc read-only
Also, rename ProtectedHome= to ProtectHome=, to simplify things a bit.

With this in place we now have two neat options ProtectSystem= and
ProtectHome= for protecting the OS itself (and optionally its
configuration), and for protecting the user's data.
2014-06-04 18:12:55 +02:00
Lennart Poettering 7e9f159ca7 initctl: move /dev/initctl fifo into /run, replace it by symlink
With this change we have no fifos/sockets remaining in /dev.
2014-06-04 16:53:58 +02:00
Lennart Poettering 03ee5c38cb journald: move /dev/log socket to /run
This way we can make the socket also available for sandboxed apps that
have their own private /dev. They can now simply symlink the socket from
/dev.
2014-06-04 16:53:58 +02:00
Lennart Poettering 6a010ac9e5 bus-proxy: drop priviliges if we can
Either become uid/gid of the client we have been forked for, or become
the "systemd-bus-proxy" user if the client was root. We retain
CAP_IPC_OWNER so that we can tell kdbus we are actually our own client.
2014-06-04 11:13:08 +02:00
Kay Sievers 72543b361d remove ReadOnlySystem and ProtectedHome from udevd and logind
logind needs access to /run/user/, udevd fails during early boot
with these settings
2014-06-04 01:41:15 +02:00
Lennart Poettering 417116f234 core: add new ReadOnlySystem= and ProtectedHome= settings for service units
ReadOnlySystem= uses fs namespaces to mount /usr and /boot read-only for
a service.

ProtectedHome= uses fs namespaces to mount /home and /run/user
inaccessible or read-only for a service.

This patch also enables these settings for all our long-running services.

Together they should be good building block for a minimal service
sandbox, removing the ability for services to modify the operating
system or access the user's private data.
2014-06-03 23:57:51 +02:00
Tom Gundersen 682265d5e2 resolved: run as unpriviliged "systemd-resolve" user
This service is not yet network facing, but let's prepare nonetheless.
Currently all caps are dropped, but some may need to be kept in the
future.
2014-06-03 10:40:28 +02:00
Tom Gundersen bddfc8afd3 networkd: drop CAP_SYS_MODULE
Rely on modules being built-in or autoloaded on-demand.

As networkd is a network facing service, we want to limits its capabilities,
as much as possible. Also, we may not have CAP_SYS_MODULE in a container,
and we want networkd to work the same there.

Module autoloading does not always work, but should be fixed by the kernel
patch f98f89a0104454f35a: 'net: tunnels - enable module autoloading', which
is currently in net-next and which people may consider backporting if they
want tunneling support without compiling in the modules.

Early adopters may also use a module-load.d snippet and order
systemd-modules-load.service before networkd to force the module
loading of tunneling modules.

This sholud fix the various build issues people have reported.
2014-06-03 00:40:23 +02:00
Lennart Poettering d3cf48f4bd networkd: run as unpriviliged "systemd-network" user
This allows us to run networkd mostly unpriviliged with the exception of
CAP_NET_* and CAP_SYS_MODULE. I'd really like to get rid of the latter
though...
2014-06-01 09:12:00 +02:00
Lennart Poettering 40393d5247 units: remove CAP_SYS_PTRACE capability from hostnamed/networkd
The ptrace capability was only necessary to detect virtualizations
environments. Since we changed the logic to determine this to not
require priviliges, there's no need to carry the CAP_SYS_PTRACE
capability anymore.
2014-06-01 08:54:09 +02:00
Jonathan Liu d8e40d62ab units: use KillMode=mixed for systemd-nspawn@.service
This causes the container to shut down cleanly when the service is
stopped.
2014-05-30 09:36:29 -04:00
Kay Sievers d636d37679 timesyncd: only update stamp file when we are synchronized
Create initial stamp file with compiled-in time to prevent bootups
with clocks in the future from storing invalid timestamps.

At shutdown, only update the timestamp if we got an authoritative
time to store.
2014-05-24 08:04:56 +08:00
Kay Sievers 52ffb444cb timesyncd: order after tmpfiles to get a working network monitor 2014-05-22 07:57:33 +09:00
Lennart Poettering ece6e766cf timesyncd: save clock to disk everytime we get an NTP fix, and bump clock at boot using this
This is useful to make sure the system clock stays monotonic even on
systems that lack an RTC.

Also, why we are at it, also use the systemd release time for bumping
the clock, since it's a slightly less bad than starting with jan 1st,
1970.

This also moves timesyncd into the early bootphase, in order to make
sure this initial bump is guaranteed to have finished by the time we
start real daemons which might write to the file systemd and thus
shouldn't leave 1970's timestamps all over the place...
2014-05-21 00:23:39 +09:00
Tom Gundersen 091a364c80 resolved: add daemon to manage resolv.conf
Also remove the equivalent functionality from networkd.
2014-05-19 18:14:56 +02:00
Lennart Poettering 9f7115498b timesyncd: enable watchdog support 2014-05-18 20:52:49 +09:00
Lennart Poettering a349eb10d3 timesyncd: run timesyncd as unpriviliged user "systemd-timesync" (but still with CAP_SYS_TIME) 2014-05-18 20:52:49 +09:00
Tom Gundersen 7da489e630 Revert "networkd: order after udev kernel socket"
This reverts commit a555350d47.

This did not fix the problem, just made it harder to hit.
2014-05-16 14:52:02 +02:00
Lennart Poettering e3ad07d21c timesyncd: limit capabilities to CAP_SYS_TIME 2014-05-15 18:55:19 +02:00
Tom Gundersen 0968137439 timesyncd: start after networkd
This is needed for the network monitor to work (as it requires networkd to set up the correct directories first).
2014-05-13 12:44:22 +02:00
Tom Gundersen 7c8ec321e7 networkd: unit - add cap to load modules
Remember to drop this when the kernel gains autoloading for all netdev kinds.
2014-05-12 17:37:52 +02:00
Kay Sievers a91df40e69 timesyncd: add unit and man page 2014-04-29 09:51:53 +02:00
Tom Gundersen 3a67e927e3 networkd-wait-online: improve interoptability and enable by default
To make sure we don't delay boot on systems where (some) network links are managed by someone else
we don't block if something else has successfully brought up a link.

We will still block until all links we are aware of that are  managed by networkd have been
configured, but if no such links exist, and someone else have configured a link sufficiently
that it has a carrier, it may be that the link is ready so we should no longer block.

Note that in all likelyhood the link is not ready (no addresses/routes configured),
so whatever network managment daemon configured it should provide a similar wait-online
service to block network-online.target until it is ready.

The aim is to block as long as we know networking is not fully configured, but no longer. This
will allow systemd-networkd-wait-online.service to be enabled on any system, even if we don't
know whether networkd is the main/only network manager.

Even in the case networking is fully configured by networkd, the default behavior may not be
sufficient: if two links need to be configured, but the first is fully configured before the
second one appears we will assume the network is up. To work around that, we allow specifying
specific devices to wait for before considering the network up.

This unit is enabled by default, just like systemd-networkd, but will only be pulled in if
anyone pulls in network-online.target.
2014-04-24 00:23:07 +02:00
Kay Sievers 0fbedd1fdc remove bus-driverd, the interface is now handled natively by bus-proxyd 2014-04-22 19:31:26 +02:00
Tom Gundersen a555350d47 networkd: order after udev kernel socket
Otherwise we will not be able to queuery whether devices are initialized on kdbus enabled systems.
2014-04-19 22:13:49 +02:00
Kay Sievers 4851ac4526 bus: provide org.freedesktop.systemd1.busname for systemd --user 2014-03-26 03:38:48 +01:00
Tom Gundersen 6c7c89dfc6 networkd: add CapabilityBoundingSet 2014-03-24 17:13:24 +01:00
Lennart Poettering 48791a98be units: networkd shouldn't have PrivateTmp= set, since it runs in early-boot
/tmp is only available in later boot, and we shouldn't create private
subdirs in it hence, while we are still in early boot.
2014-03-24 16:48:39 +01:00
Lennart Poettering c2c13f2df4 unit: turn off mount propagation for udevd
Keep mounts done by udev rules private to udevd. Also, document how
MountFlags= may be used for this.
2014-03-20 04:16:39 +01:00
Lennart Poettering f21a71a907 core: enable PrivateNetwork= for a number of our long running services where this is useful 2014-03-19 23:25:28 +01:00
Lennart Poettering d99a705296 units: make use of PrivateTmp=yes and PrivateDevices=yes for all our long-running daemons 2014-03-19 19:09:00 +01:00
Daniel Mack 5892a914d1 busname: introduce Activating directive
Add a new config 'Activating' directive which denotes whether a busname
is actually registered on the bus. It defaults to 'yes'.

If set to 'no', the .busname unit only uploads policy, which will remain
active as long as the unit is running.
2014-03-19 02:25:36 +01:00
Hendrik Brueckner fc6c7fe9be getty: Start getty on 3270 terminals available on Linux on System z
Add the first 3270 terminal device that is associated with the Linux preferred
console to the list of virtualization consoles.  This is required to
automatically start a getty if the conmode=3270 kernel parameter is specified
for Linux on z/VM instances.  Note that a queued upstream patch also enable
the 3270 terminal device if it is associated with the Linux preferred console.
How

To successfully start agetty on a 3270 terminal, a change in the agetty
parameter order is required.  Previously, agetty would started like this:

    /sbin/agetty --keep-baud 3270/tty1 115200,38400,9600 TERM

The agetty program interprets the "3270/tty1" as baud rate and fails to start
with the "bad speed: 3270/tty1" error message.  Fixing this in agetty is more
complex rather than reordering the command line parameters like this:

    /sbin/agetty --keep-baud 115200,38400,9600 3270/tty1 TERM

According to agetty sources and "agetty --help", agetty accepts the "tty",
"baudrate tty", and "tty baudrate" specifications.

P.S. The "tty: Set correct tty name in 'active' sysfs attribute" introduces
     a change to display the terminal device which is associated with the
     Linux preferred console.  This change helps to let systemd handle this
     particular case only.  Without the changes of this commit, no additional
     3270 terminal device can be managed by systemd.

     https://git.kernel.org/cgit/linux/kernel/git/gregkh/tty.git/commit/?id=723abd87f6e536f1353c8f64f621520bc29523a3
2014-03-13 10:42:26 +01:00
Kay Sievers d5ce683c07 units: remove "AllowUser=root own", the bus owner can always own names 2014-03-08 19:38:06 +01:00
Daniel Mack fe8d029277 units: set 'AllowUser=root own' and 'AllowWorld=talk' own for all .busname files 2014-03-07 19:19:02 +01:00
Thomas Bächler 6c49212741 units: Do not unescape instance name in systemd-backlight@.service
The instance name is never escaped in the udev rule, but unescaped in the unit.
This results in the following error message on Asus boards:

  Failed to get backlight or LED device 'backlight:eeepc/wmi': No such file or directory
2014-03-07 00:30:56 -05:00
Lennart Poettering 9533ad1f42 units: don't use the word 'Reboot' for Startup, but simply 'Boot' 2014-03-06 05:04:51 +01:00
Lennart Poettering d1a6f44125 units: properly capitalize the unit description 2014-03-06 05:04:51 +01:00
Zbigniew Jędrzejewski-Szmek 1ae383a8a3 Use /var/run/dbus/system_bus_socket for the D-Bus socket 2014-02-25 21:26:42 -05:00
Zbigniew Jędrzejewski-Szmek 7143555ce8 units/serial-getty@.service: add [Install] section
This makes it easier to manually enable and disable
specific gettys, and also mirrors getty@.service.

http://lists.freedesktop.org/archives/systemd-devel/2014-February/017329.html
2014-02-24 08:07:34 -05:00
Jason A. Donenfeld c4a0b20c7a install: do not statically enable systemd-networkd
[tomegun: pruned the commit message as not to contradict the follow-up commit]
2014-02-21 14:37:53 +01:00
Zbigniew Jędrzejewski-Szmek 8f9c6fe5ff units: systemd-logind fails hard without dbus
That is, without --enable-kdbus and kdbus running.

With --enable-kdbus things are more complicated, because dbus might be
necessary, if kdbus is missing at runtime. If it is not necessary,
the socket will be started, which is not imporant, but not the service.
2014-02-14 19:00:32 -05:00
Lennart Poettering c480d2f8bc units: make use of nspawn's --keep-unit switch in systemd-nspawn@.service 2014-02-11 21:13:51 +01:00
Lennart Poettering 58ea275a68 core: introduce new KillMode=mixed which sends SIGTERM only to the main process, but SIGKILL to all daemon processes
This should fix some race with terminating systemd --user, where the
system systemd instance might race against the user systemd instance
when sending SIGTERM.
2014-01-29 13:42:06 +01:00
Tom Gundersen bcbca8291f networkd: don't hard depend on system bus
We may not have a dbus daemon in the initrd (until we can rely on kdbus). In
this case, simply ignore any attempts at using the bus. There is only one user
for now, but surely more to come.

In order to work reliably in the real root without kdbus, but at the same time
don't delay boot when kdbus is in use, order ourselves after dbus.service.
2014-01-18 01:56:41 +01:00
Lennart Poettering 02ebe178a2 units: drop [Install] section from multi-user.target and graphical.target
They were supposed to make it easy to make the default.target a symlink
to these targets, but this was never advertised and we have a better
command for this now in "systemctl set-default". Since the install
section makes the output of "systemctl list-unit-files" confusing (since
it makes the units appear as "disabled"), let's drop the sections.
2014-01-17 20:27:35 +01:00
Tom Gundersen 1346b1f038 sd-dhcp-client/networkd: add transient hostname support 2014-01-16 20:32:08 +01:00
Zbigniew Jędrzejewski-Szmek d8160f21fd Improve messages about user mode a bit 2014-01-08 22:15:27 -05:00
Kay Sievers 8b255ecd99 pam_systemd: export DBUS_SESSION_BUS_ADDRESS 2014-01-08 18:11:37 +08:00
Kay Sievers 54142c6af1 bus-driverd: support user mode 2014-01-08 08:38:39 +08:00
Kay Sievers 7ca7b61f70 bus-proxyd: support --user bus address 2014-01-08 08:38:39 +08:00
Kay Sievers 1bc86acd10 bus-proxyd: --user -- add Accept=yes to socket 2014-01-07 06:44:55 +08:00
Kay Sievers fccd44ec3a core: --user -- add basic.target an sort against it like --system does 2014-01-07 01:35:25 +08:00
Kay Sievers 734624951b bus-proxyd: fix socket path 2014-01-07 01:33:58 +08:00
Zbigniew Jędrzejewski-Szmek 8181565124 tmpfiles: rename --unsafe to --boot
As suggested by Kay, it is better to describe what is done,
not what might happen.
2013-12-30 13:01:27 -05:00
Marc-Antoine Perennou 08c51903fb gitignore: add back user@.service 2013-12-28 15:19:25 +01:00
Zbigniew Jędrzejewski-Szmek 4acbce7979 build-sys: fix generation of user@.service 2013-12-27 12:12:41 -05:00
Mantas Mikulėnas 3dc9f55d6e units: user@.service: fix user bus path 2013-12-27 12:12:41 -05:00
Zbigniew Jędrzejewski-Szmek c4708f1323 tmpfiles: introduce the concept of unsafe operations
Various operations done by systemd-tmpfiles may only be safely done at
boot (e.g. removal of X lockfiles in /tmp, creation of /run/nologin).
Other operations may be done at any point in time (e.g. setting the
ownership on /{run,var}/log/journal). This distinction is largely
orthogonal to the type of operation.

A new switch --unsafe is added, and operations which should only be
executed during bootup are marked with an exclamation mark in the
configuration files. systemd-tmpfiles.service is modified to use this
switch, and guards are added so it is hard to re-start it by mistake.

If we install a new version of systemd, we actually want to enforce
some changes to tmpfiles configuration immediately. This should now be
possible to do safely, so distribution packages can be modified to
execute the "safe" subset at package installation time.

/run/nologin creation is split out into a separate service, to make it
easy to override.

https://bugzilla.redhat.com/show_bug.cgi?id=1043212
https://bugzilla.redhat.com/show_bug.cgi?id=1045849
2013-12-24 15:48:06 -05:00
Zbigniew Jędrzejewski-Szmek ef72c1f06e man,units: tmpfiles.d(5) cleanup
Condition for /lib (necessary for split /usr) was missing from the unit.

Some changes which were done in tmpfiles.d(5) were not carried over to
systemd-tmpfiles(1).

Also use markup where possible.
2013-12-24 15:48:06 -05:00
Lennart Poettering 9a8112f5e9 units: systemd-machined now exits on idle and we shouldn't try to restart it then 2013-12-23 20:37:03 +01:00
Lennart Poettering 5326b03f30 units: limit caps for bus proxyd and driverd services 2013-12-23 20:37:00 +01:00
Lennart Poettering 0721804f03 bus: send status message from proxyd to systemd about client we are working for 2013-12-21 05:15:09 +01:00
Lennart Poettering ccf22d4a10 units: when spawning a getty configure TERM explicitly
This way we can make use of our logic to automatically determine an
appropriate TERM for a specific tty.
2013-12-18 18:21:28 +01:00
Lennart Poettering 74f9e0f203 units: run systemd-networkd.service only if CAP_NET_ADMIN capability is around
This has the effect that systemd-networkd won't run in containers
without network namespacing wher CAP_NET_ADMIN is (usually) not
available. It will still run in containers with network namespacing on
(where CAP_NET_ADMIN is usually avilable).

We might remove this condition check again if networkd provides services
to apps that also are useful in containers lacking network namespacing,
however, as long as it doesn't it should be handled like udevd and be
excluded in such containers.
2013-12-18 18:21:27 +01:00
Lennart Poettering 15e913230c bus: install unit files for new driver service 2013-12-17 15:42:33 +01:00
Kay Sievers eca7a27add bus: fix typo in systemd-bus-proxyd 2013-12-16 23:25:32 +01:00
Lennart Poettering 77e96a6247 units: properly make bus proxy socket of type Accept=yes 2013-12-16 21:06:57 +01:00
Lennart Poettering 7c9a6f9063 bus: install systemd-bus-proxyd unit files for compatibility with dbus1 2013-12-13 20:49:57 +01:00
Lennart Poettering b3de50cb07 units: don't run readahead done timers in containers
We don't run the collector in the container either, hence we don't need
to stop it either.
2013-12-11 23:31:34 +01:00
Lennart Poettering f9a810beda journald: port to sd-event and enable watchdog support 2013-12-11 20:55:09 +01:00
Lennart Poettering cde93897cd event: hook up sd-event with the service watchdog logic
Adds a new call sd_event_set_watchdog() that can be used to hook up the
event loop with the watchdog supervision logic of systemd. If enabled
and $WATCHDOG_USEC is set the event loop will ping the invoking systemd
daemon right after coming back from epoll_wait() but not more often than
$WATCHDOG_USEC/4. The epoll_wait() will sleep no longer than
$WATCHDOG_USEC/4*3, to make sure the service manager is called in time.

This means that setting WatchdogSec= in a .service file and calling
sd_event_set_watchdog() in your daemon is enough to hook it up with the
watchdog logic.
2013-12-11 18:20:09 +01:00
Lennart Poettering cde360cd5d units: ship busname units for the bus activated services we ship 2013-12-03 04:28:02 +01:00
Lennart Poettering 1b16c75cd2 units: install busnames.target by default 2013-12-03 01:18:26 +01:00
Lennart Poettering d420282b28 core: replace OnFailureIsolate= setting by a more generic OnFailureJobMode= setting and make use of it where applicable 2013-11-26 02:26:31 +01:00
Tom Gundersen 4b6141c424 networkd: use Type=notify
Also start earlier during boot.
2013-11-23 02:07:08 +01:00
Lennart Poettering 9f5eb56a13 timer: make timer accuracy configurable
And make it default to 1min
2013-11-21 22:08:20 +01:00
Zbigniew Jędrzejewski-Szmek 9cb74bcb23 man,units: fix installation of systemd-nspawn@.service and add example 2013-11-09 19:02:53 -05:00
Tom Gundersen f579559b3a networkd: add a basic network daemon
This daemon listens for and configures network devices tagged with
'systemd-networkd'. By default, no devices are tagged so this daemon
can safely run in parallel with existing network daemons/scripts.

Networks are configured in /etc/systemd/network/*.network. The first .network
file that matches a given link is applied. The matching logic is similar to
the one for .link files, but additionally supports matching on interface name.

The mid-term aim is to provide an alternative to ad-hoc scripts currently used
in initrd's and for wired setups that don't change much (e.g., as seen on
servers/and some embedded systems).

Currently, static addresses and a gateway can be configured.

Example .network file:

[Match]
Name=wlp2s0

[Network]
Description=My Network
Gateway=192.168.1.1
Address=192.168.1.23/24
Address=fe80::9aee:94ff:fe3f:c618/64
2013-11-09 23:41:17 +01:00
Lennart Poettering 04d3927924 machinectl: add new command to spawn a getty inside a container 2013-10-31 01:43:38 +01:00
Thomas Bächler 4952a9beff Remove FsckPassNo from systemd-fsck-root.service 2013-10-19 12:23:17 +02:00
Thomas Bächler 64e70e4b86 fstab-generator: Generate explicit dependencies on systemd-fsck@.service instead of using FsckPassNo
[tomegun:
  * order all fsck instances after fsck-root
  * check for OOM
  * added notes in the manpages]
2013-10-19 12:23:17 +02:00
Tom Gundersen a18535d9e1 static-nodes: don't call mkdir
This is no longer necessary with kmod-15. Bump the requirement.
2013-10-17 19:53:44 +02:00
Lennart Poettering 3990f24765 rfkill: add new rfkill tool to save/restore rfkill state across reboots
This works analogous to the existing backlight and random seed services
2013-10-14 04:31:49 +02:00
Zbigniew Jędrzejewski-Szmek 59fccd8211 execute.c: always set $SHELL
In e6dca81 $SHELL was added to user@.service. Let's
instead provide it to all units which have a user.
2013-10-02 22:23:56 +02:00
Dave Reisner 6c8c92fef7 fix lingering references to /var/lib/{backlight,random-seed}
This should have been part of ef5bfcf668.
2013-10-02 07:51:06 -04:00
David Herrmann 11c2f7a813 logind: run with CAP_SYS_ADMIN
DRM Master access requires CAP_SYS_ADMIN, yay! Add it to the capability
bounding set for systemd-logind. As CAP_SYS_ADMIN actually allows a huge
set of actions, this mostly renders the restriction-set useless. Anyway,
patches are already pending to reduce the restriction on the kernel side.
But these won't really make it into any stable-release so for now we're
stuck with CAP_SYS_ADMIN.
2013-10-01 17:59:44 +02:00
Evan Callicoat e6dca81441 units: Add SHELL environment variable
With the advent of systemd --user sessions, it's become very interesting to spawn X as a user unit, as well as accompanying processes that may have previously been in a .xinitrc/.xsession, or even just to replace a collection of XDG/GDM/KDM/etc session files with independent systemd --user units. The simplest case here would be to login on a tty, with the traditional /usr/sbin/login "login manager".

However, systemd --user (spawned by user@.service) is at the top level of the slice for the user, and does not inherit any environment variables from the login process. Given the number of common applications which rely on SHELL being set in the environment, it seems like the cleanest way to provide this variable is to set it to %s in the user@.service.

Ideally in the long-term, applications which rely on SHELL being set should be fixed to just grab it from getpwnam() or similar, but until that becomes more common, I propose this simple change to make user sessions a little bit nicer out of the box.
2013-10-01 04:17:31 +02:00
Dave Reisner 8083d486d0 kmod-static-nodes: condition execution on modules.devname 2013-09-28 14:51:39 -04:00
Eelco Dolstra a0f708053b Fix obsolete references to systemd-random-seed-load.service
This service was merged with systemd-random-seed-save.service in
c35b956d34.
2013-09-23 11:41:30 +02:00
Lennart Poettering 3331234adc nspawn: update unit file
ControlGroup= is obsolete, so let's drop it from the default nspawn unit
file.
2013-09-17 11:59:47 -05:00
Zbigniew Jędrzejewski-Szmek 5c390a4ae0 Add pam configuration to allow user sessions to work out of the box
systemd-logind will start user@.service. user@.service unit uses
PAM with service name 'systemd-user' to perform account and session
managment tasks. Previously, the name was 'systemd-shared', it is
now changed to 'systemd-user'.

Most PAM installations use one common setup for different callers.
Based on a quick poll, distributions fall into two camps: those that
have system-auth (Redhat, Fedora, CentOS, Arch, Gentoo, Mageia,
Mandriva), and those that have common-auth (Debian, Ubuntu, OpenSUSE).
Distributions that have system-auth have just one configuration file
that contains auth, password, account, and session blocks, and
distributions that have common-auth also have common-session,
common-password, and common-account. It is thus impossible to use one
configuration file which would work for everybody. systemd-user now
refers to system-auth, because it seems that the approach with one
file is more popular and also easier, so let's follow that.
2013-09-11 15:35:06 -04:00
Tom Gundersen 40f862e3ae filesystem targets: disable default dependencies
This means we can use default dependencies on mount units without having to get them automatically
ordered before the filesystem targets.

Reported-by: Thomas Baechler <thomas@archlinux.org>
2013-09-11 14:40:58 +02:00
Khem Raj 67c15b9a7a use CAP_MKNOD ConditionCapability
Fixes errors seen when booting VMs on QEMU like

systemd[1]: kmod-static-nodes.service: main process exited, code=exited, status=203/EXEC
systemd[1]: Failed to start Create list of required static device nodes for the current kernel.
systemd[1]: Unit kmod-static-nodes.service entered failed state.

Make sure that mknod capability is available

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2013-08-22 00:52:14 -04:00
Zbigniew Jędrzejewski-Szmek 219061dc52 units: disable kmod-static-nodes.service in containers
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=998122.

Note: upstream kmod has a patch [1] to exit with a warning if
modules.devname is missing. We could use new %v specifier to make this
service conditional on the existence of this file, but this could
mask a kernel installation error, hence we should let kmod run
even if the file doesn't exist.

[1] http://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=ae17710117
2013-08-20 21:18:00 -04:00
Kay Sievers 4bb3a126b7 udev: replace CAP_MKNOD by writable /sys condition 2013-08-17 19:07:42 +02:00
Zbigniew Jędrzejewski-Szmek d0a2d726f0 units: make fsck units remain after exit
Without this, fsck would be re-run if any other service which pulls
in a target requiring one of the mounts was started after fsck was done
but before the initial transaction was done.

https://bugs.freedesktop.org/show_bug.cgi?id=66784
2013-08-15 15:42:09 -04:00
Thomas Hindoe Paaboel Andersen 5eec7de6ad typo fixes in man and comments 2013-08-15 23:38:09 +02:00
Kay Sievers 04bf3c1a60 sysctl: allow overwriting of values specified in "later" files 2013-08-15 18:43:31 +02:00
Lennart Poettering 875c6e1b48 backlight: instead of syspath use sysname for identifying backlight devices
This makes the description string of the backlight service a bit nicer.
2013-08-14 02:55:57 +02:00
Lennart Poettering 3731acf1ac backlight: add minimal tool to save/restore screen brightness across reboots
As many laptops don't save/restore screen brightness across reboots,
let's do this in systemd with a minimal tool, that restores the
brightness as early as possible, and saves it as late as possible. This
will cover consoles and graphical logins, but graphical desktops should
do their own per-user stuff probably.

This only touches firmware brightness controls for now.
2013-08-14 01:57:02 +02:00
Lennart Poettering 82659fd757 core: optionally send SIGHUP in addition to the configured kill signal
This is useful to fake session ends for processes like shells.
2013-07-30 01:54:59 +02:00
Dave Reisner ec99834cb0 tmpfiles-setup: exclude /dev prefixes files
Fixes Arch Linux bug: https://bugs.archlinux.org/task/36259
2013-07-24 12:04:00 -04:00
Tom Gundersen 7e380bba1c kmod-static-nodes: remain after exit 2013-07-22 17:11:19 +02:00
Tom Gundersen ef7e6e0598 systemd-tmpfiles-setup-dev: remain after exit
Without this, tmpfiles-setpu-dev  would be re-run if any other service,
which pulls in basic.target, was started after setup-dev was finished
and before basic.target was active.
2013-07-22 17:01:46 +02:00
Lennart Poettering bc5cb1d525 machined: run machined at minimal capabilities 2013-07-19 03:49:24 +02:00
Lennart Poettering 085b90af43 units: add references to bus API documentation to logind+machined 2013-07-19 03:49:07 +02:00
Harald Hoyer 956eaf2b8d remove /run/initramfs/root-fsck logic
dracut uses systemd in the initramfs and does not write these files
anymore.

The state of the root fsck is serialized.
2013-07-17 11:33:07 +02:00
Zbigniew Jędrzejewski-Szmek 7aa4fa34f7 units: do not special-case getty@tty1.service installation
Since a long while we can use "systemctl enable getty@tty1.service"
which does the right thing, so there's no need to abuse Alias=
for installation.
2013-07-13 10:00:29 -04:00
Tom Gundersen 3d56f7df44 static-nodes: don't hardcode path to mkdir 2013-07-12 20:08:31 +02:00
Lennart Poettering 4c5420a0c1 units: since we auto-spawn user@.service instances now we don need an [Install] section in it 2013-07-11 01:57:09 +02:00
Tom Gundersen edeb68c53f static-nodes: move creation of static nodes from udevd to tmpfiles
As of kmod v14, it is possible to export the static node information from
/lib/modules/`uname -r`/modules.devname in tmpfiles.d(5) format.

Use this functionality to let systemd-tmpfilesd create the static device nodes
at boot, and drop the functionality from systemd-udevd.

As an effect of this we can move from systemd-udevd to systemd-tmpfiles-setup-dev:

 * the conditional CAP_MKNOD (replaced by checking if /sys is mounted rw)
 * ordering before local-fs-pre.target (see 89d09e1b5c)
2013-07-08 21:26:24 +02:00
Kay Sievers a0f9c810fa build-sys: work around automake issue with files with a leading '-'
We should probably work around it, until it is sorted out.

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14728
2013-07-02 23:15:49 -04:00
Lennart Poettering 1ee306e124 machined: split out machine registration stuff from logind
Embedded folks don't need the machine registration stuff, hence it's
nice to make this optional. Also, I'd expect that machinectl will grow
additional commands quickly, for example to join existing containers and
suchlike, hence it's better keeping that separate from loginctl.
2013-07-02 03:47:23 +02:00
Lennart Poettering fb6becb443 logind: port over to use scopes+slices for all cgroup stuff
In order to prepare things for the single-writer cgroup scheme, let's
make logind use systemd's own primitives for cgroup management.

Every login user now gets his own private slice unit, in which his sessions
live in a scope unit each. Also, add user@$UID.service to the same
slice, and implicitly start it on first login.
2013-07-02 01:48:55 +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
Lennart Poettering 9444b1f20e 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.
2013-06-20 03:49:59 +02:00
Lennart Poettering f2561e8598 units: add default units for system.slice, user.slice, machine.slice 2013-06-18 00:59:54 +02:00
Karel Zak 7c1b8f043e units: cleanup agetty command line
* baud rate is optional and unnecessary for virtual terminals
 * term type is optional (default is 'linux' for virtual terminals
   and 'vt102' for serial lines)
 * long options are more user-friendly

... all this is supported since util-linux v2.20 (Aug 2011).
2013-06-04 15:34:44 +02:00
Lennart Poettering 3f92e4b4b6 utmp: turn systemd-update-utmp-shutdown.service into a normal runtime service
With this change systemd-update-utmp-shutdown.service is replaced by
systemd-update-utmp.service which is started at boot and stays around
until shutdown. This allows us to properly order the unit against both
/var/log and auditd.

https://bugzilla.redhat.com/show_bug.cgi?id=853104
https://bugs.freedesktop.org/show_bug.cgi?id=64365
2013-05-16 00:19:03 +02:00
Lennart Poettering c35b956d34 units: rework systemd-random-seed-{load,save}.service to be a single service
That way ordering it with MountsRequiredFor= works properly, as this no
longer results in mount units start requests to be added to the shutdown
transaction that conflict with stop requests for the same unit.
2013-05-15 22:38:51 +02:00
Auke Kok 9541fe6adf systemctl does not expand %u, so revert back to %I
The description field is only displayed by systemctl, and
it can't expand %u properly (it will always display "root").
2013-05-09 09:39:15 -07:00
Lennart Poettering 05947befce units: add an easy-to-use unit template file systemd-nspawn@.service for running containers as system services 2013-04-30 08:36:02 -03:00
Lennart Poettering a34cb32e54 units: update user@.service to reflect new user cgroup paths 2013-04-23 16:00:32 -03:00
Umut Tezduyar 195f8e3612 man: link systemd-tmpfiles-setup-dev.service 2013-04-23 12:55:44 +02:00
Tom Gundersen 3e8037f17c units: rename systemd-static-nodes -> systemd-tmpfiles-setup-dev
This is really just a special case of systemd-tmpfiles-setup, moreover it could easily create more than static nodes.
2013-04-22 21:57:39 +02:00
Lennart Poettering b7253ecda5 readahead: let readahead run for a little longer
Especially slower systems need more than 10s for starting the session,
so let's bump this to 30s.
2013-04-17 22:24:07 +02:00
Kay Sievers 4e6db59202 bus: rename KDBUS_CMD_FNAME_POLICY_NONE -> KDBUS_CMD_FNAME_POLICY_OPEN 2013-04-12 21:04:49 +02:00
Tom Gundersen 8c11aac1d7 tmpfiles: create static device nodes before udev is started
Since v183, the contents of /usr/lib/udev/devices is no longer copied to /dev
on boot, rather systemd-tmpfiles should be used instead. However, as
systemd-tmpfiles --create is only ran long after udevd has been started, it is
no longer possible to use udev rules to assign permissions to the static nodes.

This calls systemd-tmpfiles --create early, before udev is started, and
restricts the call to /dev, which is known to be mounted already.

In the future, this could also take over the creation of static device nodes
from systemd-udevd.
2013-04-12 02:43:01 +02:00
Lennart Poettering 8df31a9c98 units: fix some left-over mentions of remote-fs-setup.target 2013-04-09 19:05:49 +02:00
Dr. Tilmann Bubeck 80cfe9e163 Do no isolate in case of emergency or severe problems
This patch changes local-fs.target and systemd-fsck to not use
"isolate" when going into emergency.
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=810722

The motivation is, that when something wents wrong, we should
keep everything as it is, to let the user fix the problem. When
isolating we stop a lot of services and therefore change the
system heavily so that it gets harder for the user to fix.

An example is a crypted partition. When the fsck in a crypted
partition fails, it previously used "emergency/start/isolate"
which stops cryptsetup. Therefore if the user tries to fsck
e.g. /dev/mapper/luks-356c20ae-c7a2-4f1c-ae1d-1d290a91b691
as printed by the failing fsck, then it will not find this
device (because it got closed).

So please apply this patch to let the user see the failing
situation.

Thanks!

[zj: removed dead isolate param from start_target().]

https://bugs.freedesktop.org/show_bug.cgi?id=49463
https://bugzilla.redhat.com/show_bug.cgi?id=810722
2013-04-01 23:43:48 -04:00
Zbigniew Jędrzejewski-Szmek cc1f918dda units/user: default.target must be isolatable
...
Activating default unit: default.target
Default target could not be isolated, starting instead: Operation refused, unit may not be isolated.
2013-03-31 19:43:14 -04:00
Lennart Poettering 1dda524f05 units: fix network-online.target fields 2013-03-29 18:31:07 +01:00
Lennart Poettering 0c17fbce55 unit: replace remote-fs-setup.target by network-online.target
https://bugzilla.redhat.com/show_bug.cgi?id=787314
2013-03-29 03:07:17 +01:00
Lennart Poettering 6a9280cc60 units: disallow manual starting of passive units
As passive units only are useful for ordering things within the initial
transaction there is no point in ever activating them manually, hence
refuse it.
2013-03-26 15:15:39 +01:00
Lennart Poettering ab9a2ef00b units: downgrade dependency on sockets.target/timers.target/paths.target by basic.target
There isn't really any need to require any targets but sysinit.target
from basic.target, so downgrade sockets.target, paths.target,
timers.target.
2013-03-26 02:32:23 +01:00
Lennart Poettering 627506f104 units: there is no point in pulling in ordering 'provides'-style targets
Units such as nss-lookup.target, nss-user-lookup.target,
remote-fs-pre.target, local-fs-pre.target, time-sync.target,
rpcbind.target are to be pulled in by the implementing services, and
that's there only purpose. They should not have any 'active component'
otherwise, so let's drop all further deps from these units.
2013-03-25 22:10:35 +01:00
Lennart Poettering e8d2f6cde0 units: introduce remote-fs-setup.target to pull in dependencies from remote mounts
This introduces remote-fs-setup.target independently of
remote-fs-pre.target. The former is only for pulling things in, the
latter only for ordering.

The new semantics:

remote-fs-setup.target: is pulled in automatically by all remote mounts.
Shall be used to pull in other units that want to run when at least one
remote mount is set up. Is not ordered against the actual mount units,
in order to allow activation of its dependencies even 'a posteriori',
i.e. when a mount is established outside of systemd and is only picked
up by it.

remote-fs-pre.target: needs to be pulled in automatically by the
implementing service, is otherwise not part of the initial transaction.
This is ordered before all remote mount units.

A service that wants to be pulled in and run before all remote mounts
should hence have:

a) WantedBy=remote-fs-setup.target -- so that it is pulled in

b) Wants=remote-fs-pre.target + Before=remote-fs-pre.target -- so that
   it is ordered before the mount point, normally.
2013-03-25 22:04:40 +01:00
Lennart Poettering a69fe051b8 Revert "remote-fs.target: want remote-fs-pre.target"
This reverts commit 6bde0b3220.

We should not pull in remote-fs-pre.target unconditionally. It's
supposed to be pulled in by the implementors of it, rather then its
users.
2013-03-25 21:29:58 +01:00
Lennart Poettering b17959153a units: and also, order all early-boot sockets before sockets.target 2013-03-25 21:29:09 +01:00
Lennart Poettering b0afe214c0 units: order all udev services before sysinit.target, too
Not that it would matter much, but let's make things a bit more
systematic: early boot services shall order themselves before
sysinit.target, and nothing else.
2013-03-25 21:29:09 +01:00
Lennart Poettering e3d84721dc units: introduce new timers.target and paths.target to hook timer/path units into for boot 2013-03-25 21:28:30 +01:00
Kay Sievers 5ec6b15b65 build-sys: add missing sed substitution for DEBUGTTY 2013-03-25 19:28:00 +01:00
Umut Tezduyar d95fd3df59 build-sys: configurable debug shell tty path 2013-03-25 18:40:38 +01:00
Frederic Crozat 89d09e1b5c udevd: ensure static nodes are created before local-fs mount
static nodes (like /dev/loop-control) are created when systemd-udevd
is started and needed to mount loopback devices. Therefore,
local-fs-pre.target should be only started after systemd-udevd is
started.
2013-03-23 15:17:39 +01:00
Auke Kok 3abcb6aced Update user session unit template.
While most folks will be using the derivative from user-session-units,
I'm updating this one to reflect some of the fixes and things to note
about user sessions:

- cgroup should be set with "%u" - username instead of %I
- set dbus path with %U explicitly too
- hint to folks that wish to use MEM_CG features in user sessions
- allow unit to be enabled for instances with systemctl enable
2013-03-22 21:43:31 -07:00
Lennart Poettering 0debd2bf2f Revert "units: ignore systemd-sysctl on shutdown"
This reverts commit faeffa73a8.

There isn't really much point in dropping the Conflicts= since shutting
down this service is basically free as it doesn't have anything running.

Also, the patch was incomplete, because shutdown.target was still listed
in Before=.
2013-03-23 03:10:41 +01:00
Kay Sievers 93f04c80f6 units: initrd, multi-user - add a few more words to Description= 2013-03-16 16:29:29 +01:00
Umut Tezduyar faeffa73a8 units: ignore systemd-sysctl on shutdown
No need to try to stop systemd-sysctl on shutdown as
this service doesn't have ExecStop= anyways.
2013-03-15 22:56:33 -04:00
Harald Hoyer 9e5f0f9291 Make initrd.target the default target in the initrd
First, rename root-fs.target to initrd-root-fs.target to clarify its usage.

Mount units with "x-initrd-rootfs.mount" are now ordered before
initrd-root-fs.target. As we sometimes construct /sysroot mounts in
/etc/fstab in the initrd, we want these to be mounted before the
initrd-root-fs.target is active.

initrd.target can be the default target in the initrd.

                             (normal startup)
                                    :
                                    :
                                    v
                              basic.target
                                    |
             ______________________/|
            /                       |
            |                  sysroot.mount
            |                       |
            |                       v
            |             initrd-root-fs.target
            |                       |
            |                       v
            |            initrd-parse-etc.service
(custom initrd services)            |
            |                       v
            |            (sysroot-usr.mount and
            |             various mounts marked
            |               with fstab option
            |                x-initrd.mount)
            |                       |
            |                       v
            |                initrd-fs.target
            |                       |
            \______________________ |
                                   \|
                                    v
                               initrd.target
                                    |
                                    v
                          initrd-cleanup.service
                               isolates to
                         initrd-switch-root.target
                                    |
                                    v
             ______________________/|
            /                       |
            |        initrd-udevadm-cleanup-db.service
            |                       |
(custom initrd services)            |
            |                       |
            \______________________ |
                                   \|
                                    v
                        initrd-switch-root.target
                                    |
                                    v
                        initrd-switch-root.service
                                    |
                                    v
                               switch-root
2013-03-15 00:49:37 +01:00
Harald Hoyer 700e07ffd5 add initrd-fs.target and root-fs.target
Instead of using local-fs*.target in the initrd, use root-fs.target for
sysroot.mount and initrd-fs.target for /sysroot/usr and friends.

Using local-fs.target would mean to carry over the activated
local-fs.target to the isolated initrd-switch-root.target and thus in
the real root. Having local-fs.target already active after
deserialization causes ordering problems with the real root services and
targets.

We better isolate to targets for initrd-switch-root.target, which are
only available in the initrd.
2013-03-13 08:11:17 +01:00
Harald Hoyer 6bde0b3220 remote-fs.target: want remote-fs-pre.target
This pulls in remote-fs-pre.target if remote-fs.target is needed.

Previously remote-fs-pre.target was not active, if no remote fs was
mounted from /etc/fstab. So, every manual remote fs mount was ordered
against the inactive remote-fs-pre.target and umount.target.

Because remote-fs-pre.target was not active, the remote fs was umounted
at umount.target time, which was too late (network already down).

Now remote-fs-pre.target is active, even if no remote fs is mounted.
On shutdown it is deactivated in the correct order and all manual remote
fs mounts also.
2013-03-12 18:24:44 +01:00
Kay Sievers 3bf3cd95ab udevd: sort into sysinit instead of basic target 2013-03-12 15:56:19 +01:00
Michael Biebl b39ad46de4 Update .gitignore
for the changes in 7b40ce553f
2013-03-11 17:08:03 +01:00
Michael Biebl f432bb9144 Move udevadm to rootbindir
The udevadm utility is needed during early boot, so move it to
rootbindir to support split-/usr configurations.
2013-03-11 07:18:33 +01:00
Michael Biebl 7b40ce553f build-sys: don't hard-code binary paths in initrd-*.service
Instead use @bindir@ for udevadm and @rootbindir@ for systemctl.
2013-03-09 10:05:01 +01:00
Harald Hoyer da61d6b2f2 units: run systemd-ask-password-console.service after systemd-vconsole-setup.service 2013-03-06 15:39:37 +01:00
Harald Hoyer 248ea600d0 initrd-parse-etc.servic: force start local-fs.target 2013-03-06 11:03:39 +01:00
Harald Hoyer 7fdf51751c Revert "add initrd-fs.target and initrd-fs-pre.target"
This reverts commit 39b83cdab3.
2013-03-06 11:03:39 +01:00
Harald Hoyer fdf1848d1d Revert "units/initrd-*: require initrd-fs.target rather than local-fs.target"
This reverts commit 7d89ce303f.
2013-03-06 11:03:39 +01:00
Lennart Poettering 37495eede9 journal: make gatewayd run under its own user ID 2013-03-05 19:15:31 +01:00
Harald Hoyer 7d89ce303f units/initrd-*: require initrd-fs.target rather than local-fs.target 2013-03-04 19:33:50 +01:00
Harald Hoyer 39b83cdab3 add initrd-fs.target and initrd-fs-pre.target 2013-03-04 19:33:50 +01:00
Tom Gundersen cf84347794 initrd: add unit files needed for basic systemd-in-initrd support
This will:
 * mount all configured filesystems (typically the rootfs on /sysroot)
 * reload the configuration to pick up anything from the mounted fs (typically
   /sysroot/etc/fstab)
 * mount any newly configured filesystems (typically /usr on /sysroot/usr, if
   applicable)
 * shut-down and clean-up any daemons running in the initramfs (typically udevd)
 * switch-root to /sysroot and start the real init

For an example of what files should be included in an initramfs based on this
see
<https://mailman.archlinux.org/pipermail/arch-projects/2013-February/003628.html>.

Cc: Harald Hoyer <harald.hoyer@gmail.com>
Cc: Dave Reisner <d@falconindy.com>
2013-03-01 22:52:36 +01:00
Zbigniew Jędrzejewski-Szmek 652e737517 build-sys: keep intermediate files
Sometimes it is useful to look at them, and they don't take
up any significant amount of space. Keeping them also avoids
the message about files being removed at the end of make
run.
2013-01-29 21:17:40 -05:00
Lennart Poettering 5d4caf5654 service: ignore dependencies on $syslog and $local_fs in LSB scripts
We no longer allow early-boot init scripts, however in late boot the
syslog socket and local mounts are established anyway, so let's simplify
our dep graph a bit.

If $syslog doesn't resolve to syslog.target anymore there's no reason to
keep syslog.target around anymore. Let's remove it.

Note that many 3rd party service unit files order themselves after
syslog.target. These will be dangling dependencies now, which should be
unproblematic, however.
2013-01-16 21:34:09 +01:00
Kay Sievers 3f141375cb service: sysv - remove distribution specific targets
Systemd should not introduce any new facilities. Distributions which still
need to support their non-standard/legacy facilities should add them as
patches to their packaging.

The following facilities are no longer recognized:
  $x-display-manager
  $mail-transfer-agent
  $mail-transport-agent
  $mail-transfer-agent
  $smtp
  $null

This target is no longer available:
  mail-transfer-agent.target
2013-01-16 04:26:49 +01:00
Lennart Poettering 25ed795892 units: add reference to new wiki page to all api mount units 2013-01-15 18:14:13 +01:00
Lennart Poettering 236bc7573a man: link in API FS documentation from the wiki 2013-01-15 05:13:54 +01:00
Lennart Poettering aa6c53bf05 man: link in wiki documentation about network.target 2013-01-15 04:12:53 +01:00
Lennart Poettering 7f0086f8c9 units: always use sulogin in rescue.service
sushell makes much less sense than sulogin. If distros want to stick to sushell
they should patch this downstream.
2013-01-04 23:26:21 +01:00
Lennart Poettering 83514a2fa0 units: drop distro specific stuff from units
Since rc-local is now enabled via the SysV compatibility we should only refer
to it based on that too.
2013-01-04 23:26:21 +01:00
Lennart Poettering b1c4ca25bf build-sys: make rc-local support part of SYSV compat
This also drops automatic selection of the rc local scripts
based on the local distro. Distributions now should specify the paths
of the rc-local and halt-local scripts on the configure command line.
2013-01-04 23:26:20 +01:00
Lennart Poettering 22ffd25ba5 units: add CAP_DAC_OVERRIDE+CAP_SYS_PTRACE to hostnamed so that detection of virtualization works 2012-12-31 21:24:26 +01:00
Tollef Fog Heen 7a14d67f76 Remove frugalware display-manager.service
Frugalware are shipping their own .service file now, so stop shipping
it here.

This effectively reverts 196e3fa74a
2012-12-14 09:17:14 +01:00
Lennart Poettering 00addadd86 unit: link up getty configuration from man page and unit files 2012-11-20 20:10:30 +01:00
Lennart Poettering 95ec8647c7 journal: recommend journalctl -x more often 2012-11-16 03:03:54 +01:00
Lennart Poettering 669b04a492 service: drop special HTTP server target, as it is a bad idea anf Fedora specific
This was premarily intended to support the LSB facility $httpd which is
only known by Fedora, and a bad idea since it lacks any real-life
usecase.

Similar, drop support for some other old Fedora-specific facilities.

Also, document the rules for introduction of new facilities, to clarify
the situation for the future.
2012-10-31 02:55:04 +01:00
Michal Schmidt 2161de72c5 units: agetty overrides TERM
Environment=TERM=... has no effect on agetty who sets it by itself. To
really set TERM to a specified value, it has to be given on the command
line.

https://bugzilla.redhat.com/show_bug.cgi?id=870622
2012-10-29 22:58:40 +01:00
Ramkumar Ramachandra 9c2cd81e0e units: teach m4 scripts in units/ about Debian's rc.local
This makes the behaviour wrt. to rc[-.]local consistent between
various distributions supporting it.
2012-10-28 02:14:41 +02:00
Zbigniew Jędrzejewski-Szmek aa6eba407b units: reword rescue mode hints
Do not suggest to the user that commands can be issued before
logging in.

sulogin prints it own message, which mentions ^D, so there's no need
to repeat it here.
2012-10-28 02:14:00 +02:00
Lennart Poettering 6524990fdc logind: support for hybrid sleep (i.e. suspend+hibernate at the same time) 2012-10-28 00:50:35 +02:00
Tom Gundersen d0114527f4 units: don't order tmp.monut after local-fs-pre.target
Since tmp.mount is a tmpfs this is not necesary, and should speed up boot marginally.
2012-10-23 22:33:00 +02:00
Lennart Poettering 5411ae4782 units: use numerig signal for killing systemd, to avoid incompatibilities with procps/util-linux kill 2012-10-23 00:12:33 +02:00
Lennart Poettering 4474d8abd0 units: also add journalctl suggestion to emergency.service
More often than not we enter emergency.service due to fsck failure, so
it makes sense to direct people to the journal to debug those.
2012-10-23 00:12:33 +02:00
Lennart Poettering 74dc2b17e6 units: suggest journalctl -b in rescue.service so that only messages from the current boot are shown 2012-10-23 00:12:33 +02:00
Lennart Poettering 86b2e20a5e units: rework systemd-exit.service to terminate systemd via signal rather than bus
This should make session termination more reliable, as D-Bus doesn't
have to be around anymore for this to succeed.
2012-10-18 01:20:06 +02:00
Lennart Poettering 7b17a7d72f journal: add minimal journal gateway daemon based on GNU libmicrohttpd
This minimal HTTP server can serve journal data via HTTP. Its primary
purpose is synchronization of journal data across the network. It serves
journal data in three formats:

       text/plain: the text format known from /var/log/messages
       application/json: the journal entries formatted as JSON
       application/vnd.fdo.journal: the binary export format of the journal

The HTTP server also serves a small HTML5 app that makes use of the JSON
serialization to present the journal data to the user.

Examples:

This downloads the journal in text format:

 # systemctl start systemd-journal-gatewayd.service
 # wget http://localhost:19531/entries

Same for JSON:

 # curl -H"Accept: application/json" http://localhost:19531/entries

Access via web browser:

 $ firefox http://localhost:19531/
2012-09-28 00:55:24 +02:00
Tom Gundersen 44b1222bd3 udev: don't let systemd-udev-settle delay basic.target
It is no longer possible to manually enable systemd-udev-settle.service,
so its only use is by legacy services explicitly pulling it in. It makes
sense for these services to also explicitly order themselves after
udev-settle.service, which makes After=basic.target redundant.

This should reduce the negative effect on boot-time of having to enable
legacy services such as lvm.service.
2012-09-27 16:53:45 +02:00
Kay Sievers 84c3f7c2bb udev: remove Install section from systemd-udev-settle.service
Legacy tool on-demand pull-in the settling, it should never run
by default, nothing orders against is anyway.
2012-09-27 15:16:03 +02:00
Shawn Landden 608da9e9b5 man: remove timezone(5) and add localtime(5) 2012-09-14 19:27:59 +02:00
Dave Reisner b51fc639f0 build-sys: perform autodetection of quota-tools binaries
Use AC_PATH_PROG to try and locate the quotaon and quotacheck binaries,
falling back on hardcoded defaults when they can't be found.
2012-09-11 01:43:48 +02:00
Lennart Poettering ddffe89246 journal: don't pull in flush service from journald service
In the initrd we don't need the flush service hence don't attempt to
pull it in.
2012-09-03 18:59:05 -07:00
Lennart Poettering 7e75c5ac2d unit: make sure structured logging is available before we enter the main boot phase 2012-09-03 18:59:05 -07:00
Lennart Poettering b2c9cbafb8 units: remove prefdm
It's time to get rid of prefdm. Distributions which still want to use
this should maintain this downstream, but it's probably better to just
provide proper units for the various display managers, like Fedora is
doing this, for example:

https://fedoraproject.org/wiki/Features/DisplayManagerRework
2012-08-07 17:08:31 +02:00
Michal Schmidt 22cfbae09d units: add the modules-load cmdline parameters to the unit conditions
For 'modules-load=' and 'rd.modules-load=' to be effective,
systemd-modules-load.service must be started. It is currently
conditional on the existence of config files. Add the presence of the
cmdline parameters to the triggering conditions.
2012-07-25 08:51:41 +02:00
Lennart Poettering 3f612b9123 units: fix section of man page link in systemd-logind.service
https://bugs.freedesktop.org/show_bug.cgi?id=51963
2012-07-19 12:46:55 +02:00
Lennart Poettering 47ec118473 units: don't enforce a holdoff time for journald, logind, udevd
These services should be restarted as quickly as possible if they fail,
and the extra safety net of the holdoff time is not necessary.
2012-07-18 02:31:52 +02:00
Ville Skyttä 49f43d5f91 Spelling fixes. 2012-07-16 12:16:29 +02:00
Lennart Poettering 7f2cddae09 unit: rename BindTo= to BindsTo=
all other dependencies are in 3rd person. Change BindTo= accordingly to
BindsTo=.

Of course, the dependency is widely used, hence we parse the old name
too for compatibility.
2012-07-13 23:34:40 +02:00
Lennart Poettering b8156be03f journal: replace implicit flushing of journal by explicit one
The old automatism that the flushing of the journal from /run to /var
was triggered by the appearance of /var/log/journal is broken if that
directory is mounted from another host and hence always available to be
useful as mount point. To avoid probelsm with this, introduce a new unit
that is explicitly orderer after all mounte files systems and triggers
the flushing.
2012-07-11 02:41:16 +02:00
Auke Kok 8401e9f91d MeeGo: Remove build support for MeeGo distribution.
The MeeGo distribution is still a supported distribution, but
will probably not see an updated version of systemd anymore.

Most of the development is focussing on Tizen now, and the
generic support for building --with-distro=other is more than
adequate enough.

This patch removes the support as a custom configuration build
target in systemd. People who are still building this for
the MeeGo distribution should build as "other" distro.
2012-07-09 16:37:46 +02:00
Lennart Poettering 746e436dc5 units: add reference to wiki so syslog.socket 2012-07-03 13:31:09 +02:00
Colin Guthrie 51dfddc2cc units: Rename systemd-udev.service to systemd-udevd.service
This naming convention is more inline with other systemd daemon
unit names (systemd-logind.service, systemd-localed.service etc)

The companion .socket units have also been renamed, however the
-trigger and -settle units keep their current name as these are
not directly related to daemon process itself.
2012-07-02 23:21:51 +02:00
Lennart Poettering d1f9edafe7 units: rename systemd-debug-shell.service to debug-shell.service
The systemd- prefix for services should be reserved only for services
that invoke our own code rather than generic, external code.
2012-07-02 14:33:04 +02:00
Colin Guthrie 067e1f73e8 mageia: Change the unit for prefdm.service to make it work a bit more like Fedora
Do not wait for some of the Fedora units that we have traditionally not
waited for in Mageia or Mandriva before it.
2012-07-02 11:50:54 +02:00
Lennart Poettering ac7019f33f timedated: replace systemd-timedated-ntp.target logic with simpler scheme
The previous systemd-timedated-ntp.target was suffering by the problem
that NTP implementations enabled via the machanism could not be disabled
the obvious way on the "systemctl disable" command line. Replace
systemd-timedated-ntp.target by a list of implementations we try in
turn. The list is encoded in $pkgdatadir/ntp-units.
2012-07-02 10:43:56 +02:00
Lennart Poettering 454591be36 units: automatically respawn the core services 2012-06-28 12:18:04 +02:00
Lennart Poettering 5231084b47 units: add explicit dependency on display-manager.service to graphical.target
This replaces the symlink based dependency by an explicit one in the
unit file so that we avoid the dangling symlink when no display manager
is installed.
2012-06-27 22:23:16 +02:00
Lennart Poettering f5ccf26ded man: document systemd-update-generator 2012-06-27 15:12:29 +02:00
Lennart Poettering c48754ab3d man: this time, fix Documentation= properly 2012-06-27 14:28:25 +02:00
Lennart Poettering ca5dc4b67d units: fix Documentation= tag in fsck units 2012-06-27 11:51:38 +02:00
Lennart Poettering 7df46b2af5 man: document systemd-ask-password-console.service and friends 2012-06-27 01:32:15 +02:00
Lennart Poettering 743b8558f6 man: document quotacheck 2012-06-27 01:17:49 +02:00
Lennart Poettering 3eca62862e man: add Documentation= tag to tmp.mount 2012-06-27 01:09:51 +02:00
Lennart Poettering 744881d173 man: add Documentation= tags to all kinds of missing units 2012-06-27 01:07:04 +02:00
Lennart Poettering ee1c0ad436 man: properly document .socket units in man page 2012-06-27 01:06:35 +02:00
Lennart Poettering a32f224aaf man: document systemd-fsck 2012-06-27 00:37:36 +02:00