migrate to /run and /run/lock

Since /var/run is a symlink to /run, and we want to avoid going
through the stateful /var whenever possible, use the direct path.
Same goes for /var/lock.

BUG=chromium:699880
TEST=precq passes

Change-Id: I9c79d3bc8f1b3d9b0bed3127bdca3e3f7255f4ae
Reviewed-on: https://chromium-review.googlesource.com/473968
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Brian Norris <briannorris@chromium.org>
diff --git a/apache/conf/django-directives b/apache/conf/django-directives
index 2f320d0..da3afe0 100644
--- a/apache/conf/django-directives
+++ b/apache/conf/django-directives
@@ -52,7 +52,7 @@
        Options +ExecCGI
     </LocationMatch>
 
-    WSGISocketPrefix /var/run/wsgi
+    WSGISocketPrefix /run/wsgi
     # Note: this maximum-requests argument is required because of a memory leak in the django admin pages.
     # The WSGIDaemonProcess directive prevents mpm_prefork from recycling the
     # memory that Django uses, as it is tied up in the daemon. We can prevent
diff --git a/client/common_lib/cros/arc.py b/client/common_lib/cros/arc.py
index 317f276..ede68ee 100644
--- a/client/common_lib/cros/arc.py
+++ b/client/common_lib/cros/arc.py
@@ -18,11 +18,11 @@
 
 _ADB_KEYS_PATH = '/tmp/adb_keys'
 _ADB_VENDOR_KEYS = 'ADB_VENDOR_KEYS'
-_ANDROID_CONTAINER_PID_PATH = '/var/run/containers/android_*/container.pid'
+_ANDROID_CONTAINER_PID_PATH = '/run/containers/android_*/container.pid'
 _SCREENSHOT_DIR_PATH = '/var/log/arc-screenshots'
 _SCREENSHOT_BASENAME = 'arc-screenshot'
 _MAX_SCREENSHOT_NUM = 10
-_SDCARD_PID_PATH = '/var/run/arc/sdcard.pid'
+_SDCARD_PID_PATH = '/run/arc/sdcard.pid'
 _ANDROID_ADB_KEYS_PATH = '/data/misc/adb/adb_keys'
 _PROCESS_CHECK_INTERVAL_SECONDS = 1
 _WAIT_FOR_ADB_READY = 60
diff --git a/client/common_lib/cros/arc_util.py b/client/common_lib/cros/arc_util.py
index 86fb1c1..c033831 100644
--- a/client/common_lib/cros/arc_util.py
+++ b/client/common_lib/cros/arc_util.py
@@ -21,7 +21,7 @@
 _ARC_SUPPORT_HOST_PAGENAME = '_generated_background_page.html'
 _DUMPSTATE_DEFAULT_TIMEOUT = 20
 _DUMPSTATE_PATH = '/var/log/arc-dumpstate.log'
-_DUMPSTATE_PIPE_PATH = '/var/run/arc/bugreport/pipe'
+_DUMPSTATE_PIPE_PATH = '/run/arc/bugreport/pipe'
 _USERNAME = 'arcplusplustest@gmail.com'
 _USERNAME_DISPLAY = 'arcplusplustest@gmail.com'
 _ARCP_URL = 'https://sites.google.com/a/chromium.org/dev/chromium-os' \
diff --git a/client/common_lib/cros/autoupdater.py b/client/common_lib/cros/autoupdater.py
index 9a445d1..76597db 100644
--- a/client/common_lib/cros/autoupdater.py
+++ b/client/common_lib/cros/autoupdater.py
@@ -325,7 +325,7 @@
     REMOTE_TMP_STATEFUL_UPDATE = os.path.join(
             '/tmp', STATEFUL_UPDATE_SCRIPT)
     UPDATER_BIN = '/usr/bin/update_engine_client'
-    UPDATED_MARKER = '/var/run/update_engine_autoupdate_completed'
+    UPDATED_MARKER = '/run/update_engine_autoupdate_completed'
     UPDATER_LOGS = ['/var/log/messages', '/var/log/update_engine']
 
     KERNEL_A = {'name': 'KERN-A', 'kernel': 2, 'root': 3}
diff --git a/client/cros/chrooted_avahi.py b/client/cros/chrooted_avahi.py
index eff5eba..5a76f80 100644
--- a/client/cros/chrooted_avahi.py
+++ b/client/cros/chrooted_avahi.py
@@ -63,7 +63,7 @@
             'avahi:x:238:\n',
     }
     AVAHI_LOG_FILE = '/var/log/avahi.log'
-    AVAHI_PID_FILE = 'var/run/avahi-daemon/pid'
+    AVAHI_PID_FILE = 'run/avahi-daemon/pid'
     AVAHI_UP_TIMEOUT_SECONDS = 10
 
 
diff --git a/client/cros/constants.py b/client/cros/constants.py
index c8ea44f..e363ff9 100644
--- a/client/cros/constants.py
+++ b/client/cros/constants.py
@@ -69,11 +69,11 @@
 # Directories to copy out of cryptohome, relative to CRYPTOHOME_MOUNT_PT.
 CRYPTOHOME_DIRS_TO_RECOVER = ['crash', 'log']
 
-DISABLE_BROWSER_RESTART_MAGIC_FILE = '/var/run/disable_chrome_restart'
+DISABLE_BROWSER_RESTART_MAGIC_FILE = '/run/disable_chrome_restart'
 DEFAULT_OWNERSHIP_TIMEOUT = 300  # Ownership is an inherently random process.
 
 ENABLE_BROWSER_HANG_DETECTION_FILE = \
-    '/var/run/session_manager/enable_hang_detection'
+    '/run/session_manager/enable_hang_detection'
 
 FLIMFLAM_TEST_PATH = '/usr/lib/flimflam/test/'
 
@@ -121,7 +121,7 @@
 SESSION_MANAGER = 'session_manager'
 SIGNED_POLICY_FILE = WHITELIST_DIR + '/policy'
 SPECIAL_CASE_DOMAIN = 'gmail.com'
-USER_POLICY_DIR = '/var/run/user_policy'
+USER_POLICY_DIR = '/run/user_policy'
 USER_POLICY_KEY_FILENAME = 'policy.pub'
 
 TOKEN_AUTH_URL = '/accounts/TokenAuth'
@@ -135,7 +135,7 @@
 RESOLV_CONF_FILE = '/etc/resolv.conf'
 
 PENDING_SHUTDOWN_PATH = '/var/lib/crash_reporter/pending_clean_shutdown'
-UNCLEAN_SHUTDOWN_DETECTED_PATH = '/var/run/unclean-shutdown-detected'
+UNCLEAN_SHUTDOWN_DETECTED_PATH = '/run/unclean-shutdown-detected'
 
 INTERACTIVE_XMLRPC_SERVER_PORT = 9980
 INTERACTIVE_XMLRPC_SERVER_COMMAND = (
diff --git a/client/cros/crash/crash_test.py b/client/cros/crash/crash_test.py
index cc24e57..13edaf2 100644
--- a/client/cros/crash/crash_test.py
+++ b/client/cros/crash/crash_test.py
@@ -78,8 +78,8 @@
     _CRASH_REPORTER_PATH = '/sbin/crash_reporter'
     _CRASH_SENDER_PATH = '/sbin/crash_sender'
     _CRASH_SENDER_RATE_DIR = '/var/lib/crash_sender'
-    _CRASH_SENDER_RUN_PATH = '/var/run/crash_sender.pid'
-    _CRASH_SENDER_LOCK_PATH = '/var/lock/crash_sender'
+    _CRASH_SENDER_RUN_PATH = '/run/crash_sender.pid'
+    _CRASH_SENDER_LOCK_PATH = '/run/lock/crash_sender'
     _CRASH_TEST_IN_PROGRESS = '/tmp/crash-test-in-progress'
     _MOCK_CRASH_SENDING = '/tmp/mock-crash-sending'
     _PAUSE_FILE = '/var/lib/crash_sender_paused'
diff --git a/client/cros/network_chroot.py b/client/cros/network_chroot.py
index 1d62008..332c84d 100644
--- a/client/cros/network_chroot.py
+++ b/client/cros/network_chroot.py
@@ -37,11 +37,15 @@
     # Includes directories containing the system bus socket and machine ID.
     DBUS_BRIDGE_DIRECTORIES = ('run/dbus/', 'var/lib/dbus/')
 
-    ROOT_DIRECTORIES = ('etc',  'tmp', 'var', 'var/log', 'var/run')
+    ROOT_DIRECTORIES = ('etc',  'tmp', 'var', 'var/log', 'run', 'run/lock')
+    ROOT_SYMLINKS = (
+        ('var/run', '/run'),
+        ('var/lock', '/run/lock'),
+    )
     STARTUP = 'etc/chroot_startup.sh'
     STARTUP_DELAY_SECONDS = 5
-    STARTUP_PID_FILE = 'var/run/vpn_startup.pid'
-    STARTUP_SLEEPER_PID_FILE = 'var/run/vpn_sleeper.pid'
+    STARTUP_PID_FILE = 'run/vpn_startup.pid'
+    STARTUP_SLEEPER_PID_FILE = 'run/vpn_sleeper.pid'
     COPIED_CONFIG_FILES = [
         'etc/ld.so.cache'
     ]
@@ -240,6 +244,10 @@
             if os.path.exists(src_path):
                 shutil.copyfile(src_path, dst_path)
 
+        for src_path, target_path in self.ROOT_SYMLINKS:
+            link_path = self.chroot_path(src_path)
+            os.symlink(target_path, link_path)
+
 
     def move_interface_to_chroot_namespace(self):
         """Move network interface to the network namespace of the server."""
diff --git a/client/cros/networking/shill_context.py b/client/cros/networking/shill_context.py
index 287145c..e3dbf4c 100644
--- a/client/cros/networking/shill_context.py
+++ b/client/cros/networking/shill_context.py
@@ -14,7 +14,7 @@
 from autotest_lib.client.common_lib import utils
 from autotest_lib.client.cros.networking import shill_proxy
 
-SHILL_START_LOCK_PATH = '/var/lock/shill-start.lock'
+SHILL_START_LOCK_PATH = '/run/lock/shill-start.lock'
 
 class ContextError(Exception):
     """An error raised by a context managers dealing with shill objects."""
diff --git a/client/cros/power_suspend.py b/client/cros/power_suspend.py
index d3e10b0..675f524 100644
--- a/client/cros/power_suspend.py
+++ b/client/cros/power_suspend.py
@@ -39,7 +39,7 @@
         __del__: Restore tlsdated (must run eventually, but GC delay no problem)
         _set_pm_print_times: Enable/disable kernel device suspend timing output.
         _check_failure_log: Check /sys/.../suspend_stats for new failures.
-        _ts: Returns a timestamp from /var/run/power_manager/last_resume_timings
+        _ts: Returns a timestamp from /run/power_manager/last_resume_timings
         _hwclock_ts: Read RTC timestamp left on resume in hwclock-on-resume
         _device_resume_time: Read seconds overall device resume took from logs.
         _individual_device_times: Reads individual device suspend/resume times.
@@ -77,7 +77,7 @@
 
     # File written by send_metrics_on_resume containing timing information about
     # the last resume.
-    _TIMINGS_FILE = '/var/run/power_manager/root/last_resume_timings'
+    _TIMINGS_FILE = '/run/power_manager/root/last_resume_timings'
 
     # Amount of lines to dump from the eventlog on a SpuriousWakeup. Should be
     # enough to include ACPI Wake Reason... 10 should be far on the safe side.
@@ -87,7 +87,7 @@
     _MAX_RESUME_TIME = 10
 
     # File written by powerd_suspend containing the hwclock time at resume.
-    HWCLOCK_FILE = '/var/run/power_manager/root/hwclock-on-resume'
+    HWCLOCK_FILE = '/run/power_manager/root/hwclock-on-resume'
 
     # File read by powerd to decide on the state to suspend (mem or freeze).
     _SUSPEND_STATE_PREF_FILE = 'suspend_to_idle'
diff --git a/client/cros/vpn_server.py b/client/cros/vpn_server.py
index fbde6d1..da3231f 100644
--- a/client/cros/vpn_server.py
+++ b/client/cros/vpn_server.py
@@ -35,13 +35,13 @@
     IPSEC_PRESHARED_KEY = 'preshared-key'
     IPSEC_CA_CERTIFICATE = 'etc/ipsec.d/cacerts/ca.cert'
     IPSEC_SERVER_CERTIFICATE = 'etc/ipsec.d/certs/server.cert'
-    PPPD_PID_FILE = 'var/run/ppp0.pid'
+    PPPD_PID_FILE = 'run/ppp0.pid'
     XAUTH_USER = 'xauth_user'
     XAUTH_PASSWORD = 'xauth_password'
     XAUTH_SECONDARY_AUTHENTICATION_STANZA = 'rightauth2=xauth'
     XL2TPD_COMMAND = '/usr/sbin/xl2tpd'
     XL2TPD_CONFIG_FILE = 'etc/xl2tpd/xl2tpd.conf'
-    XL2TPD_PID_FILE = 'var/run/xl2tpd.pid'
+    XL2TPD_PID_FILE = 'run/xl2tpd.pid'
     SERVER_IP_ADDRESS = '192.168.1.99'
     IPSEC_COMMON_CONFIGS = {
         'etc/strongswan.conf' :
@@ -217,7 +217,7 @@
     DIFFIE_HELLMAN_FILE = 'etc/openvpn/diffie-hellman.pem'
     OPENVPN_COMMAND = '/usr/sbin/openvpn'
     OPENVPN_CONFIG_FILE = 'etc/openvpn/openvpn.conf'
-    OPENVPN_PID_FILE = 'var/run/openvpn.pid'
+    OPENVPN_PID_FILE = 'run/openvpn.pid'
     OPENVPN_STATUS_FILE = 'tmp/openvpn.status'
     AUTHENTICATION_SCRIPT = 'etc/openvpn_authentication_script.sh'
     EXPECTED_AUTHENTICATION_FILE = 'etc/openvpn_expected_authentication.txt'
diff --git a/client/site_tests/network_ShillInitScripts/network_ShillInitScripts.py b/client/site_tests/network_ShillInitScripts/network_ShillInitScripts.py
index c9405b4..fce0305 100644
--- a/client/site_tests/network_ShillInitScripts/network_ShillInitScripts.py
+++ b/client/site_tests/network_ShillInitScripts/network_ShillInitScripts.py
@@ -21,16 +21,16 @@
     version = 1
     save_directories = [ '/var/cache/shill',
                          '/var/cache/flimflam',
-                         '/var/run/shill',
-                         '/var/run/state/logged-in',
-                         '/var/run/dhcpcd',
+                         '/run/shill',
+                         '/run/state/logged-in',
+                         '/run/dhcpcd',
                          '/var/lib/dhcpcd',
                          '/home/chronos/.disable_shill' ]
     fake_user = 'not-a-real-user@chromium.org'
     saved_config = '/tmp/network_ShillInitScripts_saved_config.tgz'
     cryptohome_path_command = 'cryptohome-path'
-    guest_shill_user_profile_dir = '/var/run/shill/guest_user_profile/shill'
-    guest_shill_user_log_dir = '/var/run/shill/guest_user_profile/shill_logs'
+    guest_shill_user_profile_dir = '/run/shill/guest_user_profile/shill'
+    guest_shill_user_log_dir = '/run/shill/guest_user_profile/shill_logs'
     magic_header = '# --- shill init file test magic header ---'
 
 
@@ -411,13 +411,13 @@
         """
         self.touch('/home/chronos/.disable_shill')
         self.start_shill()
-        self.assure_is_dir('/var/run/shill', 'Shill run directory')
+        self.assure_is_dir('/run/shill', 'Shill run directory')
         self.assure_is_dir('/var/lib/dhcpcd', 'dhcpcd lib directory')
         self.assure_path_owner('/var/lib/dhcpcd', 'dhcp')
         self.assure_path_group('/var/lib/dhcpcd', 'dhcp')
-        self.assure_is_dir('/var/run/dhcpcd', 'dhcpcd run directory')
-        self.assure_path_owner('/var/run/dhcpcd', 'dhcp')
-        self.assure_path_group('/var/run/dhcpcd', 'dhcp')
+        self.assure_is_dir('/run/dhcpcd', 'dhcpcd run directory')
+        self.assure_path_owner('/run/dhcpcd', 'dhcp')
+        self.assure_path_group('/run/dhcpcd', 'dhcp')
         self.assure(not os.path.exists('/home/chronos/.disable_shill'),
                     'Shill disable file does not exist')
         self.assure('--push=~chronos/shill' not in self.get_commandline(),
@@ -431,16 +431,16 @@
         while a user is logged in.
 
         """
-        os.mkdir('/var/run/shill')
-        os.mkdir('/var/run/shill/user_profiles')
+        os.mkdir('/run/shill')
+        os.mkdir('/run/shill/user_profiles')
         self.create_new_shill_user_profile('')
         os.symlink(self.new_shill_user_profile_dir,
-                   '/var/run/shill/user_profiles/chronos')
-        self.touch('/var/run/state/logged-in')
+                   '/run/shill/user_profiles/chronos')
+        self.touch('/run/state/logged-in')
         self.start_shill()
         self.assure('--push=~chronos/shill' not in self.get_commandline(),
                     'Shill command line does not contain push argument')
-        os.unlink('/var/run/state/logged-in')
+        os.unlink('/run/state/logged-in')
 
 
     def test_start_port_flimflam_profile(self):
@@ -490,7 +490,7 @@
         a user profile, given no previous state.
 
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         self.login()
         self.assure(not os.path.exists(self.flimflam_user_profile),
                     'Flimflam user profile does not exist')
@@ -503,14 +503,14 @@
         # should not have actually been created.
         self.assure_is_dir(self.new_shill_user_profile_dir,
                            'New shill user profile directory')
-        self.assure_is_dir('/var/run/shill/user_profiles',
+        self.assure_is_dir('/run/shill/user_profiles',
                            'Shill profile root')
-        self.assure_is_link_to('/var/run/shill/user_profiles/chronos',
+        self.assure_is_link_to('/run/shill/user_profiles/chronos',
                                self.new_shill_user_profile_dir,
                                'Shill profile link')
         self.assure_is_dir(self.user_cryptohome_log_dir,
                            'shill user log directory')
-        self.assure_is_link_to('/var/run/shill/log',
+        self.assure_is_link_to('/run/shill/log',
                                self.user_cryptohome_log_dir,
                                'Shill logs link')
         self.assure_method_calls([[ 'CreateProfile', '~chronos/shill' ],
@@ -523,11 +523,11 @@
     def test_login_guest(self):
         """ Tests the guest login process.
 
-        Login should create a temporary profile directory in /var/run,
+        Login should create a temporary profile directory in /run,
         instead of using one within the root directory for normal users.
 
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         self.login_guest()
         self.assure(not os.path.exists(self.flimflam_user_profile),
                     'Flimflam user profile does not exist')
@@ -539,14 +539,14 @@
                     'New shill user profile directory')
         self.assure_is_dir(self.guest_shill_user_profile_dir,
                            'shill guest user profile directory')
-        self.assure_is_dir('/var/run/shill/user_profiles',
+        self.assure_is_dir('/run/shill/user_profiles',
                            'Shill profile root')
-        self.assure_is_link_to('/var/run/shill/user_profiles/chronos',
+        self.assure_is_link_to('/run/shill/user_profiles/chronos',
                                self.guest_shill_user_profile_dir,
                                'Shill profile link')
         self.assure_is_dir(self.guest_shill_user_log_dir,
                            'shill guest user log directory')
-        self.assure_is_link_to('/var/run/shill/log',
+        self.assure_is_link_to('/run/shill/log',
                                self.guest_shill_user_log_dir,
                                'Shill logs link')
         self.assure_method_calls([[ 'CreateProfile', '~chronos/shill' ],
@@ -562,7 +562,7 @@
         Login script should only push (and not create) the user profile
         if a user profile already exists.
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         os.mkdir(self.new_shill_user_profile_dir)
         self.touch(self.new_shill_user_profile)
         self.login()
@@ -577,7 +577,7 @@
         Login script should move an old shill user profile into place
         if a new one does not exist.
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         self.create_old_shill_user_profile(self.magic_header)
         self.login()
         self.assure(not os.path.exists(self.old_shill_user_profile),
@@ -629,7 +629,7 @@
         by the correct user.  The original file should be removed.
 
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         for file_creation_method in (self.make_symlink,
                                      self.make_special_file,
                                      os.mkdir,
@@ -649,7 +649,7 @@
                                          self.fake_user_hash) ]],
                                      'CreateProfile and InsertUserProfile '
                                      'are called')
-            os.unlink('/var/run/shill/user_profiles/chronos')
+            os.unlink('/run/shill/user_profiles/chronos')
 
 
     def test_login_ignore_old_shill_profile(self):
@@ -659,7 +659,7 @@
         exists.
 
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         self.create_new_shill_user_profile('')
         self.create_old_shill_user_profile(self.magic_header)
         self.login()
@@ -682,7 +682,7 @@
         if a shill one does not exist.
 
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         self.create_flimflam_user_profile(self.magic_header)
         self.login()
         self.assure(not os.path.exists(self.flimflam_user_profile),
@@ -706,7 +706,7 @@
         one exists.
 
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         self.create_flimflam_user_profile(self.magic_header)
         self.create_new_shill_user_profile('')
         self.login()
@@ -728,7 +728,7 @@
         exist.
 
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         self.create_flimflam_user_profile('')
         self.create_old_shill_user_profile(self.magic_header)
         self.login()
@@ -754,7 +754,7 @@
         the initial user profile should be created.
 
         """
-        os.mkdir('/var/run/shill')
+        os.mkdir('/run/shill')
         self.create_new_shill_user_profile('')
 
         # First logged-in user should create a profile (tested above).
@@ -766,23 +766,23 @@
         for attempt in range(5):
             self.login()
             self.assure_method_calls([], 'No more profiles are added to shill')
-            profile_links = os.listdir('/var/run/shill/user_profiles')
+            profile_links = os.listdir('/run/shill/user_profiles')
             self.assure(len(profile_links) == 1, 'Only one profile exists')
             self.assure(profile_links[0] == 'chronos',
                         'The profile link is for the chronos user')
-            self.assure_is_link_to('/var/run/shill/log',
+            self.assure_is_link_to('/run/shill/log',
                                    self.user_cryptohome_log_dir,
                                    'Shill log link for chronos')
 
 
     def test_logout(self):
         """ Test the logout process. """
-        os.makedirs('/var/run/shill/user_profiles')
+        os.makedirs('/run/shill/user_profiles')
         os.makedirs(self.guest_shill_user_profile_dir)
         os.makedirs(self.guest_shill_user_log_dir)
-        self.touch('/var/run/state/logged-in')
+        self.touch('/run/state/logged-in')
         self.logout()
-        self.assure(not os.path.exists('/var/run/shill/user_profiles'),
+        self.assure(not os.path.exists('/run/shill/user_profiles'),
                     'User profile directory was removed')
         self.assure(not os.path.exists(self.guest_shill_user_profile_dir),
                     'Guest user profile directory was removed')
diff --git a/client/site_tests/platform_AnomalyCollector/platform_AnomalyCollector.py b/client/site_tests/platform_AnomalyCollector/platform_AnomalyCollector.py
index e430b0c..2b888d7 100644
--- a/client/site_tests/platform_AnomalyCollector/platform_AnomalyCollector.py
+++ b/client/site_tests/platform_AnomalyCollector/platform_AnomalyCollector.py
@@ -15,7 +15,7 @@
         # Restart the anomaly collector daemon, trigger a test kernel warning,
         # and verify that a warning file is created.
         utils.system("stop anomaly-collector")
-        utils.system("rm -rf /var/run/anomaly-collector")
+        utils.system("rm -rf /run/anomaly-collector")
         utils.system("start anomaly-collector")
         utils.system("sleep 0.1")
         lkdtm = "/sys/kernel/debug/provoke-crash/DIRECT"
@@ -24,4 +24,4 @@
         else:
             utils.system("echo warning > /proc/breakme")
         utils.system("sleep 0.1")
-        utils.system("test -f /var/run/anomaly-collector/warning")
+        utils.system("test -f /run/anomaly-collector/warning")
diff --git a/client/site_tests/platform_MetricsUploader/platform_MetricsUploader.py b/client/site_tests/platform_MetricsUploader/platform_MetricsUploader.py
index 2407887..274f7f5 100644
--- a/client/site_tests/platform_MetricsUploader/platform_MetricsUploader.py
+++ b/client/site_tests/platform_MetricsUploader/platform_MetricsUploader.py
@@ -99,7 +99,7 @@
 
 
     def _create_one_sample(self):
-        utils.system_output('truncate --size=0 /var/run/metrics/uma-events')
+        utils.system_output('truncate --size=0 /run/metrics/uma-events')
         utils.system_output('metrics_client test 10 0 100 10')
 
 
diff --git a/client/site_tests/platform_TempFS/control b/client/site_tests/platform_TempFS/control
index 21dc51d..9f207ee 100644
--- a/client/site_tests/platform_TempFS/control
+++ b/client/site_tests/platform_TempFS/control
@@ -12,8 +12,8 @@
   - /tmp
   - /dev/shm
   - /var/tmp
-  - /var/run
-  - /var/lock
+  - /run
+  - /run/lock
 """
 TIME = "SHORT"
 TEST_CATEGORY = "Functional"
diff --git a/client/site_tests/platform_TempFS/platform_TempFS.py b/client/site_tests/platform_TempFS/platform_TempFS.py
index e2aef4e..bf5df2d 100755
--- a/client/site_tests/platform_TempFS/platform_TempFS.py
+++ b/client/site_tests/platform_TempFS/platform_TempFS.py
@@ -25,8 +25,8 @@
         # allows for 50% usage of space allocated before this test is run.
 
         threshold = utils.memtotal()/4
-        tempdirs = ['/dev', '/tmp', '/dev/shm', '/var/tmp', '/var/run',
-                    '/var/lock']
+        tempdirs = ['/dev', '/tmp', '/dev/shm', '/var/tmp', '/run',
+                    '/run/lock']
 
         for dir in tempdirs:
             if os.path.isdir(dir):
diff --git a/client/site_tests/security_RootfsStatefulSymlinks/baseline b/client/site_tests/security_RootfsStatefulSymlinks/baseline
index 7c0bf6f..be56bca 100644
--- a/client/site_tests/security_RootfsStatefulSymlinks/baseline
+++ b/client/site_tests/security_RootfsStatefulSymlinks/baseline
@@ -1,21 +1,21 @@
 {
   "/etc/ipsec.conf": {
     "can_dangle": true,
-    "destination": "/var/run/l2tpipsec_vpn/current/ipsec.conf",
+    "destination": "/run/l2tpipsec_vpn/current/ipsec.conf",
     "owner": "root",
     "group": "ipsec",
     "mode": "0640"
   },
   "/etc/ipsec.d/cacerts/cacert.der": {
     "can_dangle": true,
-    "destination": "/var/run/l2tpipsec_vpn/current/cacert.der",
+    "destination": "/run/l2tpipsec_vpn/current/cacert.der",
     "owner": "root",
     "group": "ipsec",
     "mode": "0640"
   },
   "/etc/ipsec.secrets": {
     "can_dangle": true,
-    "destination": "/var/run/l2tpipsec_vpn/current/ipsec.secrets",
+    "destination": "/run/l2tpipsec_vpn/current/ipsec.secrets",
     "owner": "root",
     "group": "ipsec",
     "mode": "0640"
@@ -43,7 +43,7 @@
   },
   "/etc/strongswan.conf": {
     "can_dangle": true,
-    "destination": "/var/run/l2tpipsec_vpn/current/strongswan.conf",
+    "destination": "/run/l2tpipsec_vpn/current/strongswan.conf",
     "owner": "root",
     "group": "ipsec",
     "mode": "0640"
diff --git a/client/tests/dbt2/pgpool.conf b/client/tests/dbt2/pgpool.conf
index d5b2f07..dd417ce 100644
--- a/client/tests/dbt2/pgpool.conf
+++ b/client/tests/dbt2/pgpool.conf
@@ -13,14 +13,14 @@
 pcp_port = 9898
 
 # Unix domain socket path.  (The Debian package defaults to
-# /var/run/postgresql.)
+# /run/postgresql.)
 socket_dir = '/tmp'
 
 # Unix domain socket path for pgpool communication manager.
-# (Debian package default to /var/run/postgresql)
+# (Debian package default to /run/postgresql)
 pcp_socket_dir = '/tmp'
 
-# Unix domain socket path for the backend. Debian package default to /var/run/postgresql!
+# Unix domain socket path for the backend. Debian package default to /run/postgresql!
 backend_socket_dir = '/tmp'
 
 # pgpool communication manager timeout. 0 means no timeout, but strongly not recommended!
diff --git a/site_utils/admin/apache/apache2.conf b/site_utils/admin/apache/apache2.conf
index 7380450..3b41580 100644
--- a/site_utils/admin/apache/apache2.conf
+++ b/site_utils/admin/apache/apache2.conf
@@ -54,7 +54,7 @@
 #
 #<IfModule !mpm_winnt.c>
 #<IfModule !mpm_netware.c>
-LockFile /var/lock/apache2/accept.lock
+LockFile /run/lock/apache2/accept.lock
 #</IfModule>
 #</IfModule>