diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index de6e7fa9608a..069901483bb2 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -108,6 +108,9 @@ SSTATE_SIG_PASSPHRASE ?= ""
 # Whether to verify the GnUPG signatures when extracting sstate archives
 SSTATE_VERIFY_SIG ?= "0"
 
+# Whether to remove broken sstate packages
+SSTATE_CLEAN_BROKEN_PACKAGES ?= "1"
+
 SSTATE_HASHEQUIV_METHOD ?= "oe.sstatesig.OEOuthashBasic"
 SSTATE_HASHEQUIV_METHOD[doc] = "The fully-qualified function used to calculate \
     the output hash for a task, which in turn is used to determine equivalency. \
@@ -375,9 +378,18 @@ def sstate_installpkg(ss, d):
     sstateinst = d.getVar("SSTATE_INSTDIR")
     d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
 
-    for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package']:
-        # All hooks should run in the SSTATE_INSTDIR
-        bb.build.exec_func(f, d, (sstateinst,))
+    try:
+        for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package']:
+            # All hooks should run in the SSTATE_INSTDIR
+            bb.build.exec_func(f, d, (sstateinst,))
+    except bb.process.ExecutionError:
+        bb.warn("Failed to install sstate package %s, skipping acceleration..." % sstatepkg)
+        oe.path.remove(sstateinst)
+        if bb.utils.to_boolean(d.getVar("SSTATE_CLEAN_BROKEN_PACKAGES"), True):
+            bb.warn("Removing broken sstate package %s" % sstatepkg)
+            oe.path.remove(sstatepkg)
+            oe.path.remove(sstatepkg + '.*')
+        return False
 
     return sstate_installpkgdir(ss, d)
 
@@ -763,7 +775,7 @@ def sstate_setscene(d):
     shared_state = sstate_state_fromvars(d)
     accelerate = sstate_installpkg(shared_state, d)
     if not accelerate:
-        bb.fatal("No suitable staging package found")
+        sys.exit(1)
 
 python sstate_task_prefunc () {
     shared_state = sstate_state_fromvars(d)
