Commit graph

76 commits

Author SHA1 Message Date
Eelco Dolstra ffb581c739 Fix suspend in systemd
Systemd 203 expects the file /etc/systemd/sleep.conf to exist,
otherwise suspend doesn't work.
2013-05-09 16:26:13 +02:00
Eelco Dolstra ebac0220d1 systemd.nix: Use environment.etc attribute syntax 2013-05-09 16:26:12 +02:00
Mathijs Kwik 8de00c328a systemd: add "requiredBy" option.
"require" is a stronger version of "want",
and just like wantedBy allows you to specify this relation in reverse,
requiredBy does the same.

It may seem pointless to be able to specify these stronger relations in
reverse, because if something is really required, you would expect the
other unit to specify this himself.

However, this is still useful for virtual/automatic units (like
devices) that are created by systemd on demand and hence have no unit
file you can alter.
2013-04-22 14:24:15 +02:00
Eelco Dolstra 7ad91f31d6 Add support for systemd timers 2013-03-28 11:54:19 +01:00
Eelco Dolstra f3bea050f8 Updates for systemd 198/199 2013-03-27 23:03:37 +01:00
Bjørn Forsman ec2378f07b systemd-logind: fix config file header: [Logind] => [Login]
man logind.conf clearly states that the header is [Login] (no 'd').
Without this fix services.logind.extraConfig does not take effect
because logind ignores the invalidly named section.
2013-03-02 19:45:47 +01:00
Bjørn Forsman 08c9a0ad5e Add service.logind.extraConfig option
So that we can customize systemd-logind in configuration.nix.

Example:
  services.logind.extraConfig = "HandleLidSwitch=ignore";

See man logind.conf for available options.
2013-03-02 00:24:34 +01:00
Shea Levy 59a4df3159 Add websockify service 2013-02-14 21:50:41 -05:00
Eelco Dolstra 88e4569147 systemd: Allow whitespace in environment values 2013-02-01 13:40:44 +01:00
Eelco Dolstra 7464d850d3 Start a getty on tty1 again 2013-01-24 14:55:55 +01:00
Eelco Dolstra 37b56574e2 stage-1: Clear environment before calling stage-2
In particular, stage-1's LD_LIBRARY_PATH should not infect stage-2.
Reported by viric.
2013-01-23 11:51:58 +01:00
Eelco Dolstra f2c2b7ace9 Don't start emergency mode on EC2 instances
EC2 instances don't have a console, so it's pointless to start
emergency mode if a mount fails.  (This happened to me with an
encrypted filesystem where the key wasn't sent on time using "charon
send-keys".)  Better to cross fingers and continue booting.
2013-01-21 21:01:48 +01:00
Eelco Dolstra 4d983d4955 Rename ‘system.build.systemd’ to ‘systemd.package’
This makes it cheaper to test a new systemd and is more consistent
with other modules.
2013-01-16 13:17:57 +01:00
Eelco Dolstra ae4e94d9ac Rename ‘boot.systemd’ to ‘systemd’
Suggested by Mathijs Kwik.  ‘boot.systemd’ is a misnomer because
systemd affects more than just booting.  And it saves some typing.
2013-01-16 12:33:18 +01:00
Eelco Dolstra f4a3bdd6af Install {rescue,emergency}.{target,service}
Also, symlink kbrequest.target to rescue.target as suggested by the
systemd.special manpage.  This way, you can start a sulogin rescue
shell by pressing Alt+Up.
2013-01-08 18:24:06 +01:00
Eelco Dolstra 948dd8dd1a Use the upstream (but patched) sysinit.target 2013-01-08 17:26:51 +01:00
Eelco Dolstra 96ba0ca283 For some units, use "systemctl restart" rather than "systemctl stop/start"
During a configuration switch, changed units are stopped in the old
configuration, then started in the new configuration (i.e. after
running the activation script and running "systemctl daemon-reload").
This ensures that services are stopped using the ExecStop/ExecStopPost
commands from the old configuration.

However, for some services it's undesirable to stop them; in
particular dhcpcd, which deconfigures its network interfaces when it
stops.  This is dangerous when doing remote upgrades - usually things
go right (especially because the switch script ignores SIGHUP), but
not always (see 9aa69885f0).  Likewise,
sshd should be kept running for as long as possible to prevent a
lock-out if the switch fails.

So the new option ‘stopIfChanged = false’ causes "systemctl restart"
to be used instead of "systemctl stop" followed by "systemctl start".
This is only proper for services that don't have stop commands.  (And
it might not handle dependencies properly in some cases, but I'm not
sure.)
2013-01-05 01:05:25 +01:00
Mathijs Kwik 7e70cffc45 systemd mount units: better handling of mandatory options 2013-01-01 14:53:54 +01:00
Mathijs Kwik ebf4816717 systemd mount units: use 'escapeSystemdPath' from lib/utils 2013-01-01 14:53:54 +01:00
Mathijs Kwik 16a9bcfe81 add support for systemd mount units
This is mainly useful for specifying mounts that depend on other
units. For example sshfs or davfs need network (and possibly
nameservices).

