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

Not enough real-time shares (cpu.rt_runtime_us == 0) with Docker #1191

Closed
eloo opened this issue Mar 22, 2021 · 7 comments
Closed

Not enough real-time shares (cpu.rt_runtime_us == 0) with Docker #1191

eloo opened this issue Mar 22, 2021 · 7 comments
Labels
➡️ third-party issue This is a bug/issue for/in other third-party software 🐛 bug-report Something isn't working 👎 wontfix This will not be worked on

Comments

@eloo
Copy link

eloo commented Mar 22, 2021

Describe the bug
Hi,

i'm currently trying the docker (oci) image to replace my debmatic installation in future.
But i'm having some trouble to get it running. I'm also following the home-assistant addon issue here in github which looks very promising.

When i start the docker image (using compose) my rf-mod gets detected but it looks like rfd has issues to get started.

I have also tested to start rfd from within the container but also this does not work.

Docker logs:

Starting watchdog...
Identifying onboard hardware: oci, OK
Initializing RTC Clock: onboard, OK
Running sysctl: OK
Checking for Factory Reset: not required
Checking for Backup Restore: not required
ln: /dev/raw-uart: File exists
Initializing System: OK
Starting logging: OK
Populating /dev using udev: done
Init onboard LEDs: init, OK
Starting irqbalance: OK
Starting network: eth0: link up, fixed, firewall, inet up, 172.23.0.2, OK
Identifying Homematic RF-Hardware: ....HmRF: RPI-RF-MOD/GPIO, HmIP: RPI-RF-MOD/GPIO, OK
Updating Homematic RF-Hardware: RPI-RF-MOD: 4.2.14, OK
Starting hs485dLoader: disabled
Starting xinetd: OK
Starting eq3configd: OK
Starting lighttpd: OK
Starting ser2net: disabled
Starting ssdpd: OK
Starting NUT services: disabled
Initializing Third-Party Addons: OK
Starting LGWFirmwareUpdate: ...OK
Setting LAN Gateway keys: OK
Starting hs485d: disabled
Starting multimacd: ERROR: not enough real-time shares (cpu.rt_runtime_us == 0)
Starting rfd: ....................ERROR
Starting HMIPServer: .......................................................................................................................................................ERROR
Starting ReGaHss: .OK
Starting CloudMatic: OK
Starting NeoServer: disabled
Starting Third-Party Addons: OK
Starting crond: OK
Setup onboard LEDs: booted, OK

System logs for rfd

Mar 22 23:45:11 homematic-raspi user.err monit[811]: 'rfd' process is not running
Mar 22 23:45:11 homematic-raspi user.info monit[811]: 'rfd' trying to restart
Mar 22 23:45:11 homematic-raspi user.info monit[811]: 'rfd' restart: '/etc/init.d/S61rfd restart'
Mar 22 23:45:12 homematic-raspi user.err rfd: CCU2CommController::improvedInit() - Identify response string not handled: 
Mar 22 23:45:17 homematic-raspi user.err rfd: () CCU2CommController::setCSMACAEnabled(): Error disabling CSMA/CA.
Mar 22 23:45:17 homematic-raspi user.err rfd: No BidCoS-Interface available
Mar 22 23:45:42 homematic-raspi user.err monit[811]: 'rfd' failed to restart (exit status -1) -- '/etc/init.d/S61rfd restart': Program timed out -- start-stop-daemon: warning: killing process 2389: No such process

I have also seen this issue #1106 and check that i did the installation exactly the way described in the docs (eq3 and dkms) but still no success.

i'm not sure if the problem is directly related to the rt_runtime_us which is mentioned in the logs but i also don't know exactly how to adjust/fix this.

I've also seen that there is change related in the last release but i still see this error.
Maybe there is still a bug related to the rt_runtime_us? Or do i maybe need to make some adjustments to my system?

Btw. the module it self is working because i have also debmatic on the same hardware (but i stop it when i'm testing your image)

Steps to reproduce the behavior

  1. Start the oci image using docker-compose
  2. Check the log for the real-time shares error
  3. Try to teach in new devices
  4. Check monit if every service is started

Expected behavior

  • The rf-mod is detected
  • All related services (rfd, hmip-server) are started
  • Devices can be paired

Screenshots

System information:

  • RaspberryMatic Version: 3.57.4.20210320 / ghcr.io/jens-maus/raspberrymatic:latest
  • Used Hardware: OdroidC2 - Armbian - Kernel 5.10.16
  • Used HomeMatic RF-Module:-RF-MOD/GPIO

Additional context
My docker-compose file

version: "3.8"
services:
  raspberrymatic:
    image: ghcr.io/jens-maus/raspberrymatic:latest
    container_name: ccu
    hostname: homematic-raspi
    privileged: true
    restart: unless-stopped
    stop_grace_period: 30s
    volumes:
      - ./ccu_data:/usr/local:rw
      - /lib/modules:/lib/modules:ro
    ports:
      - "8080:80"

Thanks

@jens-maus
Copy link
Owner

Well, the issues you are reporting/seeing here are specific to using Armbian because they seem to have decided to enable CONFIG_RT_GROUP_SCHED=y in their kernel configs lately (https://forum.armbian.com/topic/16489-config_rt_group_schedy-harmuflull-for-real-time-applications/) and this actually results in this specific situation, that cpu.rt_runtime_us is set to zero and then you start your docker environment and docker will not get enough realtime shares (==0), which however is required for multimacd as part of RaspberryMatic/CCU.

So, I am sorry, but this is a know limitation of Armbian and you are either asked to switch to a different distribution or recompile the kernel without CONFIG_RT_GROUP_SCHED=y or you make sure docker get enough real-time shares by manually setting cpu.rt_runtime_us before you start the RaspberryMatic docker.

@jens-maus jens-maus added ➡️ third-party issue This is a bug/issue for/in other third-party software 🐛 bug-report Something isn't working 👎 wontfix This will not be worked on labels Mar 23, 2021
@eloo
Copy link
Author

eloo commented Mar 23, 2021

Hi @jens-maus,

thank you very much for the detailed explanation.
Maybe this can be added to the docs for the docker installation? As a known limitation or something.

you make sure docker get enough real-time shares by manually setting cpu.rt_runtime_us before you start the RaspberryMatic docker.

Do you know this can be done in armbian? Would be very helpful and i could test it.

Thanks

@zsisamci
Copy link

@eloo with these changes i could start the container succesfully on armbian
1.
add this to /etc/docker/daemon.json

{
"cpu-rt-runtime": 190000
}

2.) add --cpu-rt-runtime=190000 option to docker run or create comand or "cpu_rt_runtime":190000
to docker compose file

@eloo
Copy link
Author

eloo commented Mar 27, 2021

Sounds great..

I will give it a try and report the result here.

Thanks

@eloo
Copy link
Author

eloo commented Mar 28, 2021

Okay thats looks good.
And is seems that only setting the cpu_rt_runtime in the docker-compose is enough.

@jens-maus maybe this can be added to the docs?

@jens-maus
Copy link
Owner

@eloo Sure, please post your final docker compose file here as a reference

@eloo
Copy link
Author

eloo commented Mar 28, 2021

okay.. so after a bit of testing here is my current setup.

/etc/docker/daemon.json

{
        "cpu-rt-runtime": 190000
}

docker-compose.yaml

version: "3.8"
services:
  raspberrymatic:
    image: ghcr.io/jens-maus/raspberrymatic:latest
    container_name: ccu
    hostname: homematic-raspi
    privileged: true
    restart: unless-stopped
    stop_grace_period: 30s
    volumes:
      - ./ccu_data:/usr/local:rw
      - /lib/modules:/lib/modules:ro
    cpu_rt_runtime: 190000
    ports:
      - "8080:80"
      - "2000:2000"
      - "2001:2001"
      - "2010:2010"
      - "9292:9292"
      - "8181:8181"

seems that the config in the daemon.json is necessary..
and don't forget to restart the docker service after changing this value

Sadly with the settings in the daemon.json the homeassistant addon is still showing the not enough real-time shares error.
Maybe this can be added somehow to the addon also?

Thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
➡️ third-party issue This is a bug/issue for/in other third-party software 🐛 bug-report Something isn't working 👎 wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants