summary refs log tree commit diff
path: root/pkgs/os-specific
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-20 19:31:01 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-04-20 19:31:01 +0200
commit4e8c2f0ff91c19065f44fd66c9d869b920631557 (patch)
treefcdb6062bbcb33f4ed4013ed9b4a0020e166d948 /pkgs/os-specific
parentcb83796abb3870cf6dc74c4823067bc7b43a9395 (diff)
parenta0c0dfb6471506a1c4b98c8b6ec7a31271025573 (diff)
downloadnixlib-4e8c2f0ff91c19065f44fd66c9d869b920631557.tar
nixlib-4e8c2f0ff91c19065f44fd66c9d869b920631557.tar.gz
nixlib-4e8c2f0ff91c19065f44fd66c9d869b920631557.tar.bz2
nixlib-4e8c2f0ff91c19065f44fd66c9d869b920631557.tar.lz
nixlib-4e8c2f0ff91c19065f44fd66c9d869b920631557.tar.xz
nixlib-4e8c2f0ff91c19065f44fd66c9d869b920631557.tar.zst
nixlib-4e8c2f0ff91c19065f44fd66c9d869b920631557.zip
Merge branch 'systemd-update'
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r--pkgs/os-specific/linux/cpupower/default.nix42
-rw-r--r--pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix37
-rw-r--r--pkgs/os-specific/linux/kernel-headers/3.14.nix (renamed from pkgs/os-specific/linux/kernel-headers/2.6.28.nix)38
-rw-r--r--pkgs/os-specific/linux/kernel/common-config.nix1
-rw-r--r--pkgs/os-specific/linux/kmod/default.nix4
-rw-r--r--pkgs/os-specific/linux/kmod/module-dir.patch46
-rw-r--r--pkgs/os-specific/linux/lvm2/default.nix6
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/default.nix6
-rw-r--r--pkgs/os-specific/linux/pam/default.nix6
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix51
-rw-r--r--pkgs/os-specific/linux/systemd/fix_console_in_containers.patch14
-rw-r--r--pkgs/os-specific/linux/systemd/fixes.patch814
-rw-r--r--pkgs/os-specific/linux/systemd/libc-bug-accept4-arm.patch81
-rw-r--r--pkgs/os-specific/linux/util-linux/default.nix12
14 files changed, 351 insertions, 807 deletions
diff --git a/pkgs/os-specific/linux/cpupower/default.nix b/pkgs/os-specific/linux/cpupower/default.nix
new file mode 100644
index 000000000000..bf6e8c36f3df
--- /dev/null
+++ b/pkgs/os-specific/linux/cpupower/default.nix
@@ -0,0 +1,42 @@
+{ stdenv, fetchurl, kernel, coreutils, pciutils, gettext }:
+
+stdenv.mkDerivation {
+  name = "cpupower-${kernel.version}";
+
+  src = kernel.src;
+
+  buildInputs = [ coreutils pciutils gettext ];
+
+  configurePhase = ''
+    cd tools/power/cpupower
+    sed -i 's,/bin/true,${coreutils}/bin/true,' Makefile
+    sed -i 's,/bin/pwd,${coreutils}/bin/pwd,' Makefile
+    sed -i 's,/usr/bin/install,${coreutils}/bin/install,' Makefile
+  '';
+
+  buildPhase = ''
+    make
+  '';
+
+  installPhase = ''
+    make \
+      bindir="$out/bin" \
+      sbindir="$out/sbin" \
+      mandir="$out/share/man" \
+      includedir="$out/include" \
+      libdir="$out/lib" \
+      localedir="$out/share/locale" \
+      docdir="$out/share/doc/cpupower" \
+      confdir="$out/etc" \
+      install install-man
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Tool to examine and tune power saving features.";
+    homepage = https://www.kernel.org.org/;
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix b/pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
index f5efc565753c..5afa2cbe4ebf 100644
--- a/pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
+++ b/pkgs/os-specific/linux/firmware/firmware-linux-nonfree/default.nix
@@ -6,26 +6,27 @@
 { stdenv, fetchurl, dpkg }:
 
 let
-  version = "0.40";
+  version = "0.41";
 
   packages = [
-    { name = "adi"; sha256 = "0wwks9ff4n772435s57z1fjrffi4xl9nxnfn3v7xfcwdjb395d88"; }
-    { name = "atheros"; sha256 = "1gj7hfnyclzgyq06scynaclnfajhs6lw5i51j1w1hikv4yh20djz"; }
-    { name = "bnx2"; sha256 = "15qjj0sfjin5cbkpby29r5czn11xyiyyc4fmhwlqvgfgrnbp0aqk"; }
-    { name = "bnx2x"; sha256 = "08nvbln94ff47b2q0avxj1aa2wx4qih8sq8knbq54lp46kjf3k0h"; }
-    { name = "brcm80211"; sha256 = "1ndsw3s6xkr1n39nf9ig1xhnaglx5qvvvm8rh6ah41v644lzha79"; }
-    { name = "intelwimax"; sha256 = "1qwxmykh90v92asn4ivq0fak761hs7hd2zmz1dpkjidwsycrfyqn"; }
-    { name = "ipw2x00"; sha256 = "0a2nb17b5n3k1b6y4dbi5i8k1fm19ba2abq2jh2hjjmyyl3y388m"; }
-    { name = "ivtv"; sha256 = "1239gsjq16f4kd1yn77iq3ar8ndx3pzd16kpqafr1h2y0zwh452r"; }
-    { name = "iwlwifi"; sha256 = "03kmh5szd02pkbm1nlyz99fr2njhg88wiv73f1fz485m9rvgga43"; }
-    { name = "libertas"; sha256 = "0qjziwmwqbp83hxrjw7x3ralxg4ib9y23bcbn1g8yb5b6m84ca6b"; }
-    { name = "linux"; sha256 = "0ypidsrrfx4kvbfisdpgx2fzbil7g2jixgqhnv960iy5l348amrl"; }
-    { name = "linux-nonfree"; sha256 = "0p9ql3cdxljflh48r6z40kpyisbzp3s3g1qjb9f64n6cppllwjfr"; }
-    { name = "myricom"; sha256 = "12spfaq7z2bb93cy15zldlic1wx2v6h9sn7ny09nkzy4m26zds4q"; }
-    { name = "netxen"; sha256 = "03gmda16bdqw8a4x8x11ph41ksjh48hxydv0f0z3gi3czgbh7sn3"; }
-    { name = "qlogic"; sha256 = "1ah8rrwzi44p1l4q8qkql18djmn5kihsiinpy204xklm1csf3vs1"; }
-    { name = "ralink"; sha256 = "005549jk0wnyfnb247awv2wncsx5is05m1hdwcd33iq0dlbmm39b"; }
-    { name = "realtek"; sha256 = "1ai1klzrql8qxmb7945xiqlkfkyz8admrpb10b3r4ixvclkrvfi2"; }
+    { name = "adi"; sha256 = "19dm96djp34g6l84g9shwbmqbmfd15c24frcy1zh5nz8x12phgm4"; }
+    { name = "atheros"; sha256 = "0vrdyxiq7nx89h6ykdrs8s3l9frn3hmcfb9vsz68i12975y8ib5n"; }
+    { name = "bnx2"; sha256 = "12l3l54q69n1ky8lp7bmzscfqysabjrgmswwj57ryc6l82s7081y"; }
+    { name = "bnx2x"; sha256 = "10m9p479dq2ylpj5mw6d5vyfh9hybmh5xgs5sxma065v7r3c3v31"; }
+    { name = "brcm80211"; sha256 = "0l2lg5pshb1kb829hfq9w791scwa8biikrfzsx9wvlvkyxfdh187"; }
+    { name = "intelwimax"; sha256 = "13jqm8ik0mm8vnsskbbp63idpjqazzp2x4gaq7786jg5yj3zh1cf"; }
+    { name = "ipw2x00"; sha256 = "1hvxrzqbc75phxdbmqfh7ky36m0qna2pncwxpfdircy9i6fx7ipy"; }
+    { name = "ivtv"; sha256 = "0ckw1ynzfqnkwlmwpzfbdfx4s6bsl4nwp097g8khaavqxk94n88v"; }
+    { name = "iwlwifi"; sha256 = "1djazi2qsi5z6q0izirprxgfpg8vh55skab2nijyfl66drlcha72"; }
+    { name = "libertas"; sha256 = "1yj9dd9pwd98gknx5mvblfcbr6k347xzi8l6bk0pr4570j8ss8y3"; }
+    { name = "linux"; sha256 = "0vc4cbrq73y5hibx5k3gbfqaqxvaa3g8rv9kzwks2zl3hdxm6xaq"; }
+    { name = "linux-nonfree"; sha256 = "05vv8yq7kix5cw9s4agz4vgya6i3ff88jp3rxln1ssznhvzrjzx9"; }
+    { name = "myricom"; sha256 = "1idfvdfw7z4jbbjyq40hd2bpllvw7jz0ah7k3iwljxp8l2lf2nmf"; }
+    { name = "netxen"; sha256 = "0fdgllv8i7j9qbk5hi14zvw6fcn4nd1isr1486d8fv7nf2bf1mxx"; }
+    { name = "qlogic"; sha256 = "12w1qnqhs24am2psdfmv0ligczzxh9crllmp7r4y3vqghyvwax7i"; }
+    { name = "ralink"; sha256 = "1ryplg9shi7nam79zd86z7a0qzp0f9m7q89nq989z57qiysbrra4"; }
+    { name = "realtek"; sha256 = "1l867724qrw7nwksdv4k0hkz7nrjjs9vq2s3937wyaa0r2r66mg6"; }
+    { name = "ti-connectivity"; sha256 = "00cl9gyxa7795a57zwcvl26kxfl4qzppi4z8ksg5friv3db8sm1p"; }
   ];
 
   fetchPackage =
diff --git a/pkgs/os-specific/linux/kernel-headers/2.6.28.nix b/pkgs/os-specific/linux/kernel-headers/3.14.nix
index 1ba03010f8ab..d9d0ce7e3b3d 100644
--- a/pkgs/os-specific/linux/kernel-headers/2.6.28.nix
+++ b/pkgs/os-specific/linux/kernel-headers/3.14.nix
@@ -1,46 +1,50 @@
-{stdenv, fetchurl, perl, cross ? null}:
+{ stdenv, fetchurl, perl, cross ? null }:
 
 assert cross == null -> stdenv.isLinux;
 
-let version = "2.6.28.5"; in
+let
+
+  version = "3.14.1";
+
+  kernelHeadersBaseConfig =
+    if cross == null
+    then stdenv.platform.kernelHeadersBaseConfig
+    else cross.platform.kernelHeadersBaseConfig;
+
+in
 
 stdenv.mkDerivation {
   name = "linux-headers-${version}";
 
   src = fetchurl {
-    url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-    sha256 = "0hifjh75sinifr5138v22zwbpqln6lhn65k8b57a1dyzlqca7cl9";
+    url = "mirror://kernel/linux/kernel/v3.x/linux-${version}.tar.xz";
+    sha256 = "1njm8gvlj7cq0m1051yxszl4f63383a7sv1na13hkqkv36kipgqx";
   };
 
   targetConfig = if cross != null then cross.config else null;
 
   platform =
-    if cross != null then cross.arch else
+    if cross != null then cross.platform.kernelArch else
     if stdenv.system == "i686-linux" then "i386" else
     if stdenv.system == "x86_64-linux" then "x86_64" else
     if stdenv.system == "powerpc-linux" then "powerpc" else
     if stdenv.isArm then "arm" else
-    if stdenv.system == "mips64el-linux" then "mips" else
+    if stdenv.platform ? kernelArch then stdenv.platform.kernelArch else
     abort "don't know what the kernel include directory is called for this platform";
 
   buildInputs = [perl];
 
   extraIncludeDirs =
     if cross != null then
-	(if cross.arch == "powerpc" then ["ppc"] else [])
+        (if cross.arch == "powerpc" then ["ppc"] else [])
     else if stdenv.system == "powerpc-linux" then ["ppc"] else [];
 
-  patchPhase = ''
-    patch --verbose -p1 < "${./unifdef-getline.patch}"
-    sed -i '/scsi/d' include/Kbuild
-    sed -i 's|/ %/: prepare scripts FORCE|%/: prepare scripts FORCE|' Makefile
-  '';
-
   buildPhase = ''
     if test -n "$targetConfig"; then
        export ARCH=$platform
     fi
-    make mrproper headers_check
+    make ${kernelHeadersBaseConfig} SHELL=bash
+    make mrproper headers_check SHELL=bash
   '';
 
   installPhase = ''
@@ -58,4 +62,10 @@ stdenv.mkDerivation {
       ln -s asm $out/include/asm-x86
     fi
   '';
+
+  meta = with stdenv.lib; {
+    description = "Header files and scripts for Linux kernel";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
 }
diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix
index 15473ea257c5..db654fc0505c 100644
--- a/pkgs/os-specific/linux/kernel/common-config.nix
+++ b/pkgs/os-specific/linux/kernel/common-config.nix
@@ -114,6 +114,7 @@ with stdenv.lib;
   VGA_SWITCHEROO y
 
   # Sound.
+  SND_DYNAMIC_MINORS y
   SND_AC97_POWER_SAVE y # AC97 Power-Saving Mode
   SND_HDA_INPUT_BEEP y # Support digital beep via input layer
   SND_USB_CAIAQ_INPUT y
diff --git a/pkgs/os-specific/linux/kmod/default.nix b/pkgs/os-specific/linux/kmod/default.nix
index 378e1a87d07a..380b4a35f1c2 100644
--- a/pkgs/os-specific/linux/kmod/default.nix
+++ b/pkgs/os-specific/linux/kmod/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, xz, zlib, pkgconfig, libxslt }:
 
 stdenv.mkDerivation rec {
-  name = "kmod-16";
+  name = "kmod-17";
 
   src = fetchurl {
     url = "mirror://kernel/linux/utils/kernel/kmod/${name}.tar.xz";
-    sha256 = "63412efab37c70459ccef167556965c93fd4f56af5986cd3750542a684c613c5";
+    sha256 = "1yid3a9b64a60ybj66fk2ysrq5klnl0ijl4g624cl16y8404g9rv";
   };
 
   # Disable xz/zlib support to prevent needing them in the initrd.
diff --git a/pkgs/os-specific/linux/kmod/module-dir.patch b/pkgs/os-specific/linux/kmod/module-dir.patch
index 95d08da45804..0c4ab4bd4c44 100644
--- a/pkgs/os-specific/linux/kmod/module-dir.patch
+++ b/pkgs/os-specific/linux/kmod/module-dir.patch
@@ -1,7 +1,7 @@
-diff -Naur kmod-7-orig/libkmod/libkmod.c kmod-7/libkmod/libkmod.c
---- kmod-7-orig/libkmod/libkmod.c	2012-03-15 08:19:16.750010226 -0400
-+++ kmod-7/libkmod/libkmod.c	2012-04-04 15:21:29.532074313 -0400
-@@ -200,7 +200,7 @@
+diff -ru -x '*~' kmod-17-orig/libkmod/libkmod.c kmod-17/libkmod/libkmod.c
+--- kmod-17-orig/libkmod/libkmod.c	2014-04-01 12:40:37.161940089 +0200
++++ kmod-17/libkmod/libkmod.c	2014-04-17 13:47:15.871441987 +0200
+@@ -201,7 +201,7 @@
  static char *get_kernel_release(const char *dirname)
  {
  	struct utsname u;
@@ -10,7 +10,7 @@ diff -Naur kmod-7-orig/libkmod/libkmod.c kmod-7/libkmod/libkmod.c
  
  	if (dirname != NULL)
  		return path_make_absolute_cwd(dirname);
-@@ -208,7 +208,10 @@
+@@ -209,7 +209,10 @@
  	if (uname(&u) < 0)
  		return NULL;
  
@@ -22,3 +22,39 @@ diff -Naur kmod-7-orig/libkmod/libkmod.c kmod-7/libkmod/libkmod.c
  		return NULL;
  
  	return p;
+diff -ru -x '*~' kmod-17-orig/tools/static-nodes.c kmod-17/tools/static-nodes.c
+--- kmod-17-orig/tools/static-nodes.c	2013-12-17 22:05:42.159047316 +0100
++++ kmod-17/tools/static-nodes.c	2014-04-17 13:51:17.945974320 +0200
+@@ -159,6 +159,7 @@
+ 	FILE *in = NULL, *out = NULL;
+ 	const struct static_nodes_format *format = &static_nodes_format_human;
+ 	int r, ret = EXIT_SUCCESS;
++	char *dirname_prefix;
+ 
+ 	for (;;) {
+ 		int c, idx = 0, valid;
+@@ -211,16 +212,19 @@
+ 		goto finish;
+ 	}
+ 
+-	snprintf(modules, sizeof(modules), "/lib/modules/%s/modules.devname", kernel.release);
++	if ((dirname_prefix = getenv("MODULE_DIR")) == NULL)
++		dirname_prefix = "/lib/modules";
++
++	snprintf(modules, sizeof(modules), "%s/%s/modules.devname", dirname_prefix, kernel.release);
+ 	in = fopen(modules, "re");
+ 	if (in == NULL) {
+ 		if (errno == ENOENT) {
+-			fprintf(stderr, "Warning: /lib/modules/%s/modules.devname not found - ignoring\n",
+-				kernel.release);
++			fprintf(stderr, "Warning: %s/%s/modules.devname not found - ignoring\n",
++				dirname_prefix, kernel.release);
+ 			ret = EXIT_SUCCESS;
+ 		} else {
+-			fprintf(stderr, "Error: could not open /lib/modules/%s/modules.devname - %m\n",
+-				kernel.release);
++			fprintf(stderr, "Error: could not open %s/%s/modules.devname - %m\n",
++				dirname_prefix, kernel.release);
+ 			ret = EXIT_FAILURE;
+ 		}
+ 		goto finish;
diff --git a/pkgs/os-specific/linux/lvm2/default.nix b/pkgs/os-specific/linux/lvm2/default.nix
index bd748dadf616..9e2b0c900794 100644
--- a/pkgs/os-specific/linux/lvm2/default.nix
+++ b/pkgs/os-specific/linux/lvm2/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, pkgconfig, udev, utillinux, coreutils }:
 
 let
-  v = "2.02.104";
+  v = "2.02.106";
 in
 
 stdenv.mkDerivation {
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "ftp://sources.redhat.com/pub/lvm2/releases/LVM2.${v}.tgz";
-    sha256 = "1xa7hvp8bsx96nncgksxrqxaqcgipfmmpr8aysayb8aisyjvas0d";
+    sha256 = "0nr833bl0q4zq52drjxmmpf7bs6kqxwa5kahwwxm9411khkxz0vc";
   };
 
   configureFlags =
@@ -29,6 +29,8 @@ stdenv.mkDerivation {
       sed -i /DEFAULT_PROFILE_DIR/d conf/Makefile.in
     '';
 
+  enableParallelBuilding = true;
+
   #patches = [ ./purity.patch ];
 
   # To prevent make install from failing.
diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix
index 74863496a0f7..2eb5c7e480a2 100644
--- a/pkgs/os-specific/linux/nvidia-x11/default.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/default.nix
@@ -12,7 +12,7 @@ assert (!libsOnly) -> kernel != null;
 
 let
 
-  versionNumber = "331.49";
+  versionNumber = "331.67";
 
 in
 
@@ -27,12 +27,12 @@ stdenv.mkDerivation {
     if stdenv.system == "i686-linux" then
       fetchurl {
         url = "http://us.download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}.run";
-        sha256 = "00d7bq8cfxk52qd4y226fz8m9m3mjq45fbgr3q7k08jyy9qmswmn";
+        sha256 = "1imc66yxnm01i58xwqrwqc612h0rhdz8x170hqr2pjyk99bllsv9";
       }
     else if stdenv.system == "x86_64-linux" then
       fetchurl {
         url = "http://us.download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}-no-compat32.run";
-        sha256 = "0q3lvl1lypi33i847nqz4k3161ackh2n9kgyjn6v2c480f405hfk";
+        sha256 = "0qxd4jd25ymcr6w97f71kfn549x6wgg4g3vixd3sqlczknn85f47";
       }
     else throw "nvidia-x11 does not support platform ${stdenv.system}";
 
diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix
index 43300425c004..afc125556fe2 100644
--- a/pkgs/os-specific/linux/pam/default.nix
+++ b/pkgs/os-specific/linux/pam/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, flex, cracklib }:
 
 stdenv.mkDerivation rec {
-  name = "linux-pam-1.1.6";
+  name = "linux-pam-1.1.8";
 
   src = fetchurl {
-    url = https://fedorahosted.org/releases/l/i/linux-pam/Linux-PAM-1.1.6.tar.bz2;
-    sha256 = "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s";
+    url = http://www.linux-pam.org/library/Linux-PAM-1.1.8.tar.bz2;
+    sha256 = "0m8ygb40l1c13nsd4hkj1yh4p1ldawhhg8pyjqj9w5kd4cxg5cf4";
   };
 
   nativeBuildInputs = [ flex ];
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index 0afaf7b03703..262fde749843 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, pkgconfig, intltool, gperf, libcap, dbus, kmod
 , xz, pam, acl, cryptsetup, libuuid, m4, utillinux
 , glib, kbd, libxslt, coreutils, libgcrypt, sysvtools, docbook_xsl
-, kexectools, libmicrohttpd
+, kexectools, libmicrohttpd, linuxHeaders
 , python ? null, pythonSupport ? false
 }:
 
@@ -10,26 +10,24 @@ assert stdenv.isLinux;
 assert pythonSupport -> python != null;
 
 stdenv.mkDerivation rec {
-  version = "203";
+  version = "212";
   name = "systemd-${version}";
 
   src = fetchurl {
     url = "http://www.freedesktop.org/software/systemd/${name}.tar.xz";
-    sha256 = "07gvn3rpski8sh1nz16npjf2bvj0spsjdwc5px9685g2pi6kxcb1";
+    sha256 = "1hpjcc42svrs06q3isjm3m5aphgkpfdylmvpnif71zh46ys0cab5";
   };
 
   patches =
     [ # These are all changes between upstream and
-      # https://github.com/edolstra/systemd/tree/nixos-v203.
+      # https://github.com/edolstra/systemd/tree/nixos-v212.
       ./fixes.patch
-      ./fix_console_in_containers.patch
-    ]
-    ++ stdenv.lib.optional stdenv.isArm ./libc-bug-accept4-arm.patch;
+    ];
 
   buildInputs =
-    [ pkgconfig intltool gperf libcap dbus.libs kmod xz pam acl
+    [ pkgconfig intltool gperf libcap kmod xz pam acl
       /* cryptsetup */ libuuid m4 glib libxslt libgcrypt docbook_xsl
-      libmicrohttpd
+      libmicrohttpd linuxHeaders
     ] ++ stdenv.lib.optional pythonSupport python;
 
   configureFlags =
@@ -45,15 +43,18 @@ stdenv.mkDerivation rec {
       "--with-dbussessionservicedir=$(out)/share/dbus-1/services"
       "--with-firmware-path=/root/test-firmware:/run/current-system/firmware"
       "--with-tty-gid=3" # tty in NixOS has gid 3
+      "--disable-networkd" # enable/use eventually
+      "--enable-compat-libs" # get rid of this eventually
     ];
 
   preConfigure =
     ''
       # FIXME: patch this in systemd properly (and send upstream).
       # FIXME: use sulogin from util-linux once updated.
-      for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.m4.in src/journal/cat.c src/core/shutdown.c; do
+      for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.m4.in src/journal/cat.c src/core/shutdown.c src/nspawn/nspawn.c; do
         test -e $i
         substituteInPlace $i \
+          --replace /usr/bin/getent ${stdenv.glibc}/bin/getent \
           --replace /bin/mount ${utillinux}/bin/mount \
           --replace /bin/umount ${utillinux}/bin/umount \
           --replace /sbin/swapon ${utillinux}/sbin/swapon \
@@ -69,6 +70,10 @@ stdenv.mkDerivation rec {
         --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/
     '';
 
+  # This is needed because systemd uses the gold linker, which doesn't
+  # yet have the wrapper script to add rpath flags automatically.
+  NIX_LDFLAGS = "-rpath ${pam}/lib -rpath ${libcap}/lib -rpath ${acl}/lib -rpath ${stdenv.gcc.gcc}/lib";
+
   PYTHON_BINARY = "${coreutils}/bin/env python"; # don't want a build time dependency on Python
 
   NIX_CFLAGS_COMPILE =
@@ -77,10 +82,6 @@ stdenv.mkDerivation rec {
       "-UPOLKIT_AGENT_BINARY_PATH" "-DPOLKIT_AGENT_BINARY_PATH=\"/run/current-system/sw/bin/pkttyagent\""
       "-fno-stack-protector"
 
-      # Work around our kernel headers being too old.  FIXME: remove
-      # this after the next stdenv update.
-      "-DFS_NOCOW_FL=0x00800000"
-
       # Set the release_agent on /sys/fs/cgroup/systemd to the
       # currently running systemd (/run/current-system/systemd) so
       # that we don't use an obsolete/garbage-collected release agent.
@@ -94,7 +95,12 @@ stdenv.mkDerivation rec {
   # /var is mounted.
   makeFlags = "hwdb_bin=/var/lib/udev/hwdb.bin";
 
-  installFlags = "localstatedir=$(TMPDIR)/var sysconfdir=$(out)/etc sysvinitdir=$(TMPDIR)/etc/init.d";
+  installFlags =
+    [ "localstatedir=$(TMPDIR)/var"
+      "sysconfdir=$(out)/etc"
+      "sysvinitdir=$(TMPDIR)/etc/init.d"
+      "pamconfdir=$(out)/etc/pam.d"
+    ];
 
   # Get rid of configuration-specific data.
   postInstall =
@@ -103,6 +109,8 @@ stdenv.mkDerivation rec {
       mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example
       mv $out/lib/systemd/{system,user} $out/example/systemd
 
+      rm -rf $out/etc/systemd/system
+
       # Install SysV compatibility commands.
       mkdir -p $out/sbin
       ln -s $out/lib/systemd/systemd $out/sbin/telinit
@@ -128,19 +136,6 @@ stdenv.mkDerivation rec {
   # runtime; otherwise we can't and we need to reboot.
   passthru.interfaceVersion = 2;
 
-  passthru.headers = stdenv.mkDerivation {
-    name = "systemd-headers-${version}";
-    inherit src;
-
-    phases = [ "unpackPhase" "installPhase" ];
-
-    # some are needed by dbus.libs, which is needed for systemd :-)
-    installPhase = ''
-      mkdir -p "$out/include/systemd"
-      mv src/systemd/*.h "$out/include/systemd"
-    '';
-  };
-
   meta = {
     homepage = "http://www.freedesktop.org/wiki/Software/systemd";
     description = "A system and service manager for Linux";
diff --git a/pkgs/os-specific/linux/systemd/fix_console_in_containers.patch b/pkgs/os-specific/linux/systemd/fix_console_in_containers.patch
deleted file mode 100644
index 005c00282020..000000000000
--- a/pkgs/os-specific/linux/systemd/fix_console_in_containers.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -ruN systemd-203/units/getty@.service.m4 systemd-203-patched/units/getty@.service.m4
---- systemd-203/units/getty@.service.m4	2013-01-07 22:50:49.083315575 +0100
-+++ systemd-203-patched/units/getty@.service.m4	2014-03-18 09:54:40.002476232 +0100
-@@ -23,7 +23,9 @@
- # On systems without virtual consoles, don't start any getty. (Note
- # that serial gettys are covered by serial-getty@.service, not this
- # unit
--ConditionPathExists=/dev/tty0
-+ConditionPathExists=|/dev/tty0
-+ConditionVirtualization=|lxc
-+ConditionVirtualization=|lxc-libvirt
- 
- [Service]
- # the VT is cleared by TTYVTDisallocate
diff --git a/pkgs/os-specific/linux/systemd/fixes.patch b/pkgs/os-specific/linux/systemd/fixes.patch
index 0ad420cd35cc..c33d05da55a6 100644
--- a/pkgs/os-specific/linux/systemd/fixes.patch
+++ b/pkgs/os-specific/linux/systemd/fixes.patch
@@ -1,144 +1,23 @@
-diff --git a/man/systemd.special.xml b/man/systemd.special.xml
-index 7164b1e..29401eb 100644
---- a/man/systemd.special.xml
-+++ b/man/systemd.special.xml
-@@ -381,7 +381,7 @@
-                                         this unit during
-                                         installation. This is best
-                                         configured via
--                                        <varname>WantedBy=multi-uer.target</varname>
-+                                        <varname>WantedBy=multi-user.target</varname>
-                                         in the unit's
-                                         <literal>[Install]</literal>
-                                         section.</para>
-diff --git a/rules/80-net-name-slot.rules b/rules/80-net-name-slot.rules
-index 15b5bc4..c5f1b38 100644
---- a/rules/80-net-name-slot.rules
-+++ b/rules/80-net-name-slot.rules
-@@ -1,6 +1,6 @@
- # do not edit this file, it will be overwritten on update
- 
--ACTION=="remove", GOTO="net_name_slot_end"
-+ACTION!="add", GOTO="net_name_slot_end"
- SUBSYSTEM!="net", GOTO="net_name_slot_end"
- NAME!="", GOTO="net_name_slot_end"
- 
 diff --git a/rules/99-systemd.rules.in b/rules/99-systemd.rules.in
-index d17bdd9..040b10e 100644
+index db72373..2fc12ca 100644
 --- a/rules/99-systemd.rules.in
 +++ b/rules/99-systemd.rules.in
 @@ -14,10 +14,6 @@ KERNEL=="vport*", TAG+="systemd"
- SUBSYSTEM=="block", KERNEL!="ram*|loop*", TAG+="systemd"
- SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
+ SUBSYSTEM=="block", KERNEL!="ram*", TAG+="systemd"
+ SUBSYSTEM=="block", KERNEL!="ram*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", ENV{SYSTEMD_READY}="0"
  
 -# Ignore encrypted devices with no identified superblock on it, since
 -# we are probably still calling mke2fs or mkswap on it.
--SUBSYSTEM=="block", KERNEL!="ram*|loop*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0"
+-SUBSYSTEM=="block", KERNEL!="ram*", ENV{DM_UUID}=="CRYPT-*", ENV{ID_PART_TABLE_TYPE}=="", ENV{ID_FS_USAGE}=="", ENV{SYSTEMD_READY}="0"
 -
  # Ignore raid devices that are not yet assembled and started
  SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", TEST!="md/array_state", ENV{SYSTEMD_READY}="0"
  SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="md*", ATTR{md/array_state}=="|clear|inactive", ENV{SYSTEMD_READY}="0"
-diff --git a/src/core/cgroup-semantics.c b/src/core/cgroup-semantics.c
-index 82b02bb..7df9d01 100644
---- a/src/core/cgroup-semantics.c
-+++ b/src/core/cgroup-semantics.c
-@@ -255,7 +255,7 @@ static int map_blkio(const CGroupSemantics *s, const char *value, char **ret) {
- }
- 
- static const CGroupSemantics semantics[] = {
--        { "cpu",     "cpu.shares",                 "CPUShare",              false, parse_cpu_shares,          NULL,       NULL },
-+        { "cpu",     "cpu.shares",                 "CPUShares",             false, parse_cpu_shares,          NULL,       NULL },
-         { "memory",  "memory.soft_limit_in_bytes", "MemorySoftLimit",       false, parse_memory_limit,        NULL,       NULL },
-         { "memory",  "memory.limit_in_bytes",      "MemoryLimit",           false, parse_memory_limit,        NULL,       NULL },
-         { "devices", "devices.allow",              "DeviceAllow",           true,  parse_device,              map_device, NULL },
-diff --git a/src/core/dbus-execute.h b/src/core/dbus-execute.h
-index 91d70e5..698102f 100644
---- a/src/core/dbus-execute.h
-+++ b/src/core/dbus-execute.h
-@@ -63,7 +63,7 @@
-         "  <property name=\"CPUSchedulingPolicy\" type=\"i\" access=\"read\"/>\n" \
-         "  <property name=\"CPUSchedulingPriority\" type=\"i\" access=\"read\"/>\n" \
-         "  <property name=\"CPUAffinity\" type=\"ay\" access=\"read\"/>\n" \
--        "  <property name=\"TimerSlackNS\" type=\"t\" access=\"read\"/>\n" \
-+        "  <property name=\"TimerSlackNSec\" type=\"t\" access=\"read\"/>\n" \
-         "  <property name=\"CPUSchedulingResetOnFork\" type=\"b\" access=\"read\"/>\n" \
-         "  <property name=\"NonBlocking\" type=\"b\" access=\"read\"/>\n" \
-         "  <property name=\"StandardInput\" type=\"s\" access=\"read\"/>\n" \
-diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
-index 56b02a1..2b6d799 100644
---- a/src/core/dbus-manager.c
-+++ b/src/core/dbus-manager.c
-@@ -1550,7 +1550,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
-                 _cleanup_strv_free_ char **l = NULL;
-                 char **e = NULL;
- 
--                SELINUX_ACCESS_CHECK(connection, message, "reboot");
-+                SELINUX_ACCESS_CHECK(connection, message, "reload");
- 
-                 r = bus_parse_strv(message, &l);
-                 if (r == -ENOMEM)
-@@ -1577,7 +1577,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
-                 _cleanup_strv_free_ char **l = NULL;
-                 char **e = NULL;
- 
--                SELINUX_ACCESS_CHECK(connection, message, "reboot");
-+                SELINUX_ACCESS_CHECK(connection, message, "reload");
- 
-                 r = bus_parse_strv(message, &l);
-                 if (r == -ENOMEM)
-@@ -1605,7 +1605,7 @@ static DBusHandlerResult bus_manager_message_handler(DBusConnection *connection,
-                 char **f = NULL;
-                 DBusMessageIter iter;
- 
--                SELINUX_ACCESS_CHECK(connection, message, "reboot");
-+                SELINUX_ACCESS_CHECK(connection, message, "reload");
- 
-                 if (!dbus_message_iter_init(message, &iter))
-                         goto oom;
-diff --git a/src/core/dbus-swap.c b/src/core/dbus-swap.c
-index 2e99fba..e72749a 100644
---- a/src/core/dbus-swap.c
-+++ b/src/core/dbus-swap.c
-@@ -93,6 +93,7 @@ static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_swap_append_swap_result, swap_result,
- static const BusProperty bus_swap_properties[] = {
-         { "What",       bus_property_append_string, "s", offsetof(Swap, what),  true },
-         { "Priority",   bus_swap_append_priority,   "i", 0 },
-+        { "TimeoutUSec",bus_property_append_usec,   "t", offsetof(Swap, timeout_usec)},
-         BUS_EXEC_COMMAND_PROPERTY("ExecActivate",   offsetof(Swap, exec_command[SWAP_EXEC_ACTIVATE]),   false),
-         BUS_EXEC_COMMAND_PROPERTY("ExecDeactivate", offsetof(Swap, exec_command[SWAP_EXEC_DEACTIVATE]), false),
-         { "ControlPID", bus_property_append_pid,    "u", offsetof(Swap, control_pid) },
 diff --git a/src/core/main.c b/src/core/main.c
-index 7fc06be..101ce79 100644
+index 41605ee..8517369 100644
 --- a/src/core/main.c
 +++ b/src/core/main.c
-@@ -1590,14 +1590,14 @@ int main(int argc, char *argv[]) {
-                         log_error("Failed to adjust timer slack: %m");
- 
-         if (arg_capability_bounding_set_drop) {
--                r = capability_bounding_set_drop(arg_capability_bounding_set_drop, true);
-+                r = capability_bounding_set_drop_usermode(arg_capability_bounding_set_drop);
-                 if (r < 0) {
--                        log_error("Failed to drop capability bounding set: %s", strerror(-r));
-+                        log_error("Failed to drop capability bounding set of usermode helpers: %s", strerror(-r));
-                         goto finish;
-                 }
--                r = capability_bounding_set_drop_usermode(arg_capability_bounding_set_drop);
-+                r = capability_bounding_set_drop(arg_capability_bounding_set_drop, true);
-                 if (r < 0) {
--                        log_error("Failed to drop capability bounding set of usermode helpers: %s", strerror(-r));
-+                        log_error("Failed to drop capability bounding set: %s", strerror(-r));
-                         goto finish;
-                 }
-         }
-@@ -1650,6 +1650,7 @@ int main(int argc, char *argv[]) {
-         /* This will close all file descriptors that were opened, but
-          * not claimed by any unit. */
-         fdset_free(fds);
-+        fds = NULL;
- 
-         if (serialization) {
-                 fclose(serialization);
-@@ -1857,7 +1858,7 @@ finish:
+@@ -1883,7 +1883,7 @@ finish:
                          char_array_0(sfd);
  
                          i = 0;
@@ -147,69 +26,50 @@ index 7fc06be..101ce79 100644
                          if (switch_root_dir)
                                  args[i++] = "--switched-root";
                          args[i++] = arg_running_as == SYSTEMD_SYSTEM ? "--system" : "--user";
-diff --git a/src/core/manager.c b/src/core/manager.c
-index c7f8f20..0508628 100644
---- a/src/core/manager.c
-+++ b/src/core/manager.c
-@@ -1372,7 +1372,7 @@ static int manager_process_signal_fd(Manager *m) {
- 
-                 case SIGINT:
-                         if (m->running_as == SYSTEMD_SYSTEM) {
--                                manager_start_target(m, SPECIAL_CTRL_ALT_DEL_TARGET, JOB_REPLACE);
-+                                manager_start_target(m, SPECIAL_CTRL_ALT_DEL_TARGET, JOB_REPLACE_IRREVERSIBLY);
-                                 break;
-                         }
- 
-diff --git a/src/core/service.c b/src/core/service.c
-index 3617c24..4d0e2ad 100644
---- a/src/core/service.c
-+++ b/src/core/service.c
-@@ -2642,6 +2642,9 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) {
-         if (s->exec_context.var_tmp_dir)
-                 unit_serialize_item(u, f, "var-tmp-dir", s->exec_context.var_tmp_dir);
- 
-+        if (s->forbid_restart)
-+                unit_serialize_item(u, f, "forbid-restart", yes_no(s->forbid_restart));
-+
-         return 0;
- }
- 
-@@ -2776,6 +2779,14 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value,
-                         return log_oom();
- 
-                 s->exec_context.var_tmp_dir = t;
-+        } else if (streq(key, "forbid-restart")) {
-+                int b;
-+
-+                b = parse_boolean(value);
-+                if (b < 0)
-+                        log_debug_unit(u->id, "Failed to parse forbid-restart value %s", value);
-+                else
-+                        s->forbid_restart = b;
-         } else
-                 log_debug_unit(u->id, "Unknown serialization key '%s'", key);
- 
-diff --git a/src/core/snapshot.c b/src/core/snapshot.c
-index a63eccd..a6807eb 100644
---- a/src/core/snapshot.c
-+++ b/src/core/snapshot.c
-@@ -217,8 +217,10 @@ int snapshot_create(Manager *m, const char *name, bool cleanup, DBusError *e, Sn
-                         if (asprintf(&n, "snapshot-%u.snapshot", ++ m->n_snapshots) < 0)
-                                 return -ENOMEM;
- 
--                        if (!manager_get_unit(m, n))
-+                        if (!manager_get_unit(m, n)) {
-+                                name = n;
-                                 break;
-+                        }
+diff --git a/src/core/socket.c b/src/core/socket.c
+index 7c18a2b..eba67d5 100644
+--- a/src/core/socket.c
++++ b/src/core/socket.c
+@@ -663,16 +663,25 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) {
+                 int k;
+ 
+                 k = getpeercred(fd, &ucred);
+-                if (k < 0)
++                if (k == -ENODATA) {
++                        /* This handles the case where somebody is
++                         * connecting from another pid/uid namespace
++                         * (e.g. from outside of our container). */
++                        if (asprintf(&r,
++                                     "%u-unknown",
++                                     nr) < 0)
++                                return -ENOMEM;
++                }
++                else if (k < 0)
+                         return k;
+-
+-                if (asprintf(&r,
+-                             "%u-%lu-%lu",
+-                             nr,
+-                             (unsigned long) ucred.pid,
+-                             (unsigned long) ucred.uid) < 0)
+-                        return -ENOMEM;
+-
++                else {
++                        if (asprintf(&r,
++                                     "%u-%lu-%lu",
++                                     nr,
++                                     (unsigned long) ucred.pid,
++                                     (unsigned long) ucred.uid) < 0)
++                                return -ENOMEM;
++                }
+                 break;
+         }
  
-                         free(n);
-                 }
 diff --git a/src/core/umount.c b/src/core/umount.c
-index 1e95ad7..9f0e471 100644
+index d1258f0..0311812 100644
 --- a/src/core/umount.c
 +++ b/src/core/umount.c
-@@ -435,6 +435,8 @@ static int mount_points_list_umount(MountPoint **head, bool *changed, bool log_e
+@@ -404,6 +404,8 @@ static int mount_points_list_umount(MountPoint **head, bool *changed, bool log_e
                   * anyway, since we are running from it. They have
                   * already been remounted ro. */
                  if (path_equal(m->path, "/")
@@ -218,285 +78,31 @@ index 1e95ad7..9f0e471 100644
  #ifndef HAVE_SPLIT_USR
                      || path_equal(m->path, "/usr")
  #endif
-diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
-index 81b7708..edd0b40 100644
---- a/src/cryptsetup/cryptsetup-generator.c
-+++ b/src/cryptsetup/cryptsetup-generator.c
-@@ -111,6 +111,7 @@ static int create_disk(
-                 "Conflicts=umount.target\n"
-                 "DefaultDependencies=no\n"
-                 "BindsTo=dev-mapper-%i.device\n"
-+                "IgnoreOnIsolate=true\n"
-                 "After=systemd-readahead-collect.service systemd-readahead-replay.service\n",
-                 f);
- 
-diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
-index c17299f..6b3e67e 100644
---- a/src/fstab-generator/fstab-generator.c
-+++ b/src/fstab-generator/fstab-generator.c
-@@ -351,7 +351,7 @@ static int add_mount(
- 
-         if (automount && !path_equal(where, "/")) {
-                 automount_name = unit_name_from_path(where, ".automount");
--                if (!name)
-+                if (!automount_name)
-                         return log_oom();
- 
-                 automount_unit = strjoin(arg_dest, "/", automount_name, NULL);
-@@ -596,9 +596,9 @@ static int parse_proc_cmdline(void) {
-                 } else if (startswith(word, "rd.fstab=")) {
- 
-                         if (in_initrd()) {
--                                r = parse_boolean(word + 6);
-+                                r = parse_boolean(word + 9);
-                                 if (r < 0)
--                                        log_warning("Failed to parse fstab switch %s. Ignoring.", word + 6);
-+                                        log_warning("Failed to parse fstab switch %s. Ignoring.", word + 9);
-                                 else
-                                         arg_enabled = r;
+diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
+index 9a9ed9d..9e46e18 100644
+--- a/src/nspawn/nspawn.c
++++ b/src/nspawn/nspawn.c
+@@ -2667,6 +2667,7 @@ int main(int argc, char *argv[]) {
+                                 goto finish;
                          }
-diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
-index 38499a6..bb80905 100644
---- a/src/journal/journal-file.c
-+++ b/src/journal/journal-file.c
-@@ -907,6 +907,8 @@ static int journal_file_append_field(
- 
-         osize = offsetof(Object, field.payload) + size;
-         r = journal_file_append_object(f, OBJECT_FIELD, osize, &o, &p);
-+        if (r < 0)
-+                return r;
- 
-         o->field.hash = htole64(hash);
-         memcpy(o->field.payload, field, size);
-diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
-index 88163c0..e09ba4c 100644
---- a/src/journal/journald-server.c
-+++ b/src/journal/journald-server.c
-@@ -333,8 +333,10 @@ void server_rotate(Server *s) {
-                 if (r < 0)
-                         if (f)
-                                 log_error("Failed to rotate %s: %s", f->path, strerror(-r));
--                        else
-+                        else {
-                                 log_error("Failed to create user journal: %s", strerror(-r));
-+                                hashmap_remove(s->user_journals, k);
-+                        }
-                 else {
-                         hashmap_replace(s->user_journals, k, f);
-                         server_fix_perms(s, f, PTR_TO_UINT32(k));
-@@ -975,7 +977,8 @@ int process_event(Server *s, struct epoll_event *ev) {
-                 ssize_t n;
- 
-                 if (ev->events != EPOLLIN) {
--                        log_error("Got invalid event from epoll.");
-+                        log_error("Got invalid event from epoll for %s: %"PRIx32,
-+                                  "signal fd", ev->events);
-                         return -EIO;
-                 }
- 
-@@ -1024,8 +1027,12 @@ int process_event(Server *s, struct epoll_event *ev) {
-         } else if (ev->data.fd == s->dev_kmsg_fd) {
-                 int r;
- 
--                if (ev->events != EPOLLIN) {
--                        log_error("Got invalid event from epoll.");
-+                if (ev->events & EPOLLERR)
-+                        log_warning("/dev/kmsg buffer overrun, some messages lost.");
-+
-+                if (!(ev->events & EPOLLIN)) {
-+                        log_error("Got invalid event from epoll for %s: %"PRIx32,
-+                                  "/dev/kmsg", ev->events);
-                         return -EIO;
-                 }
- 
-@@ -1039,7 +1046,9 @@ int process_event(Server *s, struct epoll_event *ev) {
-                    ev->data.fd == s->syslog_fd) {
- 
-                 if (ev->events != EPOLLIN) {
--                        log_error("Got invalid event from epoll.");
-+                        log_error("Got invalid event from epoll for %s: %"PRIx32,
-+                                  ev->data.fd == s->native_fd ? "native fd" : "syslog fd",
-+                                  ev->events);
-                         return -EIO;
-                 }
- 
-@@ -1140,12 +1149,7 @@ int process_event(Server *s, struct epoll_event *ev) {
-                                 char *e;
- 
-                                 if (n > 0 && n_fds == 0) {
--                                        e = memchr(s->buffer, '\n', n);
--                                        if (e)
--                                                *e = 0;
--                                        else
--                                                s->buffer[n] = 0;
--
-+                                        s->buffer[n] = 0;
-                                         server_process_syslog_message(s, strstrip(s->buffer), ucred, tv, label, label_len);
-                                 } else if (n_fds > 0)
-                                         log_warning("Got file descriptors via syslog socket. Ignoring.");
-@@ -1167,7 +1171,8 @@ int process_event(Server *s, struct epoll_event *ev) {
-         } else if (ev->data.fd == s->stdout_fd) {
- 
-                 if (ev->events != EPOLLIN) {
--                        log_error("Got invalid event from epoll.");
-+                        log_error("Got invalid event from epoll for %s: %"PRIx32,
-+                                  "stdout fd", ev->events);
-                         return -EIO;
-                 }
- 
-@@ -1178,6 +1183,8 @@ int process_event(Server *s, struct epoll_event *ev) {
-                 StdoutStream *stream;
- 
-                 if ((ev->events|EPOLLIN|EPOLLHUP) != (EPOLLIN|EPOLLHUP)) {
-+                        log_error("Got invalid event from epoll for %s: %"PRIx32,
-+                                  "stdout stream", ev->events);
-                         log_error("Got invalid event from epoll.");
-                         return -EIO;
-                 }
-diff --git a/src/journal/mmap-cache.c b/src/journal/mmap-cache.c
-index 54bf114..bd197d0 100644
---- a/src/journal/mmap-cache.c
-+++ b/src/journal/mmap-cache.c
-@@ -308,9 +308,13 @@ static void mmap_cache_free(MMapCache *m) {
-         while ((c = hashmap_first(m->contexts)))
-                 context_free(c);
- 
-+        hashmap_free(m->contexts);
-+
-         while ((f = hashmap_first(m->fds)))
-                 fd_free(f);
- 
-+        hashmap_free(m->fds);
-+
-         while (m->unused)
-                 window_free(m->unused);
- 
-diff --git a/src/libsystemd-bus/bus-internal.c b/src/libsystemd-bus/bus-internal.c
-index 0e66f3d..cac948e 100644
---- a/src/libsystemd-bus/bus-internal.c
-+++ b/src/libsystemd-bus/bus-internal.c
-@@ -63,7 +63,7 @@ bool object_path_is_valid(const char *p) {
- 
- bool interface_name_is_valid(const char *p) {
-         const char *q;
--        bool dot, found_dot;
-+        bool dot, found_dot = false;
- 
-         if (isempty(p))
-                 return false;
-@@ -103,7 +103,7 @@ bool interface_name_is_valid(const char *p) {
+                 } else {
++#if 0
+                         const char *p;
  
- bool service_name_is_valid(const char *p) {
-         const char *q;
--        bool dot, found_dot, unique;
-+        bool dot, found_dot = false, unique;
+                         p = strappenda(arg_directory,
+@@ -2676,6 +2677,7 @@ int main(int argc, char *argv[]) {
+                                 goto finish;
  
-         if (isempty(p))
-                 return false;
-diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
-index 7d6d848..b0eb2f1 100644
---- a/src/libsystemd-bus/sd-bus.c
-+++ b/src/libsystemd-bus/sd-bus.c
-@@ -1088,11 +1088,11 @@ static int dispatch_rqueue(sd_bus *bus, sd_bus_message **m) {
-                 if (r == 0)
-                         return ret;
- 
--                r = 1;
-+                ret = 1;
-         } while (!z);
- 
-         *m = z;
--        return 1;
-+        return ret;
- }
- 
- int sd_bus_send(sd_bus *bus, sd_bus_message *m, uint64_t *serial) {
-diff --git a/src/libudev/libudev-enumerate.c b/src/libudev/libudev-enumerate.c
-index 5ccaabd..100c1fb 100644
---- a/src/libudev/libudev-enumerate.c
-+++ b/src/libudev/libudev-enumerate.c
-@@ -299,7 +299,7 @@ _public_ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enume
-                         /* skip to be delayed devices, and move the to
-                          * the point where the prefix changes. We can
-                          * only move one item at a time. */
--                        if (!move_later) {
-+                        if (move_later == -1) {
-                                 move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath);
- 
-                                 if (move_later_prefix > 0) {
-@@ -718,6 +718,8 @@ static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *s
- {
-         struct udev_list_entry *list_entry;
- 
-+        subsystem = subsystem ? : "";
-+
-         udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) {
-                 if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0)
-                         return false;
-@@ -826,23 +828,27 @@ nomatch:
- static int parent_add_child(struct udev_enumerate *enumerate, const char *path)
- {
-         struct udev_device *dev;
-+        int r = 0;
- 
-         dev = udev_device_new_from_syspath(enumerate->udev, path);
-         if (dev == NULL)
-                 return -ENODEV;
- 
-         if (!match_subsystem(enumerate, udev_device_get_subsystem(dev)))
--                return 0;
-+                goto nomatch;
-         if (!match_sysname(enumerate, udev_device_get_sysname(dev)))
--                return 0;
-+                goto nomatch;
-         if (!match_property(enumerate, dev))
--                return 0;
-+                goto nomatch;
-         if (!match_sysattr(enumerate, dev))
--                return 0;
-+                goto nomatch;
- 
-         syspath_add(enumerate, udev_device_get_syspath(dev));
-+        r = 1;
-+
-+nomatch:
-         udev_device_unref(dev);
--        return 1;
-+        return r;
- }
- 
- static int parent_crawl_children(struct udev_enumerate *enumerate, const char *path, int maxdepth)
-diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym
-index 8e09430..1e6f885 100644
---- a/src/libudev/libudev.sym
-+++ b/src/libudev/libudev.sym
-@@ -109,5 +109,6 @@ global:
- } LIBUDEV_189;
- 
- LIBUDEV_199 {
-+global:
-         udev_device_set_sysattr_value;
- } LIBUDEV_196;
-diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
-index 7b19ee0..49ee420 100644
---- a/src/modules-load/modules-load.c
-+++ b/src/modules-load/modules-load.c
-@@ -302,8 +302,8 @@ int main(int argc, char *argv[]) {
- 
-                 STRV_FOREACH(i, arg_proc_cmdline_modules) {
-                         k = load_module(ctx, *i);
--                        if (k < 0)
--                                r = EXIT_FAILURE;
-+                        if (k < 0 && r == 0)
-+                                r = k;
+                         }
++#endif
                  }
- 
-                 r = conf_files_list_nulstr(&files, ".conf", NULL, conf_file_dirs);
+         } else {
+                 char template[] = "/tmp/nspawn-root-XXXXXX";
 diff --git a/src/nss-myhostname/netlink.c b/src/nss-myhostname/netlink.c
-index b1ef912..4f2ab5c 100644
+index d61ecdf..228a3a4 100644
 --- a/src/nss-myhostname/netlink.c
 +++ b/src/nss-myhostname/netlink.c
-@@ -113,6 +113,10 @@ static int read_reply(int fd, struct address **list, unsigned *n_list) {
+@@ -112,6 +112,10 @@ static int read_reply(int fd, struct address **list, unsigned *n_list) {
                      ifaddrmsg->ifa_scope == RT_SCOPE_NOWHERE)
                          continue;
  
@@ -507,174 +113,45 @@ index b1ef912..4f2ab5c 100644
                  if (ifaddrmsg->ifa_flags & IFA_F_DEPRECATED)
                          continue;
  
-diff --git a/src/shared/efivars.c b/src/shared/efivars.c
-index 8d004ba..99340c9 100644
---- a/src/shared/efivars.c
-+++ b/src/shared/efivars.c
-@@ -383,7 +383,8 @@ int efi_get_boot_options(uint16_t **options) {
-                 list[count ++] = id;
-         }
- 
--        qsort(list, count, sizeof(uint16_t), cmp_uint16);
-+        if (list)
-+                qsort(list, count, sizeof(uint16_t), cmp_uint16);
- 
-         *options = list;
-         return count;
-diff --git a/src/shared/env-util.c b/src/shared/env-util.c
-index 6a52fb9..598222c 100644
---- a/src/shared/env-util.c
-+++ b/src/shared/env-util.c
-@@ -406,7 +406,9 @@ char **strv_env_clean_log(char **e, const char *message) {
-                 e[k++] = *p;
-         }
- 
--        e[k] = NULL;
-+        if (e)
-+                e[k] = NULL;
-+
-         return e;
- }
- 
-diff --git a/src/shared/log.c b/src/shared/log.c
-index 27317f7..8f4995a 100644
---- a/src/shared/log.c
-+++ b/src/shared/log.c
-@@ -115,16 +115,20 @@ void log_close_syslog(void) {
- 
- static int create_log_socket(int type) {
-         int fd;
-+        struct timeval tv;
- 
--        /* All output to the syslog/journal fds we do asynchronously,
--         * and if the buffers are full we just drop the messages */
--
--        fd = socket(AF_UNIX, type|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
-+        fd = socket(AF_UNIX, type|SOCK_CLOEXEC, 0);
-         if (fd < 0)
-                 return -errno;
- 
-         fd_inc_sndbuf(fd, SNDBUF_SIZE);
- 
-+        /* We need a blocking fd here since we'd otherwise lose
-+        messages way too early. However, let's not hang forever in the
-+        unlikely case of a deadlock. */
-+        timeval_store(&tv, 1*USEC_PER_MINUTE);
-+        setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
-+
-         return fd;
- }
- 
-diff --git a/src/shared/polkit.c b/src/shared/polkit.c
-index cea7074..1c5e9e3 100644
---- a/src/shared/polkit.c
-+++ b/src/shared/polkit.c
-@@ -38,12 +38,8 @@ int verify_polkit(
- 
- #ifdef ENABLE_POLKIT
-         DBusMessage *m = NULL, *reply = NULL;
--        const char *unix_process = "unix-process", *pid = "pid", *starttime = "start-time", *cancel_id = "";
-+        const char *system_bus_name = "system-bus-name", *name = "name", *cancel_id = "";
-         uint32_t flags = interactive ? 1 : 0;
--        pid_t pid_raw;
--        uint32_t pid_u32;
--        unsigned long long starttime_raw;
--        uint64_t starttime_u64;
-         DBusMessageIter iter_msg, iter_struct, iter_array, iter_dict, iter_variant;
-         int r;
-         dbus_bool_t authorized = FALSE, challenge = FALSE;
-@@ -68,14 +64,6 @@ int verify_polkit(
- 
- #ifdef ENABLE_POLKIT
- 
--        pid_raw = bus_get_unix_process_id(c, sender, error);
--        if (pid_raw == 0)
--                return -EINVAL;
--
--        r = get_starttime_of_pid(pid_raw, &starttime_raw);
--        if (r < 0)
--                return r;
--
-         m = dbus_message_new_method_call(
-                         "org.freedesktop.PolicyKit1",
-                         "/org/freedesktop/PolicyKit1/Authority",
-@@ -86,22 +74,13 @@ int verify_polkit(
- 
-         dbus_message_iter_init_append(m, &iter_msg);
- 
--        pid_u32 = (uint32_t) pid_raw;
--        starttime_u64 = (uint64_t) starttime_raw;
--
-         if (!dbus_message_iter_open_container(&iter_msg, DBUS_TYPE_STRUCT, NULL, &iter_struct) ||
--            !dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &unix_process) ||
-+            !dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &system_bus_name) ||
-             !dbus_message_iter_open_container(&iter_struct, DBUS_TYPE_ARRAY, "{sv}", &iter_array) ||
-             !dbus_message_iter_open_container(&iter_array, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict) ||
--            !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &pid) ||
--            !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "u", &iter_variant) ||
--            !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_UINT32, &pid_u32) ||
--            !dbus_message_iter_close_container(&iter_dict, &iter_variant) ||
--            !dbus_message_iter_close_container(&iter_array, &iter_dict) ||
--            !dbus_message_iter_open_container(&iter_array, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict) ||
--            !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &starttime) ||
--            !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "t", &iter_variant) ||
--            !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_UINT64, &starttime_u64) ||
-+            !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &name) ||
-+            !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "s", &iter_variant) ||
-+            !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_STRING, &sender) ||
-             !dbus_message_iter_close_container(&iter_dict, &iter_variant) ||
-             !dbus_message_iter_close_container(&iter_array, &iter_dict) ||
-             !dbus_message_iter_close_container(&iter_struct, &iter_array) ||
 diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
-index 3cca861..f6052dd 100644
+index 0887bc3..6b502ce 100644
 --- a/src/systemctl/systemctl.c
 +++ b/src/systemctl/systemctl.c
-@@ -1482,7 +1482,7 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
- 
-         } else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "JobRemoved")) {
-                 uint32_t id;
--                const char *path, *result, *unit;
-+                const char *path, *result, *unit, *r;
+@@ -2561,7 +2561,7 @@ static int start_unit_one(
  
-                 if (dbus_message_get_args(message, &error,
-                                           DBUS_TYPE_UINT32, &id,
-@@ -1491,7 +1491,11 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
-                                           DBUS_TYPE_STRING, &result,
-                                           DBUS_TYPE_INVALID)) {
- 
--                        free(set_remove(d->set, (char*) path));
-+                        r = set_remove(d->set, (char*) path);
-+                        if (!r)
-+                                return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-+
-+                        free(r);
+                 log_debug("Adding %s to the set", p);
+                 r = set_consume(s, p);
+-                if (r < 0)
++                if (r < 0 && r != -EEXIST)
+                         return log_oom();
+         }
  
-                         if (!isempty(result))
-                                 d->result = strdup(result);
-@@ -1511,7 +1515,11 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
-                         /* Compatibility with older systemd versions <
-                          * 183 during upgrades. This should be dropped
-                          * one day. */
--                        free(set_remove(d->set, (char*) path));
-+                        r = set_remove(d->set, (char*) path);
-+                        if (!r)
-+                                return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-+
-+                        free(r);
+diff --git a/units/console-getty.service.m4.in b/units/console-getty.service.m4.in
+index 8ac51a4..cae9fb5 100644
+--- a/units/console-getty.service.m4.in
++++ b/units/console-getty.service.m4.in
+@@ -15,7 +15,6 @@ After=rc-local.service
+ Before=getty.target
  
-                         if (*result)
-                                 d->result = strdup(result);
-@@ -1867,7 +1875,7 @@ static int start_unit_one(
-                         return log_oom();
+ [Service]
+-ExecStart=-/sbin/agetty --noclear --keep-baud console 115200,38400,9600 $TERM
+ Type=idle
+ Restart=always
+ RestartSec=0
+diff --git a/units/container-getty@.service.m4.in b/units/container-getty@.service.m4.in
+index 4f7794b..bad2a9a 100644
+--- a/units/container-getty@.service.m4.in
++++ b/units/container-getty@.service.m4.in
+@@ -16,7 +16,6 @@ Before=getty.target
+ IgnoreOnIsolate=yes
  
-                 r = set_consume(s, p);
--                if (r < 0) {
-+                if (r < 0 && r != -EEXIST) {
-                         log_error("Failed to add path to set.");
-                         return r;
-                 }
+ [Service]
+-ExecStart=-/sbin/agetty --noclear --keep-baud pts/%I 115200,38400,9600 $TERM
+ Type=idle
+ Restart=always
+ RestartSec=0
 diff --git a/units/emergency.service.in b/units/emergency.service.in
-index 442f0e0..6b7eafd 100644
+index 94c090f..0d20640 100644
 --- a/units/emergency.service.in
 +++ b/units/emergency.service.in
 @@ -15,7 +15,6 @@ Before=shutdown.target
@@ -685,30 +162,61 @@ index 442f0e0..6b7eafd 100644
  ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" to try again\\nto boot into default mode.'
  ExecStart=-/sbin/sulogin
  ExecStopPost=@SYSTEMCTL@ --fail --no-block default
+diff --git a/units/getty@.service.m4 b/units/getty@.service.m4
+index aa853b8..8bcc647 100644
+--- a/units/getty@.service.m4
++++ b/units/getty@.service.m4
+@@ -23,11 +23,12 @@ IgnoreOnIsolate=yes
+ # On systems without virtual consoles, don't start any getty. Note
+ # that serial gettys are covered by serial-getty@.service, not this
+ # unit.
+-ConditionPathExists=/dev/tty0
++ConditionPathExists=|/dev/tty0
++ConditionVirtualization=|lxc
++ConditionVirtualization=|lxc-libvirt
+ 
+ [Service]
+ # the VT is cleared by TTYVTDisallocate
+-ExecStart=-/sbin/agetty --noclear %I $TERM
+ Type=idle
+ Restart=always
+ RestartSec=0
+diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in
+index 368f980..d0c1bd2 100644
+--- a/units/kmod-static-nodes.service.in
++++ b/units/kmod-static-nodes.service.in
+@@ -10,7 +10,6 @@ Description=Create list of required static device nodes for the current kernel
+ DefaultDependencies=no
+ Before=sysinit.target systemd-tmpfiles-setup-dev.service
+ ConditionCapability=CAP_MKNOD
+-ConditionPathExists=/lib/modules/%v/modules.devname
+ 
+ [Service]
+ Type=oneshot
 diff --git a/units/local-fs.target b/units/local-fs.target
-index 18c3d74..a09054c 100644
+index ae3cedc..0e36840 100644
 --- a/units/local-fs.target
 +++ b/units/local-fs.target
-@@ -11,3 +11,5 @@ Documentation=man:systemd.special(7)
- After=local-fs-pre.target
+@@ -13,3 +13,5 @@ DefaultDependencies=no
+ Conflicts=shutdown.target
  OnFailure=emergency.target
- OnFailureIsolate=no
+ OnFailureJobMode=replace-irreversibly
 +
 +X-StopOnReconfiguration=yes
 diff --git a/units/remote-fs.target b/units/remote-fs.target
-index 09213e8..47b4cf5 100644
+index 43ffa5c..156a681 100644
 --- a/units/remote-fs.target
 +++ b/units/remote-fs.target
-@@ -10,5 +10,7 @@ Description=Remote File Systems
- Documentation=man:systemd.special(7)
- After=remote-fs-pre.target
+@@ -12,5 +12,7 @@ After=remote-fs-pre.target
+ DefaultDependencies=no
+ Conflicts=shutdown.target
  
 +X-StopOnReconfiguration=yes
 +
  [Install]
  WantedBy=multi-user.target
 diff --git a/units/rescue.service.m4.in b/units/rescue.service.m4.in
-index 269797a..2c640f4 100644
+index 552ef89..af3915f 100644
 --- a/units/rescue.service.m4.in
 +++ b/units/rescue.service.m4.in
 @@ -16,7 +16,6 @@ Before=shutdown.target
@@ -719,6 +227,18 @@ index 269797a..2c640f4 100644
  ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! Type "systemctl default" or ^D to enter default mode.\\nType "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.'
  ExecStart=-/sbin/sulogin
  ExecStopPost=-@SYSTEMCTL@ --fail --no-block default
+diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4
+index 4ac51e7..86a3b59 100644
+--- a/units/serial-getty@.service.m4
++++ b/units/serial-getty@.service.m4
+@@ -22,7 +22,6 @@ Before=getty.target
+ IgnoreOnIsolate=yes
+ 
+ [Service]
+-ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM
+ Type=idle
+ Restart=always
+ RestartSec=0
 diff --git a/units/sysinit.target b/units/sysinit.target
 index 8f4fb8f..e0f0147 100644
 --- a/units/sysinit.target
@@ -731,11 +251,20 @@ index 8f4fb8f..e0f0147 100644
 -After=local-fs.target swap.target emergency.service emergency.target
 +After=emergency.service emergency.target
  RefuseManualStart=yes
+diff --git a/units/systemd-backlight@.service.in b/units/systemd-backlight@.service.in
+index e945d87..77728f2 100644
+--- a/units/systemd-backlight@.service.in
++++ b/units/systemd-backlight@.service.in
+@@ -19,3 +19,4 @@ Type=oneshot
+ RemainAfterExit=yes
+ ExecStart=@rootlibexecdir@/systemd-backlight load %i
+ ExecStop=@rootlibexecdir@/systemd-backlight save %i
++X-RestartIfChanged=false
 diff --git a/units/systemd-journald.service.in b/units/systemd-journald.service.in
-index ab2e50c..9563a7d 100644
+index de93879..c9a49f3 100644
 --- a/units/systemd-journald.service.in
 +++ b/units/systemd-journald.service.in
-@@ -24,3 +24,8 @@ CapabilityBoundingSet=CAP_SYS_ADMIN CAP_DAC_OVERRIDE CAP_SYS_PTRACE CAP_SYSLOG C
+@@ -25,3 +25,8 @@ WatchdogSec=1min
  # Increase the default a bit in order to allow many simultaneous
  # services being run since we keep one fd open per service.
  LimitNOFILE=16384
@@ -744,6 +273,33 @@ index ab2e50c..9563a7d 100644
 +# journald to stop logging (see
 +# https://bugs.freedesktop.org/show_bug.cgi?id=56043).
 +X-RestartIfChanged=no
+diff --git a/units/systemd-random-seed.service.in b/units/systemd-random-seed.service.in
+index 1879b2f..9b895b9 100644
+--- a/units/systemd-random-seed.service.in
++++ b/units/systemd-random-seed.service.in
+@@ -19,3 +19,4 @@ Type=oneshot
+ RemainAfterExit=yes
+ ExecStart=@rootlibexecdir@/systemd-random-seed load
+ ExecStop=@rootlibexecdir@/systemd-random-seed save
++X-RestartIfChanged=false
+diff --git a/units/systemd-rfkill@.service.in b/units/systemd-rfkill@.service.in
+index 9d264a2..c505535 100644
+--- a/units/systemd-rfkill@.service.in
++++ b/units/systemd-rfkill@.service.in
+@@ -19,3 +19,4 @@ Type=oneshot
+ RemainAfterExit=yes
+ ExecStart=@rootlibexecdir@/systemd-rfkill load %I
+ ExecStop=@rootlibexecdir@/systemd-rfkill save %I
++X-RestartIfChanged=false
+diff --git a/units/systemd-update-utmp.service.in b/units/systemd-update-utmp.service.in
+index da7dda7..4cc550d 100644
+--- a/units/systemd-update-utmp.service.in
++++ b/units/systemd-update-utmp.service.in
+@@ -19,3 +19,4 @@ Type=oneshot
+ RemainAfterExit=yes
+ ExecStart=@rootlibexecdir@/systemd-update-utmp reboot
+ ExecStop=@rootlibexecdir@/systemd-update-utmp shutdown
++X-RestartIfChanged=false
 diff --git a/units/systemd-user-sessions.service.in b/units/systemd-user-sessions.service.in
 index 0869e73..b6ed958 100644
 --- a/units/systemd-user-sessions.service.in
diff --git a/pkgs/os-specific/linux/systemd/libc-bug-accept4-arm.patch b/pkgs/os-specific/linux/systemd/libc-bug-accept4-arm.patch
deleted file mode 100644
index 7cde2260189a..000000000000
--- a/pkgs/os-specific/linux/systemd/libc-bug-accept4-arm.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-Based on a patch for udev in
-nixpkgs(upstart)/pkgs/os-specific/linux/udev/pre-accept4-kernel.patch
-
-It was taken from:
-https://github.com/archlinuxarm/PKGBUILDs/blob/master/core/udev-oxnas/pre-accept4-kernel.patch
-
-Basically, ARM implemented accept4() only in 2.6.36. Nixpkgs now uses
-linux headers from 2.6.35. And the particular nixpkgs glibc version had a bug,
-not checking about 2.6.36 for accept4 on arm.
-
-diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
-index 7b88f74..a9f7b62 100644
---- a/src/journal/journald-stream.c
-+++ b/src/journal/journald-stream.c
-@@ -347,10 +347,12 @@ int stdout_stream_new(Server *s) {
-         int fd, r;
-         socklen_t len;
-         struct epoll_event ev;
-+        int flgs;
- 
-         assert(s);
- 
--        fd = accept4(s->stdout_fd, NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC);
-+        //fd = accept4(s->stdout_fd, NULL, NULL, SOCK_NONBLOCK|SOCK_CLOEXEC);
-+        fd = accept(s->stdout_fd, NULL, NULL);
-         if (fd < 0) {
-                 if (errno == EAGAIN)
-                         return 0;
-@@ -359,6 +361,11 @@ int stdout_stream_new(Server *s) {
-                 return -errno;
-         }
- 
-+        // Since we don't have accept4
-+        flgs = fcntl(fd, F_GETFL, NULL);
-+        if(flgs >= 0) fcntl(fd, F_SETFL, flgs | O_NONBLOCK);
-+        fcntl(fd, F_SETFD, FD_CLOEXEC);
-+
-         if (s->n_stdout_streams >= STDOUT_STREAMS_MAX) {
-                 log_warning("Too many stdout streams, refusing connection.");
-                 close_nointr_nofail(fd);
-diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c
-index a235912..c05e4b4 100644
---- a/src/udev/udev-ctrl.c
-+++ b/src/udev/udev-ctrl.c
-@@ -15,6 +15,7 @@
- #include <stddef.h>
- #include <string.h>
- #include <unistd.h>
-+#include <fcntl.h>
- #include <sys/types.h>
- #include <sys/poll.h>
- #include <sys/socket.h>
-@@ -181,6 +182,7 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
-         struct ucred ucred;
-         socklen_t slen;
-         const int on = 1;
-+        int flgs;
- 
-         conn = calloc(1, sizeof(struct udev_ctrl_connection));
-         if (conn == NULL)
-@@ -188,13 +190,19 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl)
-         conn->refcount = 1;
-         conn->uctrl = uctrl;
- 
--        conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK);
-+        //conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK);
-+        conn->sock = accept(uctrl->sock, NULL, NULL);
-         if (conn->sock < 0) {
-                 if (errno != EINTR)
-                         log_error("unable to receive ctrl connection: %m\n");
-                 goto err;
-         }
- 
-+        // Since we don't have accept4
-+        flgs = fcntl(conn->sock, F_GETFL, NULL);
-+        if(flgs >= 0) fcntl(conn->sock, F_SETFL, flgs | O_NONBLOCK);
-+        fcntl(conn->sock, F_SETFD, FD_CLOEXEC);
-+
-         /* check peer credential of connection */
-         slen = sizeof(ucred);
-         if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) {
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index ec43ee1e64f4..cdc384f3ee8c 100644
--- a/pkgs/os-specific/linux/util-linux/default.nix
+++ b/pkgs/os-specific/linux/util-linux/default.nix
@@ -1,13 +1,11 @@
 { stdenv, fetchurl, zlib, ncurses ? null, perl ? null, pam }:
-let
-  ver = "2.24";
-in
+
 stdenv.mkDerivation rec {
-  name = "util-linux-${ver}";
+  name = "util-linux-2.24.1";
 
   src = fetchurl {
-    url = "http://www.kernel.org/pub/linux/utils/util-linux/v${ver}/${name}.tar.bz2";
-    sha256 = "1nfnymj03rdcxjb677a9qq1zirppr8csh32cb85qm23x5xndi6v3";
+    url = "http://www.kernel.org/pub/linux/utils/util-linux/v2.24/${name}.tar.xz";
+    sha256 = "0444xhfm9525v3aagyfbp38mp7xsw2fn9zg4ya713c7s5hivcpl3";
   };
 
   crossAttrs = {
@@ -19,8 +17,6 @@ stdenv.mkDerivation rec {
   # (/sbin/mount.*) through an environment variable, but that's
   # somewhat risky because we have to consider that mount can setuid
   # root...
-  # --enable-libmount-mount  fixes the behaviour being /etc/mtab a symlink to /proc/monunts
-  #     http://pl.digipedia.org/usenet/thread/19513/1924/
   configureFlags = ''
     --enable-write
     --enable-last