Skip to content

mdaraujoGit/compreface-fixed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Aqui está o README limpo e adequado para a comunidade:


# CompreFace Fixed — Home Assistant Addon

Corrected Docker image of [Exadel CompreFace](https://github.com/exadel-inc/CompreFace) for Home Assistant on bare-metal x86/NUC systems running a pure cgroupv2 kernel.

## The Problem

CompreFace crashes on startup in a restart loop with this error in the addon logs:

java.lang.NullPointerException: null at java.base/jdk.internal.platform.cgroupv2.CgroupV2Subsystem.getInstance(CgroupV2Subsystem.java:81)


**Cause:** The JVM tries 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.

**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.

## The Fix

Two complementary fixes combined in the Docker image:

1. **`cgroup_fix.so` (LD_PRELOAD)** — a C library that intercepts `open`, `open64`, `openat`, `fopen`, `fopen64` calls for `/proc/1/cgroup` and `/proc/self/cgroup`, returning fake cgroupv1 content (`1:name=systemd:/`)
2. **`-XX:-UseContainerSupport` in `java_wrapper`** — disables JVM container detection entirely, preventing `CgroupV2Subsystem` from being instantiated

The `java_wrapper` script is placed at `/usr/local/bin/java_wrapper` inside the image and is called by supervisord to launch the Java processes (`compreface-admin` and `compreface-api`).

## Using the Pre-built Image

The fixed image is available on GHCR:

```bash
ghcr.io/mdaraujogit/compreface-fixed:1.1.0

In your Home Assistant supervisor, point the CompreFace addon to this image instead of the original.

Build It Yourself

Files

Dockerfile

FROM c7657554/amd64-addon-compreface:1.1.0
COPY cgroup_fix2.c /tmp/cgroup_fix2.c
COPY java_wrapper /usr/local/bin/java_wrapper
RUN gcc -shared -fPIC -ldl -o /usr/local/lib/cgroup_fix.so /tmp/cgroup_fix2.c \
    && chmod 755 /usr/local/lib/cgroup_fix.so \
    && chmod 755 /usr/local/bin/java_wrapper
ENTRYPOINT ["/run.sh"]
CMD []

java_wrapper

#!/bin/bash
REAL_JAVA=/usr/lib/jvm/java-11-openjdk-amd64/bin/java
export LD_PRELOAD=/usr/local/lib/cgroup_fix.so
exec "$REAL_JAVA" -XX:-UseContainerSupport "$@"

cgroup_fix2.c — see source file in this repository.

Build and push

docker build -t ghcr.io/YOUR_USERNAME/compreface-fixed:1.1.0 .
docker push ghcr.io/YOUR_USERNAME/compreface-fixed:1.1.0

Reapplying After an Addon Update

If CompreFace updates and starts crashing again:

  1. Update the FROM line in Dockerfile to the new version
  2. Rebuild and push the image with the new tag
  3. Point the HA supervisor to the new image tag

Important: After doing "Reload add-on store" in HA, the image field in the addon config.json may be overwritten. If that happens, restore it manually:

sudo docker exec hassio_supervisor python3 -c "
import json
path = '/data/addons/git/c7657554/compreface/config.json'
with open(path) as f:
    cfg = json.load(f)
cfg['image'] = 'ghcr.io/YOUR_USERNAME/compreface-fixed'
with open(path, 'w') as f:
    json.dump(cfg, f, indent=2)
print('OK:', cfg['image'])
"

Verification

After restarting the addon, logs should show:

Started FrsApplication in X seconds
Started TrainServiceApplication in X seconds

With no Application run failed or NullPointerException following.

Environment

  • Tested on: Intel NUC, Home Assistant OS, kernel with pure cgroupv2
  • CompreFace version: 1.1.0
  • Java: OpenJDK 11

---

Sem IPs, sem SSH, sem tokens — tudo genérico e útil para qualquer pessoa com o mesmo problema. Cola isto no editor do GitHub e substitui o conteúdo actual.

About

CompreFace addon for Home Assistant with cgroupv2 fix for bare-metal installs

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors