'lxc' - could not get working...
darekhome opened this issue · 32 comments
Tryied few times - result the same...
P.S. What add-on's can not be installed...?
root@proxmox:~# ash -c "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassio_lxc/raw/master/create_container.sh)" -bash: ash: command not found root@proxmox:~# bash -c "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassio_lxc/raw/master/create_container.sh)" [INFO] Using 'local-zfs' for storage location. [INFO] Container ID is 105. Updating LXC template list... Downloading LXC template... Creating LXC container... [WARNING] Some addons may not work due to ZFS not supporting 'fallocate'. Starting LXC container... Setting up container OS... Updating container OS... Installing prerequisites... [ERROR:LXC] 100@34 Unknown failure occured. [ERROR] 100@155 Unknown failure occured. root@proxmox:~#
The addons that are known to not work with ZFS storage are ones that setup mySQL/MariaDB. It has to do with the way the software creates files and the lack of support in ZFS.
The error you are getting while installing the script looks like it is having a problem installing new packages. Can you tell me the specs of your Proxmox machine?
I was interested in the hardware specs that Proxmox is installed on.
It is IntelNUC 5PPYH, Pentium N3700, 8GB RAM, SSD 256GB.
Are you still having this problem with installing the Hass.io LXC?
Yes, still the same...
Please run the following and report your results.
bash -c "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassio_lxc/raw/master/create_container.sh | sed 's/master/wait-network/')"
Yes, but I'm just wondering if this should be continued...
Have you looked on that?
`
_1.
We want to emphasize that running Hass.io as a virtual machine is the only supported method to run Hass.io on a virtualized system. We’ve lately seen some funky tutorials on how to run Hass.io inside a container like Docker or LXC, which we DO NOT recommend, you will end up having issues.
2.
We DO NOT support any kind of LXC hacks like listed here: https://github.com/whiskerz007/proxmox_hassio_lxc. These setups try to put everything inside a single container, which will cause you issues. Hass.io is not designed to run fully inside a containerized system, like LXC.
We hope this clarifies our earlier statement._
`
More here: https://www.home-assistant.io/blog/
The HA Dev team has done a Stellar job releasing and updating this awesome software. Whiskerz007 has created an interesting approach to installing Hassio in an LXC environment, and I see he continues to address users concerns; as do I as one of the first to run & test this method. While I certainly respect the HA Teams' personal positions, each user has a choice to how they want to do things. The main question I ask is -- WHY NOT? Just because they (HA Dev. Team) don't support or recommend it, doesn't mean it's not a functional example. I am totally confused why the stance has been so direct on not supporting the LXC container, other than to clearly push users back to the source of development - Whiskerz007. At any time a snapshot can be taken ad restored to any virtual, or PI or Debian or Ubuntu installation -- So where is the Danger?
Perhaps the (un-planned) or (secret) future will see this project fail? Ok. I'll make a new choice then!
I am very new to many of these topics, I am new to HA - I do not contribute to HA in any way, other than to boast about my home, and the crazy (amazing) and simple things I have done because of the hard-work many people are putting in behind this project - FREE. So at this point, I respect their warnings and decisions, and I choose to keep pushing the envelope and follow this LXC container example. We don't have to be enemies / dissolve friendships because of my choice -- Perhaps we can even help eachother (indirectly)? through communication. ALL HASSIO LXC concerns should be addressed to Whiskerz007.
AS SUCH- Don't bring LXC issues to the HA-DEV Team. They belong here.
Don't be afraid to try something new -- or stick with mainstream. Both are great choices. The point is; you now have another choice!
Thanks Whiskerz007 for coming up with this neat approach and Thanks HA DEV. team for doing what you do. This is what Open-source is all about, and 'FORKING' a project. Welcome to a Left-turn!
Happy 2020 to everyone!
-Tollbringer
Anyway... I've checked this proposal...
Result - with some error...
I'm still open to try other solutions.
root@proxmox:~# bash -c "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassio_lxc/raw/master/create_container.sh | sed 's/master/wait-network/')" [INFO] Using 'local-zfs' for storage location. [INFO] Container ID is 104. Updating LXC template list... Downloading LXC template... Creating LXC container... [WARNING] Some addons may not work due to ZFS not supporting 'fallocate'. Starting LXC container... Setting up container OS... Updating container OS... Installing prerequisites... [ERROR:LXC] 100@49 Unknown failure occured. [ERROR] 100@155 Unknown failure occured. root@proxmox:~#
LXC is a native Linux implementation of containers to isolate software, security, and permissions from the host system. This is accomplished by the Linux kernel, of the host OS, filtering all syscalls according to configured profiles on a per container basis. Since there is no emulation layer between the container and host, there is practically no performance degradation when compared to virtualization.
Docker leverages LXC functionality to build it's predictable ecosystem. Their application of this technology is to share compiled images of containers and to start a single program within the container. By default, when the program exits, any data that may have been changed is discarded and the container is destroyed. Docker also adds the ability mount non-volatile storage to the container to allow for some of the data to persist between runs of the containers. Again, permission and security models are applied on a per container basis.
The way this Hass.io LXC container has been setup for use is to remove any security limitations applied to the container, which in effect allows the applications inside of the container to run as if it is on the host OS. Specific devices are also passed into the container that Hass.io, and it's addons, has an interest in. Docker is installed using their installation script. Hass.io is installed using their installation script. In effect, the LXC is configured just like you would if you were going to install Hass.io onto a Debian OS on bare metal.
Some benefits of running Hass.io in a LXC versus a VM are: ability to pass the same device to multiple LXC (VM needs solitary access), increased performance, quicker access to Hass.io UI from cold boot, access and control to underlying OS running Hass.io, isolation from host OS (in this case Proxmox) and other containers, ability to manage resources (CPU cores, RAM size, HDD size, network settings) from a UI without the need to reboot the container.
Please run the follow and upload debug.log
. You can use your favorite scp
program to download the file from the Proxmox server using the same credentials you use to login to the UI.
bash -xc "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassio_lxc/raw/master/create_container.sh | sed -e 's/master/wait-network/' -e 's/-- bash -c/-- bash -x/')" | tee debug.log
O.K. I can do that on Sunday, when I’m back from trip...
See the 'debug.log' file attached...
debug.log
Are you sure it will help? The log file is very poor...
See also attached all 'console' messages displayed during 'script' run...
What are Proxmox's configured DNS servers? Please send a screenshot.
You can get this information by going to the node (the icon directly under Datacenter
) -> System -> DNS.
Try changing the DNS servers to point to only 1.1.1.1
and 9.9.9.9
and run the script again. Please report findings.
I can do that in few days - as I have some test running on this machine and do not want to disturb it...
@darekhome Any update on this issue? Thanks!
-Tollbringer
it seems the newly created lxc container can't connect to ftp.debian.org.
If I ping ftp.debian.org from proxmox shell, it's working though.
Found my problem, apparently the lxc container can't get IP address from my DHCP server.
So, what i did are:
- Download create_container.sh script into proxmox host using host console/ssh.
- Comment out setup.sh command in the create_container.sh script and run it from proxmox host console.
- Change the container ip address from proxmox web gui.
- Reboot container from proxmox web gui.
- Run the "pct exec 100 /setup.sh" command again from proxmox host console.
Update:
Apparently still not working. It's more on bridging issue. Will update further
Thanks very much for sharing the solution. Much appreciated.
Tollbringer
Ok apparently mac address issue on hyper-v vm that host proxmox. I set mac address spoofing on on the hyper-v vm with proxmox, voila... now container can get IP and access network.
Ok apparently mac address issue on hyper-v vm that host proxmox. I set mac address spoofing on on the hyper-v vm with proxmox, voila... now container can get IP and access network.
@liemrich How can we do this? Can you explain?
Thank you
hello
can you guys help me install ? i can't seem to get past this error
root@proxmox:~# bash -c "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassio_lxc/raw/master/create_container.sh)"
[INFO] Using 'local-lvm' for storage location.
[INFO] Container ID is 101.
Updating LXC template list...
Downloading LXC template...
Creating LXC container...
Starting LXC container...
Setting up container OS...
Updating container OS...
Installing prerequisites...
Customizing Docker...
Installing Docker...
Installing Home Assistant...
[ERROR:LXC] 1@58 Unknown failure occured.
[ERROR] 1@165 Unknown failure occured.
Logical volume "vm-101-disk-0" successfully removed
Same here on a fresh install. After some progress the setup hung and on any key press (Enter
in my case) it would abort.
So I looked into the code for installing Home Assistant and found one line prompting for confirmation. As I entered the expected string not supported
, the installer went through:
[...]
Installing Home Assistant...
not supported
Enabling autorun Home Assistant cli...
Customizing container...
Cleanup...
[INFO] Successfully created Home Assistant LXC to 100.
Home Assistant is reachable by going to the following URLs.
[...]
After that installation can start on the provided url. 👍
Same here on a fresh install. After some progress the setup hung and on any key press (
Enter
in my case) it would abort.
So I looked into the code for installing Home Assistant and found one line prompting for confirmation. As I entered the expected stringnot supported
, the installer went through:[...] Installing Home Assistant... not supported Enabling autorun Home Assistant cli... Customizing container... Cleanup... [INFO] Successfully created Home Assistant LXC to 100. Home Assistant is reachable by going to the following URLs. [...]
After that installation can start on the provided url. 👍
you are correct! thank you! it did install.
The script has been updated and should now work for further installations.
I used it this morning - worked great! BTW: The added BONUS of being able to use a 1-liner script to duplicate the old LXC container, pick your options in a menu driven format (copy Disk Size, Mac Address, IP address etc...) it virtually clones the old container but gives you access to the latest device hooks/compatibility fixes without "redoing" or "starting over"-- SUPER SLICK!
A job that continues to be well done. Top NOTCH support on this variant.
You've taken an AMAZING program (Home Assistant) that continues to improve - to a whole new level of flexibility. Thank you for your efforts!
-Tollbringer
Install problem....
root@proxmox:~# bash -xc "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassio_lxc/raw/master/create_container.sh | sed -e 's/master/wait-network/' -e 's/-- bash -c/-- bash -x/')" | tee debug.log
- '[' -z '' ']'
- return
- set -o errexit
- set -o errtrace
- set -o nounset
- set -o pipefail
- shopt -s expand_aliases
- alias 'die=EXIT=$? LINE=$LINENO error_exit'
- trap die ERR
- trap cleanup EXIT
++ mktemp -d - TEMP_DIR=/tmp/tmp.jdaZOENFYI
- pushd /tmp/tmp.jdaZOENFYI
++ pvesh get /cluster/nextid - export CTID=102
- CTID=102
- export PCT_OSTYPE=debian
- PCT_OSTYPE=debian
- export PCT_OSVERSION=10
- PCT_OSVERSION=10
- export PCT_DISK_SIZE=4
- PCT_DISK_SIZE=4
- export 'PCT_OPTIONS=
-cmode shell
-features nesting=1
-hostname homeassistant
-net0 name=eth0,bridge=vmbr0
-onboot 1
-tags homeassistant
' - PCT_OPTIONS='
-cmode shell
-features nesting=1
-hostname homeassistant
-net0 name=eth0,bridge=vmbr0
-onboot 1
-tags homeassistant
'
++ wget -qLO - https://github.com/whiskerz007/proxmox_lxc_create/raw/main/lxc_create.sh - bash -c '#!/usr/bin/env bash
Setup script environment
set -o errexit #Exit immediately if a pipeline returns a non-zero status
set -o errtrace #Trap ERR from shell functions, command substitutions, and commands from subshell
set -o nounset #Treat unset variables as an error
set -o pipefail #Pipe will exit with last non-zero status if applicable
shopt -s expand_aliases
alias die='''EXIT=$? LINE=$LINENO error_exit'''
trap die ERR
function error_exit() {
trap - ERR
local DEFAULT='''Unknown failure occured.'''
local REASON="\e[97m${1:-$DEFAULT}\e[39m"
local FLAG="\e[91m[ERROR] \e[93m$EXIT@$LINE"
msg "$FLAG $REASON" 1>&2
exit $EXIT
}
function warn() {
local REASON="\e[97m$1\e[39m"
local FLAG="\e[93m[WARNING]\e[39m"
msg "$FLAG $REASON"
}
function info() {
local REASON="$1"
local FLAG="\e[36m[INFO]\e[39m"
msg "$FLAG $REASON"
}
function msg() {
local TEXT="$1"
echo -e "$TEXT"
}
function select_storage() {
local CLASS=$1
local CONTENT
local CONTENT_LABEL
case $CLASS in
container) CONTENT='''rootdir'''; CONTENT_LABEL='''Container''';;
template) CONTENT='''vztmpl'''; CONTENT_LABEL='''Container template''';;
*) false || die "Invalid storage class.";;
esac
Query all storage locations
local -a MENU
while read -r line; do
local TAG=$(echo $line | awk '''{print $1}''')
local TYPE=$(echo $line | awk '''{printf "%-10s", $2}''')
local FREE=$(echo $line | numfmt --field 4-6 --from-unit=K --to=iec --format %.2f | awk '''{printf( "%9sB", $6)}''')
local ITEM=" Type: $TYPE Free: $FREE "
local OFFSET=2
if [[
local MSG_MAX_LENGTH=$((${#ITEM} + $OFFSET))
fi
MENU+=( "$TAG" "$ITEM" "OFF" )
done < <(pvesm status -content $CONTENT | awk '''NR>1''')
Select storage location
if [
warn "'''$CONTENT_LABEL''' needs to be selected for at least one storage location."
die "Unable to detect valid storage location."
elif [
printf ${MENU[0]}
else # More than one storage location is detected
local STORAGE
while [ -z "${STORAGE:+x}" ]; do # Generate graphical menu
STORAGE=$(whiptail --title "Storage Pools" --radiolist
"Which storage pool you would like to use for the ${CONTENT_LABEL,,}?\n\n"
16 $(($MSG_MAX_LENGTH + 23)) 6
"${MENU[@]}" 3>&1 1>&2 2>&3) || die "Menu aborted."
done
printf $STORAGE
fi
}
Test if required variables are set
[[ "${CTID:-}" ]] || die "You need to set '''CTID''' variable."
[[ "${PCT_OSTYPE:-}" ]] || die "You need to set '''PCT_OSTYPE''' variable."
Test if ID is valid
[ "$CTID" -ge "100" ] || die "ID cannot be less than 100."
Test if ID is in use
if pct status $CTID &>/dev/null; then
warn "ID '''$CTID''' is already in use."
unset CTID
die "Cannot use ID that is already in use."
fi
Get template storage
TEMPLATE_STORAGE=$(select_storage template) || exit
info "Using '''$TEMPLATE_STORAGE''' for template storage."
Get container storage
CONTAINER_STORAGE=$(select_storage container) || exit
info "Using '''$CONTAINER_STORAGE''' for container storage."
Update LXC template list
msg "Updating LXC template list..."
pveam update >/dev/null
Get LXC template string
TEMPLATE_SEARCH=${PCT_OSTYPE}-${PCT_OSVERSION:-}
mapfile -t TEMPLATES < <(pveam available -section system | sed -n "s/.($TEMPLATE_SEARCH.)/\1/p" | sort -t - -k 2 -V)
[ ${#TEMPLATES[@]} -gt 0 ] || die "Unable to find a template when searching for '''$TEMPLATE_SEARCH'''."
TEMPLATE="${TEMPLATES[-1]}"
Download LXC template
if ! pveam list $TEMPLATE_STORAGE | grep -q $TEMPLATE; then
msg "Downloading LXC template..."
pveam download $TEMPLATE_STORAGE $TEMPLATE >/dev/null ||
die "A problem occured while downloading the LXC template."
fi
Create variable for '''pct''' options
DEFAULT_PCT_OPTIONS=(
-arch $(dpkg --print-architecture)
-net0 name=eth0,bridge=vmbr0,ip=dhcp
-unprivileged 1
)
PCT_OPTIONS=( ${PCT_OPTIONS[@]:-${DEFAULT_PCT_OPTIONS[@]}} )
[[ " ${PCT_OPTIONS[@]} " =~ " -rootfs " ]] || PCT_OPTIONS+=( -rootfs
Create LXC
msg "Creating LXC container..."
pct create
die "A problem occured while trying to create container."
Success message
info "LXC container '''$CTID''' was successfully created."'
[INFO] Using 'local' for template storage.
[INFO] Using 'local-lvm' for container storage.
Updating LXC template list...
Creating LXC container...
[INFO] LXC container '102' was successfully created.
++ awk 'NR>1 {print $2}'
+++ pct config 102
+++ awk -F : '{print $2}'
+++ grep rootfs
++ pvesm status -storage local-lvm
- STORAGE_TYPE=lvmthin
- '[' lvmthin == zfspool ']'
- REPO=https://github.com/whiskerz007/proxmox_hassio_lxc
- wget -qO - https://github.com/whiskerz007/proxmox_hassio_lxc/tarball/wait-network
- tar -xz --strip-components=1
- LXC_CONFIG=/etc/pve/lxc/102.conf
- cat
- cat
- bash ./set_autodev_hook.sh 102
bash: ./set_autodev_hook.sh: No such file or directory
++ EXIT=127
++ LINE=90
++ error_exit
++ trap - ERR
++ local 'DEFAULT=Unknown failure occured.'
++ local 'REASON=\e[97mUnknown failure occured.\e[39m'
++ local 'FLAG=\e[91m[ERROR] \e[93m127@90'
++ msg '\e[91m[ERROR] \e[93m127@90 \e[97mUnknown failure occured.\e[39m'
++ local 'TEXT=\e[91m[ERROR] \e[93m127@90 \e[97mUnknown failure occured.\e[39m'
++ echo -e '\e[91m[ERROR] \e[93m127@90 \e[97mUnknown failure occured.\e[39m'
[ERROR] 127@90 Unknown failure occured.
++ '[' '!' -z 102 ']'
++ cleanup_ctid
+++ pct status 102
+++ pct status 102
+++ awk '{print $2}'
++ '[' stopped == running ']'
++ pct destroy 102
Logical volume "vm-102-disk-0" successfully removed
++ exit 127 - cleanup
- popd
- rm -rf /tmp/tmp.jdaZOENFYI
root@proxmox:# cat debug.log#
[INFO] Using 'local' for template storage.
[INFO] Using 'local-lvm' for container storage.
Updating LXC template list...
Creating LXC container...
[INFO] LXC container '102' was successfully created.
[ERROR] 127@90 Unknown failure occured.
Logical volume "vm-102-disk-0" successfully removed
root@proxmox: