You know those moments when you screwed up and you see yourself clicking on the button you shouldn’t click, well, that was me few days ago.
What happened (blame me)
I was manually removing devices and entities from core.entity_registry and core.device_registry files and as I press the restart HA button on the browser tab and get back to the VS Code tab (and see the lost connection popup), I noticed I forgot to remove one comma
F********k, it’s too late. Useless to say that HA did not reboot after that.
What have I done to try fixing it
Power down (manually) the raspberry pi
removed the SD Card
installed the tool Linux File Systems for Windows by Paragon Software
using the app, mounted the ha drive into windows
edited both files using Notepad++
saved files
unmounted sdcard drives
inserted sdcard back into raspberry pi
powered it on
After doing that, the HA did not boot/restarted, nor the device (that is connected with a network cable directly to the ISP router) got show up on the router connected devices. Pinging fails, as well as swearing out loud.
.
. Could I have corrupted the sdcard?
. Any ideas on what could I do to try recover the HA installation?
.
.
Thanks in advance for your time and help!
if it didn’t work, maybe there is backup on the SD drive you could copy?
In that case, just place a new HA image on the SD (or use another one), and choose ‘restore from backup
Since you are asking, I’ll assume that you did not do a recent backup.
I have screwed up my Home Assistant installation several times due to incompetence on my part. In every case the nightly backup saved my collective goose.
Since it’s been years since I had Home Assistant on a Raspberry, I am only speculating on the procedure. But if it appears that the installation is truly hosed, and I don’t know how you installed Home Assistant, put the SD card into a PC and save all of the .yaml files in the config and esphome folders. If you are using Node Red, save the flows.json file from the node-red folder.
Then on a new SD card, start over.
Then, on the new, working installation, copy the old configuration.yaml file and reboot. Now comes the fun part. Unless your installation is pretty simple with few devices or integrations, you will start getting errors. Deal with each error one at a time. It may be as simple as reinstalling integrations or copying the appropriate yaml files.
Not that my installation was something out of this world, but we’re talking of 50-60 individual devices, ±40 automations, and a half-dozen lovelace panels that took ages to mature and complete (including 4 3D picture-elements that should have about 100 elements/items on it).
I have the 3D floorplans, but all the HA work is on the ha files.
.
.
My frustration at this point is that I don’t know what error is happening. Is the sdcard corrupted? Is there another typo on any config file?
Is there any way to debug or troubleshoot? Is there any way to connect the raspberry pi to a screen/tv? Would it “do” anything? Are there any booting screens that could show where it crashes?
Have you looked up the error messages when booting? (SSH into system if you have it unlocked or otherwise connect a screen to your RPI)
Are you sure there are no backups whatsoever on the SD card or on any cloud (OneDrive / Google Drive), in other words you are sure you didn`t install a add-on in the past which does this for you? If not then copy all content from SD card to windows PC to restore most of configuration. Best to install “extras” which are needed for your config to work as new from HACS because then they are correctly “seen” and maintaned with updates in the future.
Hope this helps and see this as some good learning moments for the future.
Strange thing that ha doesn’t start after e config fail.
First of all. It shouldn’t allow reboot. But that’s not safe as you won’t catch power failures.
And if it for some reason does allow reboot. The last few times this happened to me it booted into safe mode.
So I think something else broke here
Never the less. You should copy your sd card. Reinstall and check for a backup. Or else restore all files from /config including hidden once.
Then search the forum for an add on like Google drive backup.
Absolutely. The original card is (apparently) your only backup. If someone who knows the OS on Raspberry better than me (almost everyone) suggests a way to reinstall the OS in-situ, then you are safe. Micro SD cards are relatively cheap. Buy 5 or 10.
Never burn a bridge until you absolutely never need it again.
Aren’t those validations (that allow or not to reboot) only validating the configurations yaml files ?
Does it also validate the core.entity_registry and core.device_registry files?
I was trying to remove the dead bluetooth devices/entities that I had.
I don’t want to remove the integration because aside from the 10-20 dead devices, I have another 20-30 bluetooth devices correctly configured. And besides doing it manually, I haven’t found any other way of doing it
I was hoping that “Starting kernel …” means that at least your Linux system is still starting and there is another error If the system stays in this state, it’s still not good, but it could mean that only the underlying Linux system is broken and not your HA installation.
How did you install HA? Do you use Home Assistant OS?
I’m not familiar with Home Assistant OS and the file structure, but I would suggest the following process: