whiskerz007 / proxmox_hassos_install

MIT License
881 stars 192 forks source link

LXD create VM for Hassio #118

Open xiki808 opened 3 years ago

xiki808 commented 3 years ago

Hello! This is not an issue but I'm posting here to get in contact with you.

I have been using this script to get home assistant VM setup, as part of my Proxmox automated installation. I am now moving away from Proxmox, and rewriting my automated installation for Debian, to have a similar setup script between intel and pi chips.

So I am now using LXD v4 on Debian to run my containers and also VMs!

I am having quite a rough time to run Home Assistant Operating System image on an LXD VM. I would appreciate if you can assist me on this. I think this will be very helpful to the HA community as LXD VMs become more stabilized! This is what I did so far:

After installing LXD using Snap and initializing it:

  1. Downloaded HA OS qcow2 image from here
  2. Created a metadata.yaml file with the following contents:
    architecture: x86_64
    creation_date: 1624888256
    properties:
    description: Home Assistant image
    os: Debian
    release: buster 10.10
  3. Compress the metadata.yaml file: tar -cvzf metadata.tar.gz metadata.yaml
  4. Create the LXC image: lxc image import metadata.tar.gz haos_ova.qcow2 --alias hassio
  5. Create LXC VM from the imported image: lxc launch hassio ha --vm -c security.secureboot=false

At this point I can do lxc console ha to get into the HA OS VM's console. Two problems I have right now.

  1. Once I get into the console and login as root (without password), I go straight into the # prompt, skipping the hassio prompt.
  2. The IP address is not obtained for the instance from outside the VM. I need this of course to access Home Assistant service on the browser.

I think the issue is that I don't have LXD-agent in the VM since the provided image from HA website is used.

I have setup a Macvlan network on my host to provide LAN network to my containers and VMs, by using this custom profile instead when creating an LXD container or VM:

config:
  boot.autostart: "true"
  environment.TZ: Europe/Malta
description: My common profile
devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: enp2s0f0
    type: nic
  root:
    path: /
    pool: default
    type: disk
name: common
used_by:
xiki808 commented 3 years ago

I managed to get Home Assistant service running buy using a bridged network instead. My only issue is that I can only run commands using lxd console which is not good if one is writing a bash script for automation. I wonder how you managed to include the agent in the Proxmox VM for HAOS image. Do you have any tips for this?

token47 commented 1 year ago

Thnak you for the steps to import the VM image into LXD. I also think it's a nice way to run vms (using lxd instead of libvirt). The bridge is the way to go to connect into the host network.

How is this after almost two years? Still have any issues? I'm planning on doing this in a few days with latest version.