ValueError: bad marshal data (unknown type code)

EDIT i reformatted SD card as apt-get threw errors so I can’t diagnose this anymore.

I just attempted an upgrade from 0.62.1 to to 0.82.1 on Rassbian. Upgrade appeared to work BUT hass will no longer start, getting:

pi@hassbian:~ $ sudo systemctl status [email protected][email protected] - Home Assistant for homeassistant
   Loaded: loaded (/etc/systemd/system/[email protected]; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-11-27 05:09:44 UTC; 2min 11s ago
  Process: 1638 ExecStart=/srv/homeassistant/bin/hass (code=exited, status=1/FAILURE)
 Main PID: 1638 (code=exited, status=1/FAILURE)

Nov 27 05:09:43 hassbian hass[1638]:   File "<frozen importlib._bootstrap>", line 969, in _find_and_load
Nov 27 05:09:43 hassbian hass[1638]:   File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
Nov 27 05:09:43 hassbian hass[1638]:   File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
Nov 27 05:09:43 hassbian hass[1638]:   File "<frozen importlib._bootstrap_external>", line 669, in exec_module
Nov 27 05:09:43 hassbian hass[1638]:   File "<frozen importlib._bootstrap_external>", line 773, in get_code
Nov 27 05:09:43 hassbian hass[1638]:   File "<frozen importlib._bootstrap_external>", line 484, in _compile_bytecode
Nov 27 05:09:43 hassbian hass[1638]: ValueError: bad marshal data (unknown type code)
Nov 27 05:09:44 hassbian systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Nov 27 05:09:44 hassbian systemd[1]: [email protected]: Unit entered failed state.
Nov 27 05:09:44 hassbian systemd[1]: [email protected]: Failed with result 'exit-code'.

I’m not getting any hits on this. This implies some sort of byte code load (*.pyc or frozen) problem. I have no idea how to go about debugging this. Any hints would be appreciated. I had previously upgraded to 0.76.2 successfully (on another SD card) and was finally ready to take the plunge into the new auth system.

More traceback information, from:

sudo -u homeassistant -H -s
source /srv/homeassistant/bin/activate
hass

Output:

Traceback (most recent call last):
  File "/srv/homeassistant/bin/hass", line 11, in <module>
    sys.exit(main())
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/__main__.py", line 371, in main
    args = get_arguments()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/__main__.py", line 103, in get_arguments
    import homeassistant.config as config_util
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/config.py", line 15, in <module>
    from homeassistant import auth
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/auth/__init__.py", line 10, in <module>
    from homeassistant import data_entry_flow
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/data_entry_flow.py", line 6, in <module>
    from .core import callback, HomeAssistant
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 45, in <module>
    from homeassistant.util import location
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/location.py", line 10, in <module>
    import requests
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/__init__.py", line 112, in <module>
    from . import utils
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/utils.py", line 32, in <module>
    from .cookies import cookiejar_from_dict
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 669, in exec_module
  File "<frozen importlib._bootstrap_external>", line 773, in get_code
  File "<frozen importlib._bootstrap_external>", line 484, in _compile_bytecode
ValueError: bad marshal data (unknown type code)

So test case to demo problem is:

$ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from requests.cookies  import cookiejar_from_dict
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/__init__.py", line 112, in <module>
    from . import utils
  File "/srv/homeassistant/lib/python3.5/site-packages/requests/utils.py", line 32, in <module>
    from .cookies import cookiejar_from_dict
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 669, in exec_module
  File "<frozen importlib._bootstrap_external>", line 773, in get_code
  File "<frozen importlib._bootstrap_external>", line 484, in _compile_bytecode
ValueError: bad marshal data (unknown type code)
1 Like

at-get os upgrade resulted in error so I ended up wiping the card and going to 0.76.2.

I’ll try again tomorrow :slight_smile: