home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.17k stars 31.14k forks source link

Home Assistant Install stuck at Create User Account #122356

Open jksmurf opened 4 months ago

jksmurf commented 4 months ago

The problem

I am not sure if this is a bug or by design, but I spent a good few hours trying to get past this, so my apologies if it is supposed to be like this. The issue is that following the install and the “this will take 20 minutes" message, you are presented with the "Create User Account" form.

I wanted my name to be different to the user so I put (example only) "John" for my name and "ToadsHA" for the user, filled in the Passwords and tried to click the Create Account button (which was blue), but it simply did not go any further, it was like the button was active but not connected to anything (a next page). I tried many, many times, redoing the SD each time, using the RPi Imager Software, to no avail.

The fellow in the link below had the exact same symptoms but suggested it was a different solution, I just included it so the screen is visible and so you can see he is "Dave" and "dave" as user.

https://community.home-assistant.io/t/onboarding-cant-get-past-create-user-account/276945

So what finally got me past this "Create User" screen, having googled a lot and stared at that guy's issue for a while, was to select a "username" which was the lowercase version of my "Name" and hey presto, I could go to the next screen immediately.

What version of Home Assistant Core has the issue?

12.2, 12.3, 12,4

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS; RPi4 4GB, wired Ethernet, 64GB SD Card

Integration causing the issue

onboarding

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 4 months ago

Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration (onboarding) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `onboarding` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign onboarding` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


onboarding documentation onboarding source (message by IssueLinks)

Baxxy13 commented 4 months ago

The "Username" must be written completely in lower case. For your example: Name: John Username: toadsha

Any capital letter in the Username prevents from proceeding.

The Dave/dave example from the link works here without any problems.

This restriction should be mentioned...

Or maybe the Username input should automatically converted to lowercase.

jksmurf commented 4 months ago

Thank you for clarifying, much appreciated and I agree with all your suggestions.

Will someone action this directly or should i make the suggestion in the onboarding suggestions forum?

agners commented 4 months ago

Hm, this is indeed weird UX on the on-boarding

Screencast from 2024-07-25 10-02-39.webm

The Core logs show the following error:

homeassistant.auth.providers.homeassistant.InvalidUsername: Username "Test" is not normalized. Please make sure the username is lowercase and does not contain any whitespace
2024-07-25 08:02:43.455 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/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 83, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 74, in wrapper
    return await method(view, request, data, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/onboarding/views.py", line 155, in post
    await provider.async_add_auth(data["username"], data["password"])
  File "/usr/src/homeassistant/homeassistant/auth/providers/homeassistant.py", line 328, in async_add_auth
    await self.hass.async_add_executor_job(self.data.add_auth, username, password)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/auth/providers/homeassistant.py", line 198, in add_auth
    self._validate_new_username(username)
  File "/usr/src/homeassistant/homeassistant/auth/providers/homeassistant.py", line 247, in _validate_new_username
    raise InvalidUsername(
homeassistant.auth.providers.homeassistant.InvalidUsername: Username "Test" is not normalized. Please make sure the username is lowercase and does not contain any whitespace
jksmurf commented 4 months ago

Exactly. That's exactly what I mean, the video shows it perfectly, thank you.

GoBig-Or-GoHome commented 3 months ago

Thank you for posting this! After going around in circles I came across this and I was able to set up my account.

hernot commented 3 months ago

The all lower case username is not the only issue which makes home assistant on boarding process behave as if stuck. The same occurred to me when trying to select my country using non English interface language. The country name started in this case with the special character Ö. Switching interface language to English and selecting the English name allowed to proceed.

The most annoying in this process was not that user name must be all lowercase or that special character in country name is not accepted (*) but that there was no indication at all that some inputs could be not appropriate, no label telling username must be all lowercase, no label telling country name may not contain non ASCII characters.

So please consider to add markers indicating improper input preventing the onboarding process to continue to increase user experience.

(*) Seems as if ha attempts to set the translated name as country name

klein0r commented 1 month ago

Any capital letter in the Username prevents from proceeding.

But all users are created in the background. When hitting "create account" several times, you get a bunch of users (without usernames). The first one is the owner!

This leads to the issue, that you are not the owner of the system after onboarding is completed (since the first user has no username). My solution was: Edit /config/.storage/auth manually and set is_ower to true for the correctly created user.