Running hass on bare metal in the background constantly restarts

I’ve got an interesting issue.

I’m trying to run Home Assistant on my server that runs about a billion services in my house, and if i run it from the command line, it works perfectly, and everything’s happy.

If I try to run it in the background as a service (either supervised or not) with the same parameters, it constantly restarts.

If I run it with -v to get an idea of what’s going on, the consistency I’m seeing before each restart is:

2024-07-15 11:05:01.666 INFO (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Pool recreating

And then a bunch of ‘Processing expected disconnect for ESPHome API’ or my ESPHome devices, and then it restarts.

Interestingly, it’s like it’s intentional on Home Assistant’s part, as it restarts itself and works fine (the supervisor/service isn’t what’s restarting it), but it just keeps restarting over and over.

But if I run it in a terminal window, it will run indefinitely without an issue.

The only differences I can see between the running processes is /proc//fd when I run it as a backgrounded service, FDs 1, and 2 are log files, and when I run it from the commandline, the FDs are /dev/pts/, as one might expect.

Anyone have any suggestions?

Would you mind being a bit more precise, please?

What HA installation do you have? A service would mean Core (plain python venv), but then you speak about “supervised”. Note that only Core is not using docker.
How do you run it as a service? systemD, systemV, ampersand, …?

I’m running only core with a python-venv.

When I say unsupervised, I mean starting it with start-stop-daemon from openrc.

When I say supervised, I mean starting it with OpenRC’s supervise-daemon, which keeps hass itself in the foreground, and supervise-daemon itself backgrounds and monitors it.

Using Gentoo? No clue, I haven’t used Gentoo in probably 20 years :slight_smile:

Interestingly, I tried starting it from a console, then ctrl-z, bg, disown, and it still runs perfectly.