diff --git a/core/includes/update.inc b/core/includes/update.inc
index be9788f..133ecfc 100644
--- a/core/includes/update.inc
+++ b/core/includes/update.inc
@@ -255,7 +255,7 @@ function update_fix_d8_requirements() {
 /**
  * Helper function to install a new module in Drupal 8 via hook_update_N().
  */
-function update_module_enable(array $modules) {
+function update_module_enable_0(array $modules) {
   foreach ($modules as $module) {
     // Check for initial schema and install it. The schema version of a newly
     // installed module is always 0. Using 8000 here would be inconsistent
diff --git a/core/modules/block/block.install b/core/modules/block/block.install
index c2d4185..8c9a17b 100644
--- a/core/modules/block/block.install
+++ b/core/modules/block/block.install
@@ -195,7 +195,7 @@ function block_install() {
  * Block cache is always enabled in 8.x.
  */
 function block_update_8000() {
-  variable_del('block_cache');
+  update_variable_del_0('block_cache');
 }
 
 /**
diff --git a/core/modules/system/system.install b/core/modules/system/system.install
index 7b80bc5..ada1859 100644
--- a/core/modules/system/system.install
+++ b/core/modules/system/system.install
@@ -1653,6 +1653,60 @@ function system_update_last_removed() {
 }
 
 /**
+ * Sets a persistent variable during the 7.x-8.x upgrade path.
+ *
+ * Case-sensitivity of the variable_* functions depends on the database
+ * collation used. To avoid problems, always use lower case for persistent
+ * variable names.
+ *
+ * @param $name
+ *   The name of the variable to set.
+ * @param $value
+ *   The value to set. This can be any PHP data type; these functions take care
+ *   of serialization as necessary.
+ *
+ * @see variable_del()
+ * @see variable_get()
+ */
+function update_variable_set_0($name, $value) {
+  db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute();
+}
+
+/**
+ * Get the value of a variable directly from the database.
+ *
+ * Use this instead of variable_get() during the upgrade path.
+ *
+ * @param $name
+ *   The name of the variable.
+ *
+ * @return
+ *   The value of the variable in the database unserialized, or NULL if not set.
+ */
+function update_variable_get_0($name) {
+  $value = NULL;
+  $result = db_query('SELECT value FROM {variables} WHERE name = :name', array(':name' => $name))->fetchField();
+  if ($result) {
+    $value = unserialize($result);
+  }
+  return $value;
+}
+
+/**
+ * Delete a variable from the database.
+ *
+ * Use this during the 7.x-8.x upgrade path instead of variable_del().
+ * @param $name
+ *   The name of the variable to undefine.
+ */
+function update_variable_del_0($name) {
+
+  db_delete('variable')
+    ->condition('name', $name)
+    ->execute();
+}
+
+/**
  * @defgroup updates-7.x-to-8.x Updates from 7.x to 8.x
  * @{
  * Update functions from 7.x to 8.x.
@@ -1662,7 +1716,7 @@ function system_update_last_removed() {
  * Enable entity module.
  */
 function system_update_8000() {
-  update_module_enable(array('entity'));
+  update_module_enable_0(array('entity'));
 }
 
 /**
@@ -1671,8 +1725,8 @@ function system_update_8000() {
 function system_update_8001() {
   $themes = array('theme_default', 'maintenance_theme', 'admin_theme');
   foreach ($themes as $theme) {
-    if (variable_get($theme) == 'garland') {
-      variable_set($theme, 'bartik');
+    if (update_variable_get_0($theme) == 'garland') {
+      update_variable_set_0($theme, 'bartik');
     }
   }
 }
