Solution to a hanged "Preparing Home Installation" screen during new install on a Raspberry Pi 4 (DNS fix)

Tags: #<Tag:0x00007fc417832c90> #<Tag:0x00007fc417832ad8>

This is a guide for new users who are trying to install Home Assistant 5.10 on a Raspberry Pi 4 using an SD card image but who are stuck on the “Preparing Home Assistant (this can take up to 20 minutes)” screen.

I assume you have already taken these steps:

  1. Prepared a Raspberry Pi 4 with a wired ethernet connection to your router
  2. Have a microSD card you’ve imaged using a HAS OS 5.10 img.xz file
  3. You’re able to view the “Preparing Home Assistant” page in a browser by going to your device’s local IP address followed by :8123 (my device’s URL was 192.168.1.15:8123), or through the Home Assistant app, and the page just stays like this forever.

This is happening to a lot of people because of an issue with the default DNS address, and I will walk through the fix (other descriptions of how people fixed this issue were not adequate for me).

First, plug your Raspberry Pi into into a screen and plug in a keyboard. You may need to turn your pi off and on again to get the screen to work, and you may also need to edit the config.txt file in the first SD card partition (or whatever partition has a config.txt file in it) to get a high resolution connection to a TV or monitor. Follow the directions under the “Modifying the Boot Configuration to Set the Resolution” heading on this page if you need to increase your screen resolution to see the full output of commands.

Next, boot up your Raspberry Pi. Wait until you can see the “Preparing Home Assistant” screen in your computer’s browser or your phone’s app. The screen connected to your Raspberry should show a login prompt. Enter “root”. There is no password. If you get a “emergency console” message, you logged in too quickly after the device booted up. Wait a minute after the login screen appears for the CLI you are logging into to be prepared.

Once you are in the ha > CLI, check the logs to confirm there is a network problem. Enter the command supervisor log and the output should include red blocks of text with a “500 server error”. This is likely the DNS problem we will solve. Enter network info and look at the details of eth0. the IPv4 nameserver address that’s listed should be an appropriate address. If there is no address listed, or if the listed address is 192.168.1.1 as it was in my case, or if it is otherwise not correct, this is the reason for the installation error.

An explanation about DNS addresses, as I did not understand them initially. DNS and nameserver both refer to an IP address on the global internet that provides the service of taking a text URL like google.com and translating it into a machine-readable IP address. The IP address 1.1.1.1 is a popular nameserver address provided by cloudflare. If you log into your router and look around, you should see the DNS address(es) your router is using, which is typically associated with your ISP. Individual devices on your local network like your computer and your Home Assistant still need the global internet IP address for a nameserver in order to resolve global internet URLs. 1.1.1.1 or the DNS address listed in your router’s settings are both acceptable nameserver/DNS addresses to set your home assistant to. (note this may not be exactly correct but this guide and an external DNS server address like 1.1.1.1 will solve the issue regardless)

A bugged problem while fixing the DNS problem: using the same ha > CLI you’re in on your home assistant, the command network update eth0 --ipv4-nameserver 1.1.1.1 should set your Home Assistant’s nameserver address to the IP address you provided (in this case 1.1.1.1). This command does not work, at least not for me. Perhaps this bug is related to the bug where the DNS address is initially populated with an incorrect value that we are working to fix. Regardless, we will need to set the DNS with an alternate method using nmcli in a different container.

Change containers by using the command login. This should bring you to a different # CLI. The command nmcli con will display the internet connections, take note of the first entry in green and its exact name: “Supervisor eth0”. Now enter nmcli con edit “Supervisor eth0” to enter the nmcli environment. Enter the command print and it will show a large output, and if your screen is high enough resolution you should make out the ipv4.dns value. Enter the command remove ipv4.dns in order to remove all entries from the ipv4.dns value. Then use the command set ipv4.dns 1.1.1.1 to add a correct DNS address to the network configuration, using 1.1.1.1 or the DNS address in your router’s settings. Enter print again and confirm the ipv4.dns value is correct. Finally enter save and quit to apply the changes and leave the nmcli container.

Before the changes take effect, we need to restart home assistant. Enter the command exit to be returned to a login prompt, and use “root” again to enter the ha > CLI we were in before. Once you’re here, enter the command host restart and then wait for several minutes for your device to reboot. This command will not give any immediate output, but the device will eventually restart.

Once the device is restarted, verify the problem is solved. Wait for several moments before logging on as root, and then once you’re in the ha > environment, use the command network info to confirm the updated DNS address is now shown. Then enter supervisor log and confirm there are no longer blocks of red text with “500 server error” in them.

At this point load up home assistant in a computer browser or through the app and wait for home assistant to complete preparations. In my case it finished much faster than 20 minutes and I was able to complete the rest of the initial setup from my browser, and I now have had a working home assistant server.

Good luck to everyone, I hope this can help some people searching for a solution and clarify some of the bugs we have.

4 Likes

Just used your post to solve this problem for me! Thanks!

1 Like

I have been fighting this issue for several months and none of my Google searches pointed me to this INCREDIBLY well put together walkthrough. Thank you for putting this together!! This solved the problem I was having.

1 Like

Thanks so much for sharing those detailed instructions! It led me on the right path. However, after applying the settings I had still two DNS servers: 192.168.1.1. AND 1.1.1.1
Only after setting ipv4.ignore-auto-dns to yes it started working. So after the command described in the article:
set ipv4.dns 1.1.1.1
additionally enter:
set ipv4.ignore-auto-dns yes

Good luck and thanks again Matthew!

1 Like