tags 763197 + patch
thanks

With the help of the old udev checks I came up with this which
properly detects my systemd and kernel incompatibilities.

It is not detecting the UEFI things though.

How about applying it?

-Mikko
diff -rup systemd-215-orig/debian/systemd.preinst systemd-215/debian/systemd.preinst
--- systemd-215-orig/debian/systemd.preinst	2014-09-27 17:50:52.000000000 +0200
+++ systemd-215/debian/systemd.preinst	2014-10-10 07:55:40.081232794 +0200
@@ -2,6 +2,88 @@
 
 set -e
 
+chrooted() {
+  if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ];
+  then
+    return 1
+  fi
+  return 0
+}
+
+check_kernel_features() {
+  local abort_install=0
+
+  local needed_fs='devtmpfs sysfs proc autofs cgroup'
+  # efivarfs is needed only on UEFI systems
+  local missing_fs=0
+  if [ -e /proc/filesystems ]; then
+    for fs in $needed_fs; do
+      if ! grep -q "$fs" /proc/filesystems; then
+        missing_fs=1
+        abort_install=1
+        break
+      fi
+    done
+  fi  
+
+  local needed_symbols='inotify_init signalfd accept4 open_by_handle_at timerfd_create epoll_create'
+  local missing_symbol=0
+  if [ -e /proc/kallsyms ]; then
+    for symbol in $needed_symbols; do
+      if ! egrep -q "^[a-fA-F0-9]+ T \.?sys_${symbol}$" /proc/kallsyms; then
+        missing_symbol=1
+        abort_install=1
+        break
+      fi
+    done
+  fi
+
+  if [ "$missing_symbol" -eq 1 ]; then
+    cat <<END
+systemd requires support for the following features in the running kernel
+
+          CONFIG_INOTIFY_USER
+          CONFIG_SIGNALFD
+          CONFIG_TIMERFD
+          CONFIG_EPOLL
+          CONFIG_NET
+          CONFIG_FHANDLE
+
+END
+  fi
+
+  if [ "$missing_fs" -eq 1 ]; then
+    cat <<END
+systemd requires support for the following filesystems in the running kernel:
+
+          CONFIG_DEVTMPFS
+          CONFIG_CGROUPS
+          CONFIG_SYSFS
+          CONFIG_PROC_FS
+          CONFIG_AUTOFS4_FS
+
+On UEFI systems also:
+
+          CONFIG_EFIVAR_FS
+          CONFIG_EFI_PARTITION
+
+END
+  fi
+
+  if [ ! "$abort_install" -eq 0 ]; then
+    exit 1
+  fi
+  return 0
+}
+
+if [ "$1" = "install" ] || [ "$1" = "upgrade" ]; then
+    if chrooted; then
+      echo 'Running in a chroot, skipping the kernel feature checks!'
+    else
+      check_kernel_features
+    fi
+fi
+
 if [ "$1" = "install" ] || [ "$1" = "upgrade" ] && [ -n "$2" ] && dpkg --compare-versions "$2" lt "44-3"; then
     rm -f /lib/lsb/init-functions
     dpkg-divert --remove --package systemd --rename \
  • Bug#763197: Me too Mikko Rapeli
    • Bug#763197: systemd kernel feature check in preinst phas... Mikko Rapeli

Reply via email to