supervisor icon indicating copy to clipboard operation
supervisor copied to clipboard

ha network update wlan0 without required params causes internal server error

Open aambroze opened this issue 11 months ago • 4 comments

(report re-written to reflect actual issue, pointed out by @agners)

Configuring wlan using ha network update without providing all required parameters causes internal server error with no feedback to the user.

image image

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Steps to reproduce the issue

  1. Try to configure wlan adapter from shell without providing required parameters
  2. Internal server error occurs. No feedback for the user about required parameters.

Anything in the Supervisor logs that might be useful for us?

24-03-22 17:32:33 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from core_ssh
24-03-22 17:32:33 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from core_ssh
24-03-22 17:32:33 INFO (MainThread) [supervisor.api.middleware.security] /host/info access from core_ssh
24-03-22 17:32:33 INFO (MainThread) [supervisor.api.middleware.security] /core/info access from core_ssh
24-03-22 17:32:38 INFO (MainThread) [supervisor.api.middleware.security] /network/info access from core_ssh
24-03-22 17:33:03 INFO (MainThread) [supervisor.api.middleware.security] /network/interface/wlan0/update access from core_ssh
24-03-22 17:33:03 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 189, in block_bad_requests
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 205, in system_validation
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 272, in token_validation
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/middleware/security.py", line 283, in core_proxy
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/utils.py", line 63, in wrap_api
    answer = await method(api, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/api/network.py", line 222, in interface_update
    await asyncio.shield(self.sys_host.network.apply_changes(interface))
  File "/usr/src/supervisor/supervisor/host/network.py", line 221, in apply_changes
    settings = get_connection_from_interface(interface, self.sys_dbus.network)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/dbus/network/setting/generate.py", line 141, in get_connection_from_interface
    "ssid": Variant("ay", interface.wifi.ssid.encode("UTF-8")),
                          ^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'ssid'

System Health information

System Information

version core-2024.3.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.6.20-haos
arch aarch64
timezone Europe/Warsaw
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4946
Installed Version 1.34.0
Stage running
Available Repositories 1401
Downloaded Repositories 9
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 12.1
update_channel stable
supervisor_version supervisor-2024.03.0
agent_version 1.6.0
docker_version 24.0.7
disk_total 56.6 GB
disk_used 6.9 GB
healthy true
supported true
board odroid-n2
supervisor_api ok
version_api ok
installed_addons Studio Code Server (5.15.0), Terminal & SSH (9.10.0), Cloudflared (5.1.6), Home Assistant Google Drive Backup (0.112.1), File editor (5.8.0), Mosquitto broker (6.4.0), Zigbee2MQTT (1.36.0-1)
Dashboards
dashboards 8
resources 2
views 7
mode storage
Recorder
oldest_recorder_run 14 marca 2024 o 14:57
current_recorder_run 22 marca 2024 o 17:32
estimated_db_size 40.30 MiB
database_engine sqlite
database_version 3.44.2

Supervisor diagnostics

config_entry-hassio-8302e49fdefff51c8551e0885c7aa39f.json

Additional information

No response

aambroze avatar Mar 22 '24 16:03 aambroze

The network configuration has no WiFi mode/SSID/authentication information, that is why that stack trace is caused.

Granted, Supervisor should handle this a bit more gracefully and send back an appropriate error.

But when passing WiFi information (--wifi-auth, --wifi-mode, --wifi-psk and --wifi-ssid), things should work again.

agners avatar Mar 27 '24 15:03 agners

I’ll try.

Even if that’s the case and it’s about providing proper network details and not graceful response…

Is it expected that my network details can be wiped during update from 11.5 to 12.1? Maybe that’s my actual issue ?

aambroze avatar Mar 27 '24 18:03 aambroze

@agners Thank you for suggestion.

I've connected using Ethernet and successfully enabled and connected to WiFi.

This leaves us with two issues:

  • very ungraceful Supervisor behavior (crash/500 instead of simple information about required params),
  • updating HAOS from 11.5 to 12.1 wipes WLAN details.

I'll redact my report to reflect the first issue. Where should I report second one?

aambroze avatar Mar 28 '24 20:03 aambroze

  • updating HAOS from 11.5 to 12.1 wipes WLAN details.

I'll redact my report to reflect the first issue. Where should I report second one?

This would go to the Home Assistant Operating System repository.

agners avatar Apr 08 '24 12:04 agners

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 08 '24 13:05 github-actions[bot]