(I screwed up) HA does not boot after restart

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 :face_with_symbols_over_mouth:
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.
.
.
:question: Could I have corrupted the sdcard?
.
:question: Any ideas on what could I do to try recover the HA installation?
.
.
Thanks in advance for your time and help!

Take out the SD, look up and open core.entity_registry and core.device_registry files, and edit manually?

I already did that, mounted the sdcard and edited both files using Notepad++.

Any special procedure besides unmounting the sdcard before putting it back into the raspberry pi??

not that i am aware of….

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 :wink:

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.

When all is done, begin a backup protocol.

@stevemann thanks for your reply.

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?

check the SD for a file called ‘home-assistant.log.fault’ maybe it will shine some light :wink:

You haven’t? You plug in a monitor and keyboard. Home Assistant will boot into a terminal UI.

You haven’t?

Dohhhhh! :innocent:
(I didn’t knew I had a mini-hdmi cable )

Does this gives us any hint on the issue/solution?

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.

1 Like

@dutchdevil-83 You bet this is a good learning moment for the future :confused:

@stevemann why did you recommended to use a new SD card for the new installation and not reuse the existing one? Any special reason?

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.

1 Like

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.

1 Like

I use the Samba Backup add-on. It makes a full backup every morning at 1AM on a NAS. Google Backup is good if you don’t have an NAS.

1 Like

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?

no, it doesn’t…

Moreover, you are not supposed to edit them manually, that is also why they are in a hidden folder :thinking:

This is still the bootloader trying to start linux. The last message is “Starting kernel …” which is quite good. Do you get more messages after that?

Hi @j_d thanks for your message.

No, it stays like that. Left it like that for about 3-4 hours and it didn’t move.

Really? Why is that ( #HopeIsBack )

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 :confused:

I was hoping that “Starting kernel …” means that at least your Linux system is still starting and there is another error :frowning: 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:

  1. Get a new SD card
  2. Install Home Assistant OS
  3. Try if this boots
  4. If this works, copy the data from your old SD card to the new. The data should be on a separate partition: I'm trying to find my files on the host or SD card. Where are they? - Home Assistant