Home Assistant LXC script error on Proxmox 7

justme11

Member
Jul 10, 2021
5
0
6
39
Hey, guys.
I was using before proxmox 6 and script on github which creates and set up LXC for home assistant. It worked just flawless, now I have upgraded hardware on my home server and reinstall proxmox to 7 (up to date), after this Im getting error through installation:
root@pve:~# bash -c "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassio_lxc/raw/master/create_container.sh)" [INFO] Using 'local' for template storage. [INFO] Using 'local-lvm' for container storage. Updating LXC template list... Creating LXC container... [INFO] LXC container '100' was successfully created. Starting LXC container... run_buffer: 316 Script exited with status 1 lxc_init: 816 Failed to run lxc.hook.pre-start for container "100" __lxc_start: 2007 Failed to initialize container "100" startup for container '100' failed [ERROR] 255@100 Unknown failure occured. Logical volume "vm-100-disk-0" successfully removed

if I cancel executing script when it got error and then later trying to start a conteiner Im getting this error:
root@pve:~# pct start 100run_buffer: 316 Script exited with status 1 lxc_init: 816 Failed to run lxc.hook.pre-start for container "100" __lxc_start: 2007 Failed to initialize container "100" startup for container '100' failed

I have red that a lot people got some errors after upgrade to proxmox 7, one is possible of problem cgroup2. In config file of lxc I see that some parameters cgroup and some cgroup2, but actually dont know what to change and where to spot, pls help.
 
Any one? Pls point me where to look.
There are log of lxt starting:
Code:
root@pve:~# cat lxc-100.log
lxc-start 100 20210712094621.467 INFO     lsm - lsm/lsm.c:lsm_init_static:40 - Initialized LSM security driver AppArmor
lxc-start 100 20210712094621.468 INFO     conf - conf.c:run_script_argv:332 - Executing script "/usr/share/lxc/hooks/lxc-pve-prestart-hook" for container "100", config section "lxc"
lxc-start 100 20210712094622.790 INFO     conf - conf.c:run_script_argv:332 - Executing script "sh -ec 'for module in aufs overlay; do modinfo $module; $(lsmod | grep -Fq $module) || modprobe $module; done;'" for container "100", config section "lxc"
lxc-start 100 20210712094622.795 DEBUG    conf - conf.c:run_buffer:305 - Script exec sh -ec 'for module in aufs overlay; do modinfo $module; $(lsmod | grep -Fq $module) || modprobe $module; done;' 100 lxc pre-start produced output: modinfo: ERROR: Module aufs not found.

lxc-start 100 20210712094622.795 ERROR    conf - conf.c:run_buffer:316 - Script exited with status 1
lxc-start 100 20210712094622.795 ERROR    start - start.c:lxc_init:816 - Failed to run lxc.hook.pre-start for container "100"
lxc-start 100 20210712094622.795 ERROR    start - start.c:__lxc_start:2007 - Failed to initialize container "100"
lxc-start 100 20210712094622.795 INFO     conf - conf.c:run_script_argv:332 - Executing script "/usr/share/lxcfs/lxc.reboot.hook" for container "100", config section "lxc"
lxc-start 100 20210712094623.299 INFO     conf - conf.c:run_script_argv:332 - Executing script "/usr/share/lxc/hooks/lxc-pve-poststop-hook" for container "100", config section "lxc"
lxc-start 100 20210712094624.588 ERROR    lxc_start - tools/lxc_start.c:main:308 - The container failed to start
lxc-start 100 20210712094624.588 ERROR    lxc_start - tools/lxc_start.c:main:313 - Additional information can be obtained by setting the --logfile and --logpriority options
 
For some reason on Proxmox 7, Docker does not want to function properly in LXC even with nesting enabled. Keeps popping AppArmor errors for me and I am about to pull my hair out.
 
I removed the Apparmor package since docker does not install the required file under LXC for Apparmor
 
Last edited:
apt remove apparmor
This was on a ubuntu 20.04 LXC
Did u try with apparmor? What r saying admins/moderators? I tried to install docker ce, but also couldnt install with ease, it uses testing repository for debian 11.. Ok, looked at script and notice that it trying to install old docker..it seems need to provide a proper repository for docker and gonna try.
 
Last edited:
Did u try with apparmor? What r saying admins/moderators? I tried to install docker ce, but also couldnt install with ease, it uses testing repository for debian 11.. Ok, looked at script and notice that it trying to install old docker..it seems need to provide a proper repository for docker and gonna try.
I tried and my feeble mind couldn’t work out how to despite googling.

Add lxc.apparmor.profile = unconfined to the lxc.conf file and see if it works
 
hi,

i got it working here. you can patch the script:
Code:
diff --git a/create_container.sh b/create_container.sh
index 49844b5..28a5c45 100644
--- a/create_container.sh
+++ b/create_container.sh
@@ -78,13 +78,13 @@ wget -qO - ${REPO}/tarball/master | tar -xz --strip-components=1
 # Modify LXC permissions to support Docker
 LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
 cat <<EOF >> $LXC_CONFIG
-lxc.cgroup.devices.allow: a
+lxc.cgroup2.devices.allow: a
 lxc.cap.drop:
 EOF
 
 # Load modules for Docker before starting LXC
 cat << 'EOF' >> $LXC_CONFIG
-lxc.hook.pre-start: sh -ec 'for module in aufs overlay; do modinfo $module; $(lsmod | grep -Fq $module) || modprobe $module; done;'
+lxc.hook.pre-start: sh -ec 'for module in overlay; do modinfo $module; $(lsmod | grep -Fq $module) || modprobe $module; done;'
 EOF
 
 # Set autodev hook to enable access to devices in container

and then it should work (though i haven't tested the actual functionality of the homeassistant, the container can start as expected)
 
  • Like
Reactions: miovee and vjiggi
apt remove apparmor
This was on a ubuntu 20.04 LXC
Didnt work for me. Still looking for a solution. This is a fresh install of Proxmox 7 trying to get docker working in LXC is a nightmare. Can any staff member chime in and explain this or if there is a solution being worked on?
 
Didnt work for me. Still looking for a solution. This is a fresh install of Proxmox 7 trying to get docker working in LXC is a nightmare. Can any staff member chime in and explain this or if there is a solution being worked on?
see my post above
 
Thx for ur solution, can u pls a bit describe your changes and briefly explain at which point or where to use ur patch?
the patch is for https://github.com/whiskerz007/proxmox_hassio_lxc repository (linked in the first post by OP)

lxc.cgroup entries are changed to lxc.cgroup2. afterwards i was having issues loading aufs kernel module when starting the container, so i removed that also from the pre-start hook (since with docker nowadays overlayfs is used as alternative)
 
the patch is for https://github.com/whiskerz007/proxmox_hassio_lxc repository (linked in the first post by OP)

lxc.cgroup entries are changed to lxc.cgroup2. afterwards i was having issues loading aufs kernel module when starting the container, so i removed that also from the pre-start hook (since with docker nowadays overlayfs is used as alternative)
In your changes no security drawbacks?
the patch is for https://github.com/whiskerz007/proxmox_hassio_lxc repository (linked in the first post by OP)

lxc.cgroup entries are changed to lxc.cgroup2. afterwards i was having issues loading aufs kernel module when starting the container, so i removed that also from the pre-start hook (since with docker nowadays overlayfs is used as alternative)
I have tried and it seems works, but it uses now 1,5GB RAM + some swap if assigned 2gb if assigned 512mb uses all ram+ half swap.. Before fresh HA used about 300MB + some swap.
 
so I did this and the container started by now my docker containers won't start wioth cgroup mountpoint errors

docker start 7e879738019e
Error response from daemon: cgroups: cgroup mountpoint does not exist: unknown
Error: failed to start containers: 7e879738019e

I assume this means mine was using aufs? Suggestions on how to rebuild?
 
you need a docker version with cgroupv2 support
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!