home assistant 404 error

Hi,
I am using dietpi since more then two years on my Raspberry pi-2. I am running following things on it headless,

plex server

pihole

Pro FTP server

I have installed home automation software form dietpi-software last week
in HTOP command i am able to see some home assistant applications working but dietpi_IP_URL:8123 page show me
404 error
so in end i am not able to access home assistant page. please help me to fine tune this error so that i can access home assistant also on my raspberry pi.
thanks

according to home assistant website this software need to run on same machine. so is dietipi-software is broken for installing homeassistant software? please guide me . is i have to install all these software individually

DEBIAN/UBUNTU

apparmor-utils
apt-transport-https
avahi-daemon
ca-certificates
curl
dbus
jq
socat
software-properties-common
Optional:

network-manager

no success, i think there is a compatibility issue between diet pi & home assistant software, it should be better if dietpi administrator look in to matter & check where the issue. also worth for them to give some general guidelines if we need to fine tune our side like missing package or update something, thanks

mail2rst
There is a bug on Home Assistant side currently, see: https://github.com/MichaIng/DietPi/issues/3219#issuecomment-550532477

You can test our workaround and some other enhancements:

dietpi-backup # Please update/create a backup first
G_CONFIG_INJECT 'DEV_GITBRANCH=' 'DEV_GITBRANCH=dev' /DietPi/dietpi.txt
dietpi-update 1
dietpi-software reinstall 157

If everything works well, you might want to leave it but have the next stable DietPi release installed over the development version:

G_CONFIG_INJECT 'DEV_GITBRANCH=' 'DEV_GITBRANCH=master' /DietPi/dietpi.txt

If something does not work as expected, please report, so I’ll assist quickly, or you might want to restore the backup:

dietpi-backup -1

No, even i made these changes system not want to run home assistant. the opening of home assistant software failed now, upto yesterday in htop i am able to see homeassistant software running. but now it is failed in stating, screen shots attached



dietpi1.jpg

My test shows now:

DietPi-Services
─────────────────────────────────────────────────────
Mode: status home-assistant

[FAILED] DietPi-Services | ● home-assistant.service - Home Assistant (DietPi)
Loaded: loaded (/etc/systemd/system/home-assistant.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-11-21 14:19:52 CET; 12min ago
Process: 1317 ExecStart=/home/homeassistant/homeassistant-start.sh (code=exited, status=2)
Main PID: 1317 (code=exited, status=2)

Nov 21 14:19:52 DietPi systemd[1]: Started Home Assistant (DietPi).
Nov 21 14:19:52 DietPi systemd[1]: home-assistant.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Nov 21 14:19:52 DietPi systemd[1]: home-assistant.service: Unit entered failed state.
Nov 21 14:19:52 DietPi systemd[1]: home-assistant.service: Failed with result ‘exit-code’.

and HA wont start even after service restart or system reboot

even HA uninstall/install doesn’t help - HA service won’t start

just found out - folder /home/homeassistant/.pyenv/versions wasn’t created with HA reinstall (instalation runs too fast :slight_smile:)

tried also:
homeassistant@DietPi:/home/tibo$ pip3 install home-assistant-frontend==20191025.1
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting home-assistant-frontend==20191025.1
Downloading https://www.piwheels.org/simple/home-assistant-frontend/home_assistant_frontend-20191025.1-py3-none-any.whl (29.8MB)
|████████████████████████████████| 29.8MB 22kB/s
Installing collected packages: home-assistant-frontend
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/usr/local/lib/python3.5/dist-packages/home_assistant_frontend-20191025.1.dist-info’
Consider using the --user option or check the permissions.

and

homeassistant@DietPi:/home/tibo$ pip3 install home-assistant-frontend==20191119.2
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting home-assistant-frontend==20191119.2
Downloading https://www.piwheels.org/simple/home-assistant-frontend/home_assistant_frontend-20191119.2-py3-none-any.whl (30.4MB)
|████████████████████████████████| 30.4MB 23kB/s
Installing collected packages: home-assistant-frontend
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/usr/local/lib/python3.5/dist-packages/home_assistant_frontend-20191119.2.dist-info’
Consider using the --user option or check the permissions.

if you find the solution & system works for you, please help me what things i have to change to make system workable for home assistant

Guys, all pip3 installs need to be done as homeassistant user within the activated pyenv.
The frontend version as well need to match, which is 20191029 AFAIK.
However all fixes should be included in the DietPi dev branch, which you can apply via below described steps.

how can we activate pyenv with command:
source /home/homeassistant/.pyenv/versions/3.8.0/envs/homeassistant-3.8.0/bin/activate
since there’s no folder /home/homeassistant/.pyenv/versions?

If this dir does not exist, Python install/compilation must have failed in the first place. As a common failure reason I recognised that it requires quite much space in /tmp. 1 GB worked reliable, which is default on DietPi with 50% of 2 GB RAM+swap.
However e.g. on my testing VMs I have disabled swapfile and 1 GB RAM enabled by default, which then leads to 512 MB /tmp and in ~50% of the cases this made Python build fail with “no space left on device”.

Would be good to add this as a check, so if /tmp is below 1 GB, ask to change this on-the-fly and if RAM+swap is below 2 GB then, ask to increase swapfile so that 2 GB is reached.

And we should also error handle all pyenv and pip3 commands, to prompt with failure if anything fails instead of going on and running into harder to debug follow-up issues.

Hello Experts, I am using Raspberry pi-2 & not much linux knowledge, please give me the workable simple guidelines how i can run Home Assistant on my Raspberry Pi-2. if there is any big issue in your side & you need time please give me approximate time line when it will be fixed on it. i do not want to use any other operating system as dietpi is working perfectly since more then two years on my setup. i have not use home Assistant before so that thing is also learning curve for me. so i want make solid dietpi foundation for it. please give me simple guideline to install Home Assistant on Raspberry PI-2

I too am having problems with 6.27. I honestly have no idea what I am doing but somehow get things working but this time around it is not working. The rest of the stuff running are fine.
I only went tontry HA due to Dollarama selling Incipio devices for cheap and I have no Apple products. I was hoping to get a friend with an iPhone over to get the devices connected to the wifi and go from there.

Fore getting a status readout of HA shows it is running but what seems odd to me is that the time to create for the webui is 0.0 seconds and that seems fast for a pi b3+ even if it is running of a 60gb 2.5inch HD.

What I am thinking I may have done is trying commands people posted without backing up first and without underatanding them. I know for a fact that I tried commands without going into the python enviroment.
OP have you tried a fresh install? That is my next goto step when I can get a time slot when the household is not going to use the pihole for a bit and I am homw from work+awake.

I just fixed two bugs and ran a test install which works fine now.

dietpi-update -1 # When you are already on v6.27 to update to current dev code, else: https://github.com/MichaIng/DietPi/blob/dev/BRANCH_SYSTEM.md
dietpi-software reinstall 157
htop # Wait until CPU usage of HA process goes down
systemctl restart home-assistant # Required currently since first start fails to pull some Python module, no idea why...
htop # Wait until CPU usage of HA process goes down

Access to http://<local_IP>:8123 now works fine.

thanks,
now its starts & working fine, thanks for all your help

This ended up working for me. I had to run dietpi-software uninstall 157 and then clean up some things and then run through your steps a few times but it ended up working.

Thank you for taking the time and effort to get this working.

I can confirm it works!

What is the best way to update HA, since the update script with this line doesn’t work anymore:

su --shell /bin/bash --command “cd /srv/homeassistant; export PATH=”/home/homeassistant/.pyenv/bin:$PATH"; eval “$(pyenv init -)”; eval “$(pyenv virtualenv-init -)”; pip3 install --upgrade --default-timeout=100 homeassistant" homeassistant

it reports:
bash: line 0: cd: /srv/homeassistant: No such file or directory
pyenv: no such command `virtualenv-init’
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting homeassistant
Downloading https://www.piwheels.org/simple/homeassistant/homeassistant-0.102.1-py3-none-any.whl (5.8MB)
ERROR: Package ‘homeassistant’ requires a different Python: 3.5.3 not in ‘>=3.6.1’

What can happen if we decided to go back from dev to master dev_gitbranch after successful HA/system python upgrade (and instalation of TasmoAdmin). Will dietpi-update 1 erase the work done under dev session (TasmoAdmin etc.)?

What is the best way to update HA within this new environment?
dietpi-software reinstall 157 or some other command?

using this script is ok? please test&reply

#!/bin/bash
echo "Stopping Home Assistant..."
systemctl stop home-assistant

echo "Updating Home Assistant"
su --shell /bin/bash --command "cd /home/homeassistant; source /home/homeassistant/pyenv-activate.sh; pip3 install --upgrade --default-timeout=100 homeassistant" homeassistant

echo "Starting Home Assistant..."
systemctl restart home-assistant

echo "Home Assistant is ready!"

Exactly that should do it. I’ll add a script like this with release which in case calls sudo to source the env activation and does the update. HA has no web based updater, has it?