Home Assistnat Keeps Restarting

I recently migrated my HA instance to a Proxmox VM and I am having stability issues. The VM doesn’t seem to use up too many resources. CPU and RAM are reasonable. Basically what is happening is HA just restarts randomly. You can see here that happens a lot:
image

Each one of the color changes is it restarting. The VM itself stays running. I don’t see anything obvious in the log, but of course that gets wiped each time it restarts. I have no idea why this could be happening or where to look to troubleshoot.

Any ideas or pointers on where to look?

1 Like

You could do a running backup of your logs. I have a script that runs every 30 minutes that reads the log into a daily log file and clears the primary log. I did this for two reasons, one was to keep the log to a reasonable level so I can open it up in BBEdit easily but also in case I restart I don’t lose my logs. There’s no reason you couldn’t dial that in to run more often as you diagnose your issue.

I use a shell command to run this bash script that I wrote:

# logappend.sh
#
# This bash script will read the home-assistant.log file and APPEND todays
# log in /config/logs then clear the home-assistant.log, allowing the user
# to periodically clean up their log file throughout the day.
#
# @version: 1.0.0

# Create logs directory if it doesn't exist
mkdir -p "/config/logs"

# Current date
CURRENTDATE=`date +"%Y-%m-%d"`.log

# Summarize for debugging
echo Current Log File Name is: ${CURRENTDATE}

# Pipe current log into its file
cat home-assistant.log >> /config/logs/${CURRENTDATE}

# Clear the home-assistant.log
truncate -s 0 "/config/home-assistant.log"

The at midnight I do a clear log using a similar script:

# logreset.sh
#
# This bash script is intended as a midnight reset to clean the log
# each day.  It will first take all of the current contents of the
# home-assistant.log file and append YESTERDAYS log (considering
# a midnight action represents a fresh log for TODAY) then clear the
# log.  Additionally it will create a new log file for TODAY so we
# can have that as a reference.
#
# @version: 1.0.0

# Create logs directory if it doesn't exist
mkdir -p "/config/logs"

# Current date
CURRENTDATE=`date +"%Y-%m-%d"`.log

# Calculate yesterday with BusyBox
YESTERDAY=`date +%s`
YESTERDAY=$(($YESTERDAY - 86400))
YESTERDAY=`date -d@${YESTERDAY} +"%Y-%m-%d"`.log

# Summarize for debugging
echo Current Log File Name is: ${CURRENTDATE}
echo Yesterday Log File Name is: ${YESTERDAY}

# Pipe yesterdays log into its file
cat home-assistant.log >> "/config/logs/${YESTERDAY}"

# Create new file for today (in case we want to do regular purging throughout the day
touch "/config/logs/${CURRENTDATE}"

# Clear the home-assistant.log
truncate -s 0 "/config/home-assistant.log"

To call it I just have a couple of shell commands:

shell_rotate_log: '/config/logreset.sh'
shell_clear_log: '/config/logappend.sh'

And the logs are kept in config/logs with one file for each day. I have another that cleans up logs every 5 days and parses out all warnings and/or errors, etc, but these two might get you a step closer to finding if there is an HA issue causing the restarts.

Did you eventually find out what was the issue?
Having the same thing.

Thanks!