Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LXD create VM for Hassio #118

Open
xiki808 opened this issue Jun 29, 2021 · 2 comments
Open

LXD create VM for Hassio #118

xiki808 opened this issue Jun 29, 2021 · 2 comments

Comments

@xiki808
Copy link

xiki808 commented Jun 29, 2021

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
  1. Compress the metadata.yaml file: tar -cvzf metadata.tar.gz metadata.yaml
  2. Create the LXC image: lxc image import metadata.tar.gz haos_ova.qcow2 --alias hassio
  3. 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
Copy link
Author

xiki808 commented Jul 1, 2021

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
Copy link

token47 commented Mar 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants