Help Understanding Upgrade Error

Hello all. I just performed an upgrade to Home Assistant (my first one despite having been running this for a while). The web interface said there was an update available and clicking the link for update help led to the instructions at https://www.home-assistant.io/docs/installation/hassbian/common-tasks/#update-home-assistant.

Here is the output from that attempt:

  pi@rasp1-svr:/srv/homeassistant/bin $ sudo systemctl stop hass.service
    pi@rasp1-svr:/srv/homeassistant/bin $ sudo -u hass -H -s
    hass@rasp1-svr:/srv/homeassistant/bin $ source /srv/homeassistant/bin/activate
    (homeassistant) hass@rasp1-svr:/srv/homeassistant/bin $ pip3 install --upgrade homeassistant
    Collecting homeassistant
      Downloading https://files.pythonhosted.org/packages/af/14/6bf7310852027875336780ef67f0d2ea600e2fabe8a4ef601edd4840f53c/homeassistant-0.90.1-py3-none-any.whl (4.0MB)
        100% |████████████████████████████████| 4.0MB 75kB/s
    Collecting ruamel.yaml==0.15.88 (from homeassistant)
      Downloading https://www.piwheels.org/simple/ruamel-yaml/ruamel.yaml-0.15.88-cp35-cp35m-linux_armv7l.whl (554kB)
        100% |████████████████████████████████| 563kB 427kB/s
    Collecting pip>=8.0.3 (from homeassistant)
      Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
        100% |████████████████████████████████| 1.4MB 210kB/s
    Collecting attrs==18.2.0 (from homeassistant)
      Downloading https://files.pythonhosted.org/packages/3a/e1/5f9023cc983f1a628a8c2fd051ad19e76ff7b142a0faf329336f9a62a514/attrs-18.2.0-py2.py3-none-any.whl
    Collecting cryptography==2.5 (from homeassistant)
      Downloading https://www.piwheels.org/simple/cryptography/cryptography-2.5-cp35-cp35m-linux_armv7l.whl (865kB)
        100% |████████████████████████████████| 870kB 322kB/s
    Collecting python-slugify==1.2.6 (from homeassistant)
      Downloading https://www.piwheels.org/simple/python-slugify/python_slugify-1.2.6-py2.py3-none-any.whl
    Collecting pytz>=2018.07 (from homeassistant)
      Downloading https://files.pythonhosted.org/packages/61/28/1d3920e4d1d50b19bc5d24398a7cd85cc7b9a75a490570d5a30c57622d34/pytz-2018.9-py2.py3-none-any.whl (510kB)
        100% |████████████████████████████████| 512kB 558kB/s
    Collecting bcrypt==3.1.6 (from homeassistant)
      Downloading https://www.piwheels.org/simple/bcrypt/bcrypt-3.1.6-cp35-cp35m-linux_armv7l.whl (54kB)
        100% |████████████████████████████████| 61kB 248kB/s
    Requirement already up-to-date: voluptuous==0.11.5 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
    Collecting aiohttp==3.5.4 (from homeassistant)
      Downloading https://www.piwheels.org/simple/aiohttp/aiohttp-3.5.4-cp35-cp35m-linux_armv7l.whl (1.1MB)
        100% |████████████████████████████████| 1.1MB 246kB/s
    Requirement already up-to-date: jinja2>=2.10 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
    Collecting certifi>=2018.04.16 (from homeassistant)
      Downloading https://files.pythonhosted.org/packages/60/75/f692a584e85b7eaba0e03827b3d51f45f571c2e793dd731e598828d380aa/certifi-2019.3.9-py2.py3-none-any.whl (158kB)
        100% |████████████████████████████████| 163kB 1.4MB/s
    Requirement already up-to-date: pyyaml<4,>=3.13 in /srv/homeassistant/lib/python3.5/site-packages (from homeassistant)
    Collecting voluptuous-serialize==2.1.0 (from homeassistant)
      Downloading https://www.piwheels.org/simple/voluptuous-serialize/voluptuous_serialize-2.1.0-py3-none-any.whl
    Collecting async-timeout==3.0.1 (from homeassistant)
      Downloading https://files.pythonhosted.org/packages/e1/1e/5a4441be21b0726c4464f3f23c8b19628372f606755a9d2e46c187e65ec4/async_timeout-3.0.1-py3-none-any.whl
    Collecting astral==1.10.1 (from homeassistant)
      Downloading https://files.pythonhosted.org/packages/ff/5d/261f49822b7f77c265197d46cdbaaaaf06f458734e9ac55a140dd75bdf29/astral-1.10.1-py2.py3-none-any.whl
    Collecting PyJWT==1.6.4 (from homeassistant)
      Downloading https://files.pythonhosted.org/packages/93/d1/3378cc8184a6524dc92993090ee8b4c03847c567e298305d6cf86987e005/PyJWT-1.6.4-py2.py3-none-any.whl
    Collecting requests==2.21.0 (from homeassistant)
      Downloading https://files.pythonhosted.org/packages/7d/e3/20f3d364d6c8e5d2353c72a67778eb189176f08e873c9900e10c0287b84b/requests-2.21.0-py2.py3-none-any.whl (57kB)
        100% |████████████████████████████████| 61kB 1.8MB/s
    Collecting six>=1.4.1 (from cryptography==2.5->homeassistant)
      Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
    Collecting cffi!=1.11.3,>=1.8 (from cryptography==2.5->homeassistant)
      Downloading https://www.piwheels.org/simple/cffi/cffi-1.12.2-cp35-cp35m-linux_armv7l.whl (309kB)
        100% |████████████████████████████████| 317kB 639kB/s
    Collecting asn1crypto>=0.21.0 (from cryptography==2.5->homeassistant)
      Downloading https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
        100% |████████████████████████████████| 102kB 1.9MB/s
    Collecting Unidecode>=0.04.16 (from python-slugify==1.2.6->homeassistant)
      Downloading https://files.pythonhosted.org/packages/31/39/53096f9217b057cb049fe872b7fc7ce799a1a89b76cf917d9639e7a558b5/Unidecode-1.0.23-py2.py3-none-any.whl (237kB)
        100% |████████████████████████████████| 245kB 993kB/s
    Requirement already up-to-date: idna-ssl>=1.0; python_version < "3.7" in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.5.4->homeassistant)
    Collecting yarl<2.0,>=1.0 (from aiohttp==3.5.4->homeassistant)
      Downloading https://www.piwheels.org/simple/yarl/yarl-1.3.0-cp35-cp35m-linux_armv7l.whl (227kB)
        100% |████████████████████████████████| 235kB 545kB/s
    Collecting multidict<5.0,>=4.0 (from aiohttp==3.5.4->homeassistant)
      Downloading https://www.piwheels.org/simple/multidict/multidict-4.5.2-cp35-cp35m-linux_armv7l.whl (301kB)
        100% |████████████████████████████████| 307kB 474kB/s
    Collecting typing-extensions>=3.6.5; python_version < "3.7" (from aiohttp==3.5.4->homeassistant)
      Downloading https://files.pythonhosted.org/packages/0f/62/c66e553258c37c33f9939abb2dd8d2481803d860ff68e635466f12aa7efa/typing_extensions-3.7.2-py3-none-any.whl
    Requirement already up-to-date: chardet<4.0,>=2.0 in /srv/homeassistant/lib/python3.5/site-packages (from aiohttp==3.5.4->homeassistant)
    Collecting MarkupSafe>=0.23 (from jinja2>=2.10->homeassistant)
      Downloading https://www.piwheels.org/simple/markupsafe/MarkupSafe-1.1.1-cp35-cp35m-linux_armv7l.whl
    Collecting urllib3<1.25,>=1.21.1 (from requests==2.21.0->homeassistant)
      Downloading https://files.pythonhosted.org/packages/62/00/ee1d7de624db8ba7090d1226aebefab96a2c71cd5cfa7629d6ad3f61b79e/urllib3-1.24.1-py2.py3-none-any.whl (118kB)
        100% |████████████████████████████████| 122kB 1.4MB/s
    Collecting idna<2.9,>=2.5 (from requests==2.21.0->homeassistant)
      Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
        100% |████████████████████████████████| 61kB 1.7MB/s
    Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography==2.5->homeassistant)
      Downloading https://www.piwheels.org/simple/pycparser/pycparser-2.19-py2.py3-none-any.whl (111kB)
        100% |████████████████████████████████| 112kB 411kB/s
    Installing collected packages: ruamel.yaml, pip, attrs, six, pycparser, cffi, asn1crypto, cryptography, Unidecode, python-slugify, pytz, bcrypt, idna, multidict, yarl, async-timeout, typing-extensions, aiohttp, certifi, voluptuous-serialize, astral, PyJWT, urllib3, requests, homeassistant, MarkupSafe
      Found existing installation: pip 9.0.1
        Uninstalling pip-9.0.1:
          Successfully uninstalled pip-9.0.1
      Found existing installation: attrs 18.1.0
        Uninstalling attrs-18.1.0:
          Successfully uninstalled attrs-18.1.0
      Found existing installation: six 1.11.0
        Uninstalling six-1.11.0:
          Successfully uninstalled six-1.11.0
      Found existing installation: pytz 2018.5
        Uninstalling pytz-2018.5:
          Successfully uninstalled pytz-2018.5
      Found existing installation: idna 2.7
        Uninstalling idna-2.7:
          Successfully uninstalled idna-2.7
      Found existing installation: multidict 4.3.1
        Uninstalling multidict-4.3.1:
          Successfully uninstalled multidict-4.3.1
      Found existing installation: yarl 1.2.6
        Uninstalling yarl-1.2.6:
          Successfully uninstalled yarl-1.2.6
      Found existing installation: async-timeout 3.0.0
        Uninstalling async-timeout-3.0.0:
          Successfully uninstalled async-timeout-3.0.0
      Found existing installation: aiohttp 3.3.2
        Uninstalling aiohttp-3.3.2:
          Successfully uninstalled aiohttp-3.3.2
      Found existing installation: certifi 2018.8.13
        Uninstalling certifi-2018.8.13:
    Exception:
    Traceback (most recent call last):
      File "/usr/lib/python3.5/shutil.py", line 544, in move
        os.rename(src, real_dst)
    PermissionError: [Errno 13] Permission denied: '/srv/homeassistant/lib/python3.5/site-packages/certifi-2018.8.13.dist-info/DESCRIPTION.rst' -> '/tmp/pip-wv7pcbvu-uninstall/srv/homeassistant/lib/python3.5/site-packages/certifi-2018.8.13.dist-info/DESCRIPTION.rst'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/srv/homeassistant/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
      File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/install.py", line 360, in run
      File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_set.py", line 778, in install
      File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_install.py", line 754, in uninstall
      File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_uninstall.py", line 115, in remove
      File "/srv/homeassistant/lib/python3.5/site-packages/pip/utils/__init__.py", line 267, in renames
      File "/usr/lib/python3.5/shutil.py", line 559, in move
        os.unlink(src)
    PermissionError: [Errno 13] Permission denied: '/srv/homeassistant/lib/python3.5/site-packages/certifi-2018.8.13.dist-info/DESCRIPTION.rst'

As you can see at the end of this output I got a permissions error. But HA appears to be properly updated and working properly, as far as I can tell so far. As you can also see from the above, I ran this as my ‘hass’ user which I am 99% certain is the correct user (the user that installed HA).

So I have two questions:

  1. Can anyone tell me from this output what might be broken right now? As I said, at quick look all seems to be working well.
  2. Any thoughts on the cause for this error?

Well, roughly an hour after doing the update that led to the above OP, the web interface again told me there was an available update. Somehow, this time when clicking the link to get update help I was taken to a different page; https://www.home-assistant.io/docs/installation/updating/.

That page warned me about permissions errors if I didn’t update as the right user (which I think I did) and also told me to review the specific instructions for my installation type in a python virtual environment: Virtualenv.

Then I followed the rest of the update instructions on the Virtualenv page (which were actually a bit simpler) and had no errors.

Not sure what happened there and I will still welcome any educational comments the community would like to share. However, this is no longer an immediate issue for me but just a potential learning opportunity.

Well, I thought all was good just because the second update attempt worked without error. But it turns out that HA is now not accessible from my browser (it is running on the server per systemctl status). I’m getting an Apache error of Service Unavailable. Since I am proxying HA through Apache to server HA on 443 I have several things to look at to understand this new problem.

It is too late now. Maybe tomorrow I will have time to troubleshoot.

[sigh]

I haven’t seen hass used as a username since the early aio configurations. Are you sure you installed with this username?

You forgot sudo before this command so you got “permission denied”.

I am sure. A lot of the tutorials use some longer variant but I didn’t want to be typing so much so I just used hass for the user name (and also the service name) when I did my installation.

Thanks for the reply, but that doesn’t seem to have been the issue. In fact none of the tutorials use sudo for that line as they have you change to the user that installed HA.

This last problem was apparently just me not being patient enough coupled with my being a bit too tired at that point.

All was fine after that second update. I am guessing that it just took a longer than usual time for the service to become available after doing that update when the HA had not been updated in quite a long time.

For whatever help it may provide others, here are the steps that worked like a charm to update my HA. Note that the user name that I used to install HA was hass and I named the service hass. Also, this is an installation using a virutal Python environment on a Raspberry Pi running Raspbian.

# Updating Home Assistant
# Login as 'pi' or whatever your normal user account is
sudo systemctl stop hass.service
sudo -u hass -H -s  # change to user 'hass'
cd /svr/homeassistant  # location may vary depending on specific installation
source bin/activate  # start python virtual environment (should see prompt change)
python3 -m pip install --upgrade homeassistant
exit  #exit python virtual environment
sudo systemctl start hass.service
sudo systemctl status hass.service  #confirm service started