core: Proxmox VE integration - 401 Unauthorized: permission denied invalid PVE ticket

The problem

Exactly two hours after restarting HA, Proxmox integration no longer works with error: 401 Unauthorized: permission denied - invalid PVE ticket

Environment

  • Home Assistant Core release with the issue: 0.111.3
  • Last working Home Assistant Core release (if known): 0.110.x
  • Operating environment (Home Assistant/Supervised/Docker/venv): Home Assistant
  • Integration causing this issue: Proxmox VE
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/proxmoxve/

Problem-relevant configuration.yaml

proxmoxve:
  - host: <ip address>
    username: <user>
    password: <pwd>
    verify_ssl: false
    realm: pam
    nodes:
      - node: pve
        vms:
          - 100
          - 102
          - 103
        containers:
          - 101

Traceback/Error logs

Logger: homeassistant.helpers.entity
Source: components/proxmoxve/binary_sensor.py:96
First occurred: 17:40:58 (1026 occurrences)
Last logged: 19:53:10

Update for binary_sensor.pve_hassio_running fails
Update for binary_sensor.pve_omv_running fails
Update for binary_sensor.pve_hassio_test_running fails
Update for binary_sensor.pve_lamp_running fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 472, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/proxmoxve/binary_sensor.py", line 83, in update
    item = self.poll_item()
  File "/usr/src/homeassistant/homeassistant/components/proxmoxve/binary_sensor.py", line 96, in poll_item
    .get(self._item_type.name)
  File "/usr/local/lib/python3.7/site-packages/proxmoxer/core.py", line 105, in get
    return self(args)._request("GET", params=params)
  File "/usr/local/lib/python3.7/site-packages/proxmoxer/core.py", line 94, in _request
    resp.reason, resp.content))
proxmoxer.core.ResourceException: 401 Unauthorized: permission denied - invalid PVE ticket - b''

Additional information

HassOS is a proxmox virtual machine

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (7 by maintainers)

Most upvoted comments

found and have a fix for the issue. The library was renewing the authentication ticket, but would only send the original ticket (the session was not pulling the cookie from the auth).

I’ll get a new version of the library out and then update the integration to use the fixed version (and do proper testing on it).

It looks like something weird is happening with the library renewing the ticket. I think it is an issue with the library working within the async worker threads, so each thread is trying to renew and PVE is not liking it. I’ve got a test running now with only one container being polled. If that doesn’t fail, I will know what the issue is. I just have to wait 2 hours every time I change something. I can just revert back in the integration’s renewal code, but I would like to try to get it working with the library’s built-in renewal.

I’ll look at it after work today. I’m planning to add API token authentication for this integration to try to alleviate this problem.