Hi, today I was trying to setup Home Assistant to be accessible outside of my network via reverse proxy (not interested in discussing proxy vs VPN/tailscale, etc for remote access). I lost access to the web UI because I misconfigured configuration.yaml. I've now regained access, and I'm going to make a straightforward post that I wish I would have found when I was trying to figure it out. Props to this thread for the instructions, I just want to make another post so somebody else can find the information easier.
My scenario:
Running Home Assistant OS on Unraid via VM
Reverse proxy is managed by NGINX Proxy Manager. Added new proxy host to NGINX, configured CNAME to my domain via Cloudflare, etc.
Was updating HA configuration.yaml to allow for external network access by adding addresses with the 'trusted_proxy' line and also setting 'use_x_forwarded_for' to true. I added the internal range (x.x.x.0/24) but mistakenly forgot to add host. Unraid lives on x.x.x.1, HA on x.x.x.2. I should have added x.x.x.1 to 'trusted_proxy' (I think).
Did not have access to configuration files via SMB share
I updated configuration.yaml, restarted HA, and subsequently lost access to the web interface as I hadn't properly added the host address and HA was not allowing access. I did not want to nuke my setup and thus needed to edit configuration.yaml to remove the network lines I just added. I did not have external access to the VM filesystem. I was able to edit configuration.yaml via Home Assistant console from VNC in Unraid's VM manager.
Steps to fix:
While Home Assistant is running, access console via Unraid VM manager by clicking your HA VM in Unraid to view options, and click 'VM Console(VNC)'. This should launch a new web window with the HA console / hass.io CLI. This is where we will fix the configuration.yaml file.
Type 'login'
Type 'cd /mnt/data/supervisor/homeassistant'
Type 'ls' to list the files in this directory. You should see ‘configuration.yaml’ in this directory.
Type 'vi configuration.yaml' to enter edit mode for the config file. From here you can thumb around to delete/modify the appropriate lines. In my case I deleted the new network lines. Reference the guide below to navigate between commands.
Once edited and saved (you must save!) then restart VM via Unraid UI.
VI editor commands: i — Switch to Insert mode. Esc — Switch to Command mode. :w — Save and continue editing. :wq or ZZ — Save and quit/exit vi. :q! — Quit vi and do not save changes.
Hi. I updated ha os to 10.4 and now i don't have WIFI or LAN connection, so i can't revert to 9.5 If i select 'Slot A (OK=1 TRY=0)" it boots (in last known good boot?). But if machine restarts it boots in "Slot B" again. What should i do?
Running HA OS on mini pc.
After I installed home assistant (via Ethernet) and can use the browser to view it, I want to install WiFi. I can't do this from HA CLI. How do I get out of it?
First of all, credit to these two folks: (thread 1) (thread 2)
I spent too much time trying to figure out how to get this done, and in the end it takes very little to do it.
It also includes instructions at the end that can address the issue on any install that is not booting to the latest OS after an update. Anyway, I hope this is helpful!
NOTE: This was written by me, for me. So key presses or hardware may vary in your use case!
Here's the stuff from above for copying/pasting
LINK referenced early in image.
Code from above:
sudo mount /dev/sda9 /mnt sudo apt install grub2 sudo grub-install --compress=xz --root-directory=/mnt /dev/sda --force cat <<! | sudo dd of=/mnt/boot/grub/grub.cfg set root=(hd0,1) configfile /efi/boot/grub.cfg !
grub.cfg changes:
load_env --file (hd0,gpt1)/efi/boot/grubenv save_env --file (hd0,gpt1)/efi/boot/grubenv A_TRY A_OK B_TRY B_OK ORDER MACHINE_ID
After GRUB2 was introduced last month in OS 8.0, anytime I reboot the host voluntarily or due to a power disruption, it loads OS 7.6 despite having 8.1 installed.
It's annoying and a cause of concern because every time it happens, I have to hook the box to a monitor and manually select Slot B (HA OS 8.1) to load that instead of HA OS 7.6 under Slot A. What if I'm out of town..etc.
See this for reference
Thank You!