While systemd makes a distinction between local and remote
filesystems, this only works for in-kernel filesystems such as
nfs and cifs.

fuse-based filesystems (such as sshfs and davs) are classified as
local, so they fail without networking. By explicitly declaring these
mounts as full systemd units (as opposed to having systemd generate
them automatically from /etc/fstab), dependencies can be specified as
on every other unit.

In the future, we can probably port NixOS' filesystems handling to use
these native systemd.mount units and skip /etc/fstab altogether, but
this probably requires additional changes, such as starting systemd
even earlier during boot (stage 1).
2013-01-01 13:55:48 +01:00
Mathijs Kwik 244ed6ae71 nscd: use proper systemd.special(7) targets 2012-12-27 12:23:50 +01:00
Rob Vermaas 39a6143c66 Add options to control rate limiting behaviour of journald. See 'man journald.conf' for more information. 2012-12-16 20:28:45 +01:00
Eelco Dolstra bd7ea9be58 sysinit.target: Drop the dependency on local-fs.target and swap.target
Having all services with DefaultDependencies=yes depend on
local-fs.target is annoying, because some of those services might be
necessary to mount local filesystems.  For instance, Charon's
send-keys feature requires sshd to be running in order to receive LUKS
encryption keys, which in turn requires dhcpcd, and so on.  So we drop
this dependency (and swap.target as well for consistency).  If
services require a specific mount, they should use RequiresMountsFor
in any case.
2012-12-14 17:42:54 +01:00
Eelco Dolstra b1da38f564 Merge remote-tracking branch 'origin/master' into systemd 2012-11-30 16:12:04 +01:00
Eelco Dolstra 3c6e0fd594 Generate the binary hardware database required by systemd 196 2012-11-29 18:51:44 +01:00
aszlig a333f7212e systemd: Fail if kernel features are missing.
This has rendered my system unbootable, because I forgot to enable AUTOFS4 in my
custom kernel. In addition to AUTOFS4, this includes (hopefully) all other
kernel features needed by systemd, as listed in the README:

REQUIREMENTS:
  Linux kernel >= 2.6.39
    with devtmpfs
    with cgroups (but it's OK to disable all controllers)
    optional but strongly recommended: autofs4, ipv6

Autofs4 is not a requirement here, but in our case it turns out that the system
is not able to boot properly with a LUKS-enabled system (or at least not on _my_
system).

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2012-11-06 11:25:43 +01:00
Eelco Dolstra af4e176c12 Fix description 2012-11-02 14:10:06 +01:00
Eelco Dolstra 48a0ea0513 Make Apache wait for ‘charon send-keys’
(This is a no-op on non-Charon deployments since the ‘keys.target’
unit won't have any dependencies.)
2012-11-01 23:32:12 +01:00
Eelco Dolstra 1da362b34b Fix coverage data collection
http://hydra.nixos.org/build/3253046
2012-10-30 17:27:14 +01:00
Eelco Dolstra 1a82024dd8 In the tests, don't start agetty on /dev/ttyS0
Running agetty on ttyS0 interferes with the backdoor, which uses ttyS0
as its standard error.  After agetty starts, writes to the stderr file
descriptor will return EIO (though doing "exec 2>/proc/self/fd/2" will
miracuously fix this).

http://hydra.nixos.org/build/3252782
2012-10-29 21:10:00 +01:00
Eelco Dolstra b4a1893cdd systemd-vconsole-setup: Don't put the X server in non-raw mode
‘systemd-vconsole-setup’ by default operates on /dev/tty0, the
currently active tty.  Since it puts /dev/tty0 in Unicode or ASCII
mode, if the X server is currently active when it runs, keys such as
Alt-F4 won't reach the X server anymore.  So use /dev/tty1 instead.
2012-10-18 11:58:37 -04:00
Eelco Dolstra a4cad32c3d Generate more user-friendly script filenames
This is primarily important in journal entries.
2012-10-18 11:58:37 -04:00
Eelco Dolstra 12d1cd87ce Systemd unit names can contain Nix-illegal characters, so don't include them 2012-10-12 17:32:05 -04:00
Eelco Dolstra 97a2de983b Ensure that swap.target is pulled in by switch-to-configuration even if it failed earlier 2012-10-12 16:38:00 -04:00
Eelco Dolstra b968244aa1 Move fs.target to filesystems.nix 2012-10-12 15:08:44 -04:00
Eelco Dolstra d63da5892c Ensure that systemd-modules-load is restarted when boot.kernelModules changes 2012-10-11 17:58:46 -04:00
Eelco Dolstra b606165bd9 Allow a unit to declare "triggers" that force a restart
The triggers are just arbitrary strings that are included in the unit
under X-Restart-Triggers.  The idea is that if they change between
reconfigurations, switch-to-configuration will restart the unit
because its store path changed.  This is mostly useful for services
that implicitly depend on generated files in /etc.  Thus you can say

  restartTriggers = [ confFile ];

where ‘confFile’ is the derivation that generated the /etc file in
question.
2012-10-11 17:54:43 -04:00
Eelco Dolstra 4104f60800 Fix accidental commit 2012-10-11 12:43:08 -04:00
Eelco Dolstra d7458b5fc2 Split the monolithic network-interface service into multiple units
For each statically configured interface, we now create a unit
‘<interface>-cfg.service’ which gets started as soon as the network
device comes up.  Similarly, each bridge defined in
‘networking.bridges’ and virtual interface in ‘networking.interfaces’
is created by a service ‘<interface>.service’.

So if we have

  networking.bridges.br0.interfaces = [ "eth0" "eth1" ];
  networking.interfaces =
    [ { name = "br0";
        ipAddress = "192.168.1.1";
      }
    ];

then there will be a unit ‘br0.service’ that depends on
‘sys-subsystem-net-devices-eth0.device’ and
‘sys-subsystem-net-devices-eth1.device’, and a unit ‘br0-cfg.service’
that depends on ‘sys-subsystem-net-devices-br0.device’.
2012-10-10 17:55:42 -04:00
Eelco Dolstra 62b707de07 Add support for postStop scripts 2012-10-10 17:55:13 -04:00
Eelco Dolstra 17a7f48364 Add an option for BindsTo dependencies 2012-10-10 16:50:41 -04:00
Eelco Dolstra d71c0bb834 Respect partOf etc. for socket and target units 2012-10-09 15:14:15 -04:00
Eelco Dolstra f451afea8f Remove ‘services.journald.logKernelMessages’
This option no longer exists in systemd.
2012-10-08 10:51:17 -04:00
Eelco Dolstra 2cf5e3cb66 Add options ‘boot.systemd.targets’ and ‘boot.systemd.sockets’ 2012-10-01 18:58:11 -04:00
Eelco Dolstra 13d747c11a Support postStart scripts in service units 2012-10-01 16:45:49 -04:00
Eelco Dolstra 891be375b5 Make unitConfig/serviceConfig attribute sets
So instead of:

  boot.systemd.services."foo".serviceConfig =
    ''
      StartLimitInterval=10
      CPUShare=500
    '';

you can say:

  boot.systemd.services."foo".serviceConfig.StartLimitInterval = 10;
  boot.systemd.services."foo".serviceConfig.CPUShare = 500;

This way all unit options are available and users can set/override
options in configuration.nix.
2012-10-01 16:27:42 -04:00
Eelco Dolstra 353522ef79 Remove JoinControllers line because upstream reverted joining cpuset 2012-10-01 14:33:01 -04:00
Eelco Dolstra 1ad655bdcf Don't join the cpuset controller with cpu/cpuacct
This works around the problem described here:

http://lists.freedesktop.org/archives/systemd-devel/2012-September/006648.html
2012-09-21 22:56:13 -04:00
Eelco Dolstra b02c488fde Automatically append ".service" to the name of service units 2012-08-23 10:25:27 -04:00
Eelco Dolstra 223f04b3ca Add option ‘boot.systemd.packages’ to use units from the specified packages 2012-08-21 11:28:47 -04:00