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

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.

36 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!

9 Likes

Thanks for the detailed explanation Matthew! I’m booting from an M.2 drive connected to the USB port of a RPi4 Model B, and had the same issue. I’m running HA OS 6.3.

Confirming this fixed my issue. Thanks again! :slightly_smiling_face:

These instructions are still working on new install on Raspberry Pi 4 on Home assistant 7.1
It took 4 days to find these instructions and they had it working in 20 mins
Thanks for the great instructions

Wow works like a freaking charm. TYTY RP 3 sat here for weeks. YOU DA GOD, I am not worthy!

genuis!!!thank you!!!

This solution is definitely promising for me, except the changes I try to make in nmcli don’t seem to stick. As soon as I get back to HA CLI, either before or after a host restart, the nameserver address hasn’t changed and going back into nmcli shows the old configuration again. Anyone have any thoughts? I’m running HA OS on a Hyper-V virtual machine…

Seconding the post above me, though going back to nmcli shows that I’ve changed it to 1.1.1.1 (so it’s just not showing up in HA). Running HA OS on Oracle VM.

I had the same issue but looked at my router settings (a cheap TP link provided by the internet company). My Primary DNS server was only set to 192.168.1.1 (the address of the router it self). Changing this to google (8.8.8.8) and rebooting also worked.

Is it possible to do this over SSH? I’m running headless. When I try to connect to it with PuTTY, it says connection refused. I was hoping to be able to access it that way because I don’t have the ability at the moment to connect a monitor.

1 Like

Could you make it work? Having the same problem here

@aecfxi Thanks for this guide. really clear. got me past the loading screen. I had to do this twice but it was a me (or rather my equipment issue) as as soon as I had resolved the ipv4 dns issue my sd card was having a bad day. I’ve bought a new 32gb sandisk one and redid everything. It has definitely worked. Very happy that i can move on to trying to save some money by storing my solar energy now.

How do I change the screen resolution on Odroid C4?? really, REALLY tiny!! seems like it is on 4K!!
put SD in my windows machine, NO config.txt file is there! any CLI command to get something like
“raspi-config”?

Home Assistant should boot with a configurator on the actual host (Rpi or whatever) before going on… that would help a LOT! like a step by step configurator for network, screen resolution, etc!

Thanks. This solved the problem to me. In my case DNS name to be set had to be the my PIHole DNS address

Adding my two cents. Loading HAOS on an HP t620 with Ubuntu. Had to ignore auto dns. Had to set the dsn twice (used 1.1.1.1), as it seemed not to stick the first time. walked away and did chores for the day. It finally went through and let me register. Thank you!!

Is this same fix applicable to Pi3+?

I’m having the same issue in which “network info” still shows 192.168.1.1. When I do a host restart, I get the same 500 error. Someone else posted you had to do one extra command:

So after the command described in the article:
set ipv4.dns 1.1.1.1
additionally enter:
set ipv4.ignore-auto-dns yes

After doing that I no longer got the 500 errors.

1 Like

This was a live saver. Thanks a lot.

I’ll explain my situation, so that someone might recognize it.
I bought a bigger sdcard. Flashed it with home assistant OS. Powered up the Raspberry Pi 4. Everything went ok. After A few minutes (10), I got to the onboarding screen. There I choose to upload a backup. Fifteen minutes later I could log in with my existing credentials at the_ip_adres:8123 So far so good… I was pleased. Then All my addons where grayed out. But the log stated they actually started. I read somewhere here to restart the host.
I did…
Then the addons weren’t grayed out anymore. I tried to install an new addon but the system said I couldn’t connect. (to the internet) I tried to install addguard and had to put Home Assistant on a fixed IP adres. So I did. Then restarted the host.

Then things went wrong.
The whole system hung at the ‘preparing home installation’ screen. I waited 45 minutes and then I found this post.

I did all steps.
I did a last check of the network info and supervisor log like the text says. Network info didn’t state that the dns, so I feared all steps failed. But the supervisor log showed all green text and no red errors anymore.
On my pc I could navigate to home assistant and this time it proceeded to the install screen. So I reckoned that everything was ok, allthough the network info didn’t state the dns.

I put back the backup. It took 20 minutes. And after that all seems to work flawless.

Thanks for this post. It helped a lot.

1 Like