Install Home Assistant on Ubuntu LXC

Hi

Anyone successfully done this without a virtual env for Python. I have an Ubuntu server and want to run Home Assistant in a LXC container.

I am able to install Home Assistant in a LXC Container, but not without a Python Virtual environment.
It seems to be failing in installing when being homeassistant user within the container. Installing user root is working fine, but not recommended.

The steps I am doing:
# lxc launch ubuntu:18.04 homeassistant
# apt-get update && sudo apt-get upgrade -y && sudo apt-get install python3-pip -y
# adduser --system homeassistant && sudo addgroup homeassistant && sudo adduser homeassistant dialout
# chgrp homeassistant /home/homeassistant
# passwd homeassistant
# sudo adduser homeassistant sudo
# usermod -d /home/homeassistant/ homeassistant
# sudo -u homeassistant bash – when changing user I get a message “bash: /root/.bashrc: Permission denied”
$ pip3 install homeassistant – this one fails as well

Any suggestions? I think when running in a lxc it seems unecessary to run another layer of virtualization through python venv.

Cheers,

JM

A python virtual environment isn’t adding overhead. In your case it allows you to install python packages in an “environment” owned by the homeassistant user.

A python virtual environment tells python to install everything in my directory where I have write permissions instead of in the default system directories where I don’t have permissions.

I agree with @MikeA, there is no overhead in using an virtual environment. It is largely soft links to actual packages. However, since you are only running one python program, it also should not be necessary.

The above line looks incorrect if you are trying to switch users. From memory, I think it should be su not sudo

Hi

Okay maybe not so much of an overhead, but also maintenance wise it is bit more hass (my POV).
Anyway thanks for the help.

Br, Jan Morten