From fabe06337ed54e72aaa2bdd5a0b40e8bda61e46b Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 23 Sep 2012 22:26:49 +0200 Subject: [PATCH 1/2] alsa.nix: initialize the sound card before restoring previously stored settings The sound card in my ThinkPad won't work unless "init" is run explicitly. --- modules/services/audio/alsa.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/services/audio/alsa.nix b/modules/services/audio/alsa.nix index 8212b3f9fd0..fa63bc74cfc 100644 --- a/modules/services/audio/alsa.nix +++ b/modules/services/audio/alsa.nix @@ -56,8 +56,9 @@ in '' mkdir -m 0755 -p $(dirname ${soundState}) - # Restore the sound state. - ${alsaUtils}/sbin/alsactl --ignore -f ${soundState} restore + # Try to restore the sound state. + ${alsaUtils}/sbin/alsactl --ignore init || true + ${alsaUtils}/sbin/alsactl --ignore -f ${soundState} restore || true ''; postStop = From 03f13a49392b90cdc54d8ff057cef76bf0379913 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Wed, 26 Sep 2012 21:00:55 +0200 Subject: [PATCH 2/2] Tell sshd not to detach into the background. This makes it easier for systemd to track it and avoids race conditions such as this one: systemd[1]: PID file /run/sshd.pid not readable (yet?) after start. systemd[1]: Failed to start SSH Daemon. systemd[1]: Unit sshd.service entered failed state. systemd[1]: sshd.service holdoff time over, scheduling restart. systemd[1]: Stopping SSH Daemon... systemd[1]: Starting SSH Daemon... sshd[2315]: Server listening on 0.0.0.0 port 22. sshd[2315]: Server listening on :: port 22. sshd[2335]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use. sshd[2335]: error: Bind to port 22 on :: failed: Address already in use. sshd[2335]: fatal: Cannot bind any address. systemd[1]: Started SSH Daemon. --- modules/services/networking/ssh/sshd.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/services/networking/ssh/sshd.nix b/modules/services/networking/ssh/sshd.nix index 242129c355e..373b482f85c 100644 --- a/modules/services/networking/ssh/sshd.nix +++ b/modules/services/networking/ssh/sshd.nix @@ -351,10 +351,10 @@ in serviceConfig = '' ExecStart=\ - ${pkgs.openssh}/sbin/sshd -h ${cfg.hostKeyPath} \ + ${pkgs.openssh}/sbin/sshd -D -h ${cfg.hostKeyPath} \ -f ${pkgs.writeText "sshd_config" cfg.extraConfig} Restart=always - Type=forking + Type=simple KillMode=process PIDFile=/run/sshd.pid '';