diff --git a/fhem/contrib/DEBIAN/postinst b/fhem/contrib/DEBIAN/postinst
index c986c158d..2d61a79bd 100644
--- a/fhem/contrib/DEBIAN/postinst
+++ b/fhem/contrib/DEBIAN/postinst
@@ -1,6 +1,7 @@
 #!/bin/bash
 
 set -e
+#set -x
 
 if ! getent passwd fhem >/dev/null; then
     useradd --system --home /opt/fhem --gid dialout --shell /bin/false fhem
@@ -17,6 +18,6 @@ chmod ugo+x /etc/init.d/fhem
 update-rc.d fhem defaults
 
 if test -f /etc/init.d/fhem; then
-    invoke-rc.d fhem start
+    /etc/init.d/fhem start noaptmark
 fi
-
+exit 0
diff --git a/fhem/contrib/DEBIAN/postrm b/fhem/contrib/DEBIAN/postrm
index fa59aa358..957d4a3bf 100755
--- a/fhem/contrib/DEBIAN/postrm
+++ b/fhem/contrib/DEBIAN/postrm
@@ -1,5 +1,6 @@
 #!/bin/bash
 
+#set -x
 set -e # required by lintian
 set +e # Don't know how to check presence of fhem in passwd with -e
 
diff --git a/fhem/contrib/DEBIAN/prerm b/fhem/contrib/DEBIAN/prerm
index 2d1ee8b77..d5ca1da36 100755
--- a/fhem/contrib/DEBIAN/prerm
+++ b/fhem/contrib/DEBIAN/prerm
@@ -1,13 +1,14 @@
 #!/bin/sh
 
+#set -x
 set -e
 
 apt-mark unhold fhem
 
 # stop fhem if running
 if test -f /etc/init.d/fhem; then
-    invoke-rc.d fhem stop
+    /etc/init.d/fhem stop noaptmark
 fi
 
 # remove fhem autostart
-update-rc.d fhem remove
+update-rc.d -f fhem remove
diff --git a/fhem/contrib/init-scripts/fhem.3 b/fhem/contrib/init-scripts/fhem.3
index 7bb42322c..b3fac198b 100644
--- a/fhem/contrib/init-scripts/fhem.3
+++ b/fhem/contrib/init-scripts/fhem.3
@@ -15,7 +15,9 @@ set -e
 cd /opt/fhem
 port=7072
 
-apt-mark hold fhem > /dev/null
+if test "$2" != "noaptmark"; then
+  apt-mark hold fhem > /dev/null
+fi
 
 case "$1" in
 'start')