Home Assistant addon crashes on startup with NullPointerException in CgroupV2Subsystem (bare-metal cgroupv2 kernel)
Problem
The CompreFace Home Assistant addon enters a crash loop on startup with the following error:
java.lang.NullPointerException: null
at java.base/jdk.internal.platform.cgroupv2.CgroupV2Subsystem.getInstance(CgroupV2Subsystem.java:81)Environment: bare-metal x86/NUC running Home Assistant OS with a pure cgroupv2 kernel.
How to confirm: In the addon logs (HA → Settings → Add-ons → CompreFace → Log) you'll see Started FrsApplication immediately followed by Application run failed with the NPE above, repeating in a loop.
Root Cause
The JVM attempts to read the cgroup hierarchy via /sys/fs/cgroup/ and /proc/1/cgroup. On bare-metal systems with a pure cgroupv2 kernel, this fails with a NullPointerException in CgroupV2Subsystem.getInstance().
Fix
Two complementary fixes resolve the issue:
cgroup_fix.so(LD_PRELOAD) — a C library that interceptsopen,open64,openat,fopen,fopen64calls for/proc/1/cgroupand/proc/self/cgroup, returning fake cgroupv1 content (1:name=systemd:/)-XX:-UseContainerSupportin ajava_wrapperscript — disables JVM container detection entirely, preventingCgroupV2Subsystemfrom being instantiated
Working Solution
I have published a corrected Docker image and full build instructions (Dockerfile, C source, java_wrapper script) here:
https://github.com/mdaraujoGit/compreface-fixed
The fixed image is available at ghcr.io/mdaraujogit/compreface-fixed:1.1.0 and can be used directly as a drop-in replacement for the original addon image.
Notes
- Related to issue #1291 (addon not starting in Home Assistant OS)
- Tested on Intel NUC, Home Assistant OS, OpenJDK 11, CompreFace 1.1.0
Source: exadel-inc/CompreFace