diff --git a/azurelinuxagent/common/protocol/wire.py b/azurelinuxagent/common/protocol/wire.py
index 287da33c..29a1663f 100644
--- a/azurelinuxagent/common/protocol/wire.py
+++ b/azurelinuxagent/common/protocol/wire.py
@@ -269,7 +269,7 @@ def ext_status_to_v1(ext_name, ext_status):
         "timestampUTC": timestamp
     }
     if len(v1_sub_status) != 0:
-        v1_ext_status['status']['substatus'] = v1_sub_status
+        v1_ext_status['substatus'] = v1_sub_status
     return v1_ext_status
 
 
diff --git a/azurelinuxagent/common/utils/textutil.py b/azurelinuxagent/common/utils/textutil.py
index f03c7e67..6d460cb1 100644
--- a/azurelinuxagent/common/utils/textutil.py
+++ b/azurelinuxagent/common/utils/textutil.py
@@ -277,3 +277,11 @@ def b64encode(s):
     if PY_VERSION_MAJOR > 2:
         return base64.b64encode(bytes(s, 'utf-8')).decode('utf-8')
     return base64.b64encode(s)
+
+
+def safe_shlex_split(s):
+    import shlex
+    from azurelinuxagent.common.version import PY_VERSION
+    if PY_VERSION[:2] == (2, 6):
+        return shlex.split(s.encode('utf-8'))
+    return shlex.split(s)
diff --git a/azurelinuxagent/daemon/resourcedisk/default.py b/azurelinuxagent/daemon/resourcedisk/default.py
index 9ffe2809..a5f4cf66 100644
--- a/azurelinuxagent/daemon/resourcedisk/default.py
+++ b/azurelinuxagent/daemon/resourcedisk/default.py
@@ -106,10 +106,7 @@ class ResourceDiskHandler(object):
             raise ResourceDiskError("Could not determine partition info for "
                                     "{0}: {1}".format(device, ret[1]))
 
-        force_option = 'F'
-        if fs == 'xfs':
-            force_option = 'f'
-        mkfs_string = "mkfs.{0} {1} -{2}".format(fs, partition, force_option)
+        mkfs_string = "mkfs.{0} {1} -F".format(fs, partition)
 
         if "gpt" in ret[1]:
             logger.info("GPT detected, finding partitions")
diff --git a/azurelinuxagent/ga/update.py b/azurelinuxagent/ga/update.py
index 37774d29..5eff7e53 100644
--- a/azurelinuxagent/ga/update.py
+++ b/azurelinuxagent/ga/update.py
@@ -16,12 +16,12 @@
 #
 # Requires Python 2.4+ and Openssl 1.0+
 #
+
 import glob
 import json
 import os
 import platform
 import re
-import shlex
 import shutil
 import signal
 import subprocess
@@ -130,7 +130,7 @@ class UpdateHandler(object):
         try:
 
             # Launch the correct Python version for python-based agents
-            cmds = shlex.split(agent_cmd)
+            cmds = textutil.safe_shlex_split(agent_cmd)
             if cmds[0].lower() == "python":
                 cmds[0] = get_python_cmd()
                 agent_cmd = " ".join(cmds)
diff --git a/setup.py b/setup.py
index 7303b62c..887a557e 100755
--- a/setup.py
+++ b/setup.py
@@ -147,7 +147,7 @@ class install(_install):
         ('lnx-distro=', None, 'target Linux distribution'),
         ('lnx-distro-version=', None, 'target Linux distribution version'),
         ('lnx-distro-fullname=', None, 'target Linux distribution full name'),
-        ('register-service', None, 'register as startup service and start'),
+        ('register-service', None, 'register as startup service'),
         ('skip-data-files', None, 'skip data files installation'),
     ]
 
@@ -172,16 +172,14 @@ class install(_install):
     def run(self):
         _install.run(self)
         if self.register_service:
-            osutil = get_osutil()
-            osutil.register_agent_service()
-            osutil.start_agent_service()
+            get_osutil().register_agent_service()
 
 
 setuptools.setup(
     name=AGENT_NAME,
     version=AGENT_VERSION,
     long_description=AGENT_DESCRIPTION,
-    author='Microsoft Corporation',
+    author='Yue Zhang, Stephen Zarkos, Eric Gable',
     author_email='walinuxagent@microsoft.com',
     platforms='Linux',
     url='https://github.com/Azure/WALinuxAgent',

[2.1.5] AutoUpdate WALA error on RHEL-6.8
Description of problem:
waagent fails to run the AutoUpdated WALA process.

Version-Release number of selected component (if applicable):
WALinuxAgent-2.1.5

RHEL Version: RHEL-6.8
Python Version: 2.6.6

How reproducible:
100%

Steps to Reproduce:
1. Prepare a RHEL7.3 VM on Azure East US location(ASM mode) with WALA-2.1.5 installed. Enable wala auto-update in the /etc/waagent.conf:
\# AutoUpdate.Enabled=y
\# AutoUpdate.GAFamily=Prod
Then restart waagent service
\# service waagent restart
2. Wait until the new WALA package is downloaded. Check waagent.log. 

Actual results:
waagent can't run the new WALA version.
There's error logs in waagent.log:

```
2016/08/25 20:20:17.474136 INFO Instantiating Agent WALinuxAgent-2.1.6 from package
2016/08/25 20:20:17.476843 INFO Agent WALinuxAgent-2.1.6 error state: Last Failure: 0.0, Total Failures: 0, Fatal: False
2016/08/25 20:20:17.476980 INFO Ensuring Agent WALinuxAgent-2.1.6 is downloaded
2016/08/25 20:20:17.738310 INFO Agent WALinuxAgent-2.1.6 downloaded from https://rdfepirv2bl2prdstr01.blob.core.windows.net/7d89d439b79f4452950452399add2c90/Microsoft.OSTCLinuxAgent__Prod__2.1.6
2016/08/25 20:20:17.799473 INFO Agent WALinuxAgent-2.1.6 unpacked successfully to /var/lib/waagent/WALinuxAgent-2.1.6
2016/08/25 20:20:17.877585 INFO Agent WALinuxAgent-2.1.6 loaded manifest from /var/lib/waagent/WALinuxAgent-2.1.6/HandlerManifest.json
2016/08/25 20:20:17.962055 INFO Agent WALinuxAgent-2.1.6 error state: Last Failure: 0.0, Total Failures: 0, Fatal: False
2016/08/25 20:20:17.977174 INFO Agent WALinuxAgent-2.1.6 downloaded successfully
2016/08/25 20:20:18.021588 INFO Event: name=WALinuxAgent, op=Install, message=Agent WALinuxAgent-2.1.6 downloaded successfully
2016/08/25 20:20:18.102944 INFO Agent WALinuxAgent-2.1.5 discovered WALinuxAgent-2.1.6 as an update and will exit
2016/08/25 20:21:12.959822 INFO Agent WALinuxAgent-2.1.5 launched with command 'python -u /usr/sbin/waagent -run-exthandlers' is successfully running
2016/08/25 20:21:13.048011 INFO Event: name=WALinuxAgent, op=Enable, message=Agent WALinuxAgent-2.1.5 launched with command 'python -u /usr/sbin/waagent -run-exthandlers' is successfully running
2016/08/25 20:21:13.146289 INFO Instantiating Agent WALinuxAgent-2.1.6 from disk
2016/08/25 20:21:13.195095 INFO Agent WALinuxAgent-2.1.6 error state: Last Failure: 0.0, Total Failures: 0, Fatal: False
2016/08/25 20:21:13.230193 INFO Ensuring Agent WALinuxAgent-2.1.6 is downloaded
2016/08/25 20:21:13.235666 INFO Agent WALinuxAgent-2.1.6 was previously downloaded - skipping download
2016/08/25 20:21:13.242621 INFO Agent WALinuxAgent-2.1.6 loaded manifest from /var/lib/waagent/WALinuxAgent-2.1.6/HandlerManifest.json
2016/08/25 20:21:13.328814 INFO Determined Agent WALinuxAgent-2.1.6 to be the latest agent
2016/08/25 20:21:13.343555 WARNING Agent WALinuxAgent-2.1.6 launched with command 'python -u bin/WALinuxAgent-2.1.6-py2.7.egg -run-exthandlers' failed with exception: execv() argument 1 must be encoded string without NULL bytes, not str
2016/08/25 20:21:13.566290 ERROR Event: name=WALinuxAgent, op=Enable, message=Agent WALinuxAgent-2.1.6 launched with command 'python -u bin/WALinuxAgent-2.1.6-py2.7.egg -run-exthandlers' failed with exception: execv() argument 1 must be encoded string without NULL bytes, not str
2016/08/25 20:21:13.675956 WARNING Agent WALinuxAgent-2.1.6 is permanently blacklisted
2016/08/25 20:21:13.749416 INFO Installed Agent WALinuxAgent-2.1.5 is the most current agent
2016/08/25 20:21:13.756486 INFO Agent WALinuxAgent-2.1.5 launched with command 'python -u /usr/sbin/waagent -run-exthandlers'

\# cat /var/lib/waagent/WALinuxAgent-2.1.6/error.json
{"was_fatal": true, "failure_count": 1, "last_failure": 1472127673.6758201}
```

Additional info:
1. Only exists on RHEL-6. Doesn't exist on RHEL-7.
2. If install WALA-2.1.6 directly, there's no error log. Only exists during AutoUpdate.
diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py
index f4b33207..0e07119d 100644
--- a/tests/ga/test_update.py
+++ b/tests/ga/test_update.py
@@ -438,7 +438,8 @@ class TestGuestAgent(UpdateTestCase):
         agent = GuestAgent(path=self.agent_path)
         agent._unpack()
         agent._load_manifest()
-        self.assertEqual(agent.manifest.get_enable_command(), agent.get_agent_cmd())
+        self.assertEqual(agent.manifest.get_enable_command(),
+                         agent.get_agent_cmd())
         return
 
     @patch("azurelinuxagent.ga.update.GuestAgent._ensure_downloaded")
@@ -992,13 +993,14 @@ class TestUpdate(UpdateTestCase):
 
         agent = self.update_handler.get_latest_agent()
         args, kwargs = self._test_run_latest()
-        cmds = shlex.split(agent.get_agent_cmd())
+        cmds = textutil.safe_shlex_split(agent.get_agent_cmd())
         if cmds[0].lower() == "python":
             cmds[0] = get_python_cmd()
 
         self.assertEqual(args[0], cmds)
         self.assertEqual(True, 'cwd' in kwargs)
         self.assertEqual(agent.get_agent_dir(), kwargs['cwd'])
+        self.assertEqual(False, '\x00' in cmds[0])
         return
 
     def test_run_latest_polls_and_waits_for_success(self):

pip install -e .
parse_log_pytest
pytest
nose pyasn1 pytest
apt-get update apt-get install -y gcc
3.6
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs @ file:///opt/conda/conda-bld/attrs_1642510447205/work
certifi==2021.5.30
importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1631916693255/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
more-itertools @ file:///tmp/build/80754af9/more-itertools_1637733554872/work
nose==1.3.7
packaging @ file:///tmp/build/80754af9/packaging_1637314298585/work
pluggy @ file:///tmp/build/80754af9/pluggy_1615976315926/work
py @ file:///opt/conda/conda-bld/py_1644396412707/work
pyasn1==0.5.1
pyparsing @ file:///tmp/build/80754af9/pyparsing_1635766073266/work
pytest==6.2.4
toml @ file:///tmp/build/80754af9/toml_1616166611790/work
typing_extensions @ file:///opt/conda/conda-bld/typing_extensions_1647553014482/work
-e git+https://github.com/Azure/WALinuxAgent.git@d0392908c8a8c66f41183696c0dbe5dfc3d34acc#egg=WALinuxAgent
zipp @ file:///tmp/build/80754af9/zipp_1633618647012/work

name: WALinuxAgent
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - attrs=21.4.0=pyhd3eb1b0_0
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - importlib-metadata=4.8.1=py36h06a4308_0
  - importlib_metadata=4.8.1=hd3eb1b0_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - more-itertools=8.12.0=pyhd3eb1b0_0
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - packaging=21.3=pyhd3eb1b0_0
  - pip=21.2.2=py36h06a4308_0
  - pluggy=0.13.1=py36h06a4308_0
  - py=1.11.0=pyhd3eb1b0_0
  - pyparsing=3.0.4=pyhd3eb1b0_0
  - pytest=6.2.4=py36h06a4308_2
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - toml=0.10.2=pyhd3eb1b0_0
  - typing_extensions=4.1.1=pyh06a4308_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zipp=3.6.0=pyhd3eb1b0_0
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - nose==1.3.7
      - pyasn1==0.5.1
prefix: /opt/conda/envs/WALinuxAgent

tests/ga/test_update.py::TestUpdate::test_run_latest
tests/ga/test_update.py::TestGuestAgentError::test_clear tests/ga/test_update.py::TestGuestAgentError::test_creation tests/ga/test_update.py::TestGuestAgentError::test_load_preserves_error_state tests/ga/test_update.py::TestGuestAgentError::test_mark_failure tests/ga/test_update.py::TestGuestAgentError::test_mark_failure_permanent tests/ga/test_update.py::TestGuestAgentError::test_save tests/ga/test_update.py::TestGuestAgentError::test_str tests/ga/test_update.py::TestGuestAgent::test_clear_error tests/ga/test_update.py::TestGuestAgent::test_creation tests/ga/test_update.py::TestGuestAgent::test_download tests/ga/test_update.py::TestGuestAgent::test_download_fail tests/ga/test_update.py::TestGuestAgent::test_ensure_download_skips_blacklisted tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_download_fails tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_load_manifest_fails tests/ga/test_update.py::TestGuestAgent::test_ensure_downloaded_unpack_fails tests/ga/test_update.py::TestGuestAgent::test_is_available tests/ga/test_update.py::TestGuestAgent::test_is_blacklisted tests/ga/test_update.py::TestGuestAgent::test_is_downloaded tests/ga/test_update.py::TestGuestAgent::test_load_error tests/ga/test_update.py::TestGuestAgent::test_load_manifest tests/ga/test_update.py::TestGuestAgent::test_load_manifest_is_empty tests/ga/test_update.py::TestGuestAgent::test_load_manifest_is_malformed tests/ga/test_update.py::TestGuestAgent::test_load_manifest_missing tests/ga/test_update.py::TestGuestAgent::test_mark_failure tests/ga/test_update.py::TestGuestAgent::test_unpack tests/ga/test_update.py::TestGuestAgent::test_unpack_fail tests/ga/test_update.py::TestUpdate::test_creation tests/ga/test_update.py::TestUpdate::test_emit_restart_event_emits_event_if_not_clean_start tests/ga/test_update.py::TestUpdate::test_emit_restart_event_writes_sentinal_file tests/ga/test_update.py::TestUpdate::test_ensure_lastest_agent_purges_old_agents tests/ga/test_update.py::TestUpdate::test_ensure_latest_agent_includes_old_agents tests/ga/test_update.py::TestUpdate::test_ensure_latest_agent_returns_true_on_first_use tests/ga/test_update.py::TestUpdate::test_ensure_latest_agent_skips_if_too_frequent tests/ga/test_update.py::TestUpdate::test_ensure_latest_agent_skips_if_when_no_new_versions tests/ga/test_update.py::TestUpdate::test_ensure_latest_agent_skips_when_etag_matches tests/ga/test_update.py::TestUpdate::test_ensure_latest_agent_skips_when_no_versions tests/ga/test_update.py::TestUpdate::test_ensure_latest_agent_skips_when_updates_are_disabled tests/ga/test_update.py::TestUpdate::test_ensure_latest_agent_sorts tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_ignores_exceptions tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_kills_after_interval tests/ga/test_update.py::TestUpdate::test_ensure_no_orphans_skips_if_no_orphans tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_ignores_installed_agent tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_raises_exception_for_restarting_agent tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_resets_with_new_agent tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_will_not_raise_exception_for_long_restarts tests/ga/test_update.py::TestUpdate::test_evaluate_agent_health_will_not_raise_exception_too_few_restarts tests/ga/test_update.py::TestUpdate::test_filter_blacklisted_agents tests/ga/test_update.py::TestUpdate::test_get_latest_agent tests/ga/test_update.py::TestUpdate::test_get_latest_agent_no_updates tests/ga/test_update.py::TestUpdate::test_get_latest_agent_skip_updates tests/ga/test_update.py::TestUpdate::test_get_latest_agent_skips_unavailable tests/ga/test_update.py::TestUpdate::test_get_pid_files tests/ga/test_update.py::TestUpdate::test_get_pid_files_returns_previous tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_false_for_current_agent tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_false_for_exceptions tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_true_sentinal_agent_is_not_current tests/ga/test_update.py::TestUpdate::test_is_clean_start_returns_true_when_no_sentinal tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_false_if_parent_exists tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_true_if_parent_does_not_exist tests/ga/test_update.py::TestUpdate::test_is_orphaned_returns_true_if_parent_is_init tests/ga/test_update.py::TestUpdate::test_load_agents tests/ga/test_update.py::TestUpdate::test_load_agents_does_not_reload tests/ga/test_update.py::TestUpdate::test_load_agents_sorts tests/ga/test_update.py::TestUpdate::test_purge_agents tests/ga/test_update.py::TestUpdate::test_run tests/ga/test_update.py::TestUpdate::test_run_clears_sentinal_on_successful_exit tests/ga/test_update.py::TestUpdate::test_run_emits_restart_event tests/ga/test_update.py::TestUpdate::test_run_keeps_running tests/ga/test_update.py::TestUpdate::test_run_latest_captures_signals tests/ga/test_update.py::TestUpdate::test_run_latest_creates_only_one_signal_handler tests/ga/test_update.py::TestUpdate::test_run_latest_defaults_to_current tests/ga/test_update.py::TestUpdate::test_run_latest_exception_blacklists tests/ga/test_update.py::TestUpdate::test_run_latest_forwards_output tests/ga/test_update.py::TestUpdate::test_run_latest_nonzero_code_marks_failures tests/ga/test_update.py::TestUpdate::test_run_latest_polling_stops_at_failure tests/ga/test_update.py::TestUpdate::test_run_latest_polling_stops_at_success tests/ga/test_update.py::TestUpdate::test_run_latest_polls_and_waits_for_success tests/ga/test_update.py::TestUpdate::test_run_leaves_sentinal_on_unsuccessful_exit tests/ga/test_update.py::TestUpdate::test_run_stops_if_orphaned tests/ga/test_update.py::TestUpdate::test_run_stops_if_update_available tests/ga/test_update.py::TestUpdate::test_set_agents_sets_agents tests/ga/test_update.py::TestUpdate::test_set_agents_sorts_agents tests/ga/test_update.py::TestUpdate::test_set_sentinal tests/ga/test_update.py::TestUpdate::test_set_sentinal_writes_current_agent tests/ga/test_update.py::TestUpdate::test_shutdown tests/ga/test_update.py::TestUpdate::test_shutdown_ignores_exceptions tests/ga/test_update.py::TestUpdate::test_shutdown_ignores_missing_sentinal_file tests/ga/test_update.py::TestUpdate::test_write_pid_file tests/ga/test_update.py::TestUpdate::test_write_pid_file_ignores_exceptions
azurelinuxagent/common/utils/textutil.py azurelinuxagent/ga/update.py azurelinuxagent/daemon/resourcedisk/default.py setup.py azurelinuxagent/common/protocol/wire.py
azurelinuxagent/common/utils/textutil.py azurelinuxagent/ga/update.py azurelinuxagent/daemon/resourcedisk/default.py setup.py azurelinuxagent/common/protocol/wire.py