ananicy-rules icon indicating copy to clipboard operation
ananicy-rules copied to clipboard

`ananicy-cpp.service` isn't starting propperly and needs to be restarted manually for Cgroups to work.

Open Wabuo opened this issue 5 months ago • 5 comments

To my inexperienced eye, it looks like the ananicy-cpp.service should be started by a later target, because it seems like Cgroups aren't available yet when it tries to start.

Or depend on something on the lines of wants cgoups2.online.target (not a real thing) Or it should fail — sleep and then retry.

Anyways here the status of ananicy-cpp.service after boot up, it will stay like this indefinitely for me.

 systemctl status ananicy-cpp.service
● ananicy-cpp.service - Ananicy-Cpp - ANother Auto NICe daemon in C++
     Loaded: loaded (/usr/lib/systemd/system/ananicy-cpp.service; enabled; preset: disabled)
     Active: active (running) since Mon 2025-08-25 13:58:28 +08; 11h ago
 Invocation: c003515de73741ca809beddf54b540c4
   Main PID: 752 (ananicy-cpp)
      Tasks: 4 (limit: 17691)
     Memory: 12.7M (high: 16M, max: 64M, available: 3.2M, peak: 17.7M, swap: 392K, swap peak: 6M)
        CPU: 1min 42.493s
     CGroup: /system.slice/ananicy-cpp.service
             └─752 /usr/bin/ananicy-cpp start

Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: Ananicy Cpp
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.258] [info] Starting Ananicy
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.263] [warning] cgroup2 at /sys/fs/cgroup/ananicy_test_cgroup2 doesn't have a cpu controller available, skipping
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.263] [info] Creating Cgroups...
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.263] [warning] Cgroups are not available on this platform (or are not enabled)
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.263] [warning] Cgroups are not available on this platform (or are not enabled)
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.263] [warning] Cgroups are not available on this platform (or are not enabled)
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.263] [info] Finished creating Cgroups...
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.265] [info] Doing a full scan
Aug 25 13:58:28 wisejackal-laptop ananicy-cpp[752]: [2025-08-25 13:58:28.280] [info] Worker initialized with 1376 rules

And here after a manual systemctl restart ananicy-cpp.service

 systemctl status ananicy-cpp.service
● ananicy-cpp.service - Ananicy-Cpp - ANother Auto NICe daemon in C++
     Loaded: loaded (/usr/lib/systemd/system/ananicy-cpp.service; enabled; preset: disabled)
     Active: active (running) since Tue 2025-08-26 01:06:55 +08; 5s ago
 Invocation: 76c5493219664c869ef83d40179e5ad8
   Main PID: 150502 (ananicy-cpp)
      Tasks: 4 (limit: 17691)
     Memory: 7.9M (high: 16M, max: 64M, available: 8M, peak: 8.2M)
        CPU: 91ms
     CGroup: /system.slice/ananicy-cpp.service
             └─150502 /usr/bin/ananicy-cpp start

Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.534] [info] Config apply_ionice: true
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.534] [info] Config cgroup_load: true
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.534] [info] Config apply_sched: true
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.534] [info] Config apply_nice: true
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: Ananicy Cpp
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.551] [info] Starting Ananicy
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.552] [info] Creating Cgroups...
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.553] [info] Finished creating Cgroups...
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.554] [info] Doing a full scan
Aug 26 01:06:55 wisejackal-laptop ananicy-cpp[150502]: [2025-08-26 01:06:55.565] [info] Worker initialized with 1376 rules

Wabuo avatar Aug 25 '25 17:08 Wabuo

I have no idea if this is a CachyOS specific issue or if it's an issue with ananicy-cpp, but it feels like something that could be "fixed" for now by CachyOS providing a custom service file as a workaround.

I'll also open an issue over at the ananicy-cpp GitLab repository.

Wabuo avatar Aug 25 '25 17:08 Wabuo

Ok, I found an already existing issue for it — they say it's a distribution issue, so ... it's on us to fix it.

The issue can be found here: https://gitlab.com/ananicy-cpp/ananicy-cpp/-/issues/86

Wabuo avatar Aug 25 '25 17:08 Wabuo

Any updates?

thuyencode avatar Oct 07 '25 09:10 thuyencode

@thuyencode

Try out my solution from the forum, if it works we can try and upstream it, or try and get a patch in to CachyOS ...

So could you please try, To create an overwrite file with the following content:

## Fix ananicy-cpp not starting corectly                                                                                                                                                                           
## specifically complaining about Cgroups not being available or disabled                                                                                                                                          
                                                                                                                                                                                                                   
[Service]                                                                                                                                                                                                          
Delegate=yes                                                                                                                                                                                                       
                                                                                                                                                                                                                   
## ​Delegate=yes tells systemd to delegate management of the cgroup subtree to the service.                                                                                                                         
## This allows ananicy-cpp to create, modify, and manage its own cgroups for the processes it handles,                                                                                                             
## without conflicting with systemd’s overall cgroup management.                                                                                                                                                                                                                                        

  1. sudo systemctl edit ananicy-cpp.service
  • This will create ‘/etc/systemd/system/ananicy-cpp.service.d/override.conf’
  1. copy and paste the above snippet

I like to rename it to tell me what it does, so if I ls the folder I already know what is going on, and it allows to easily have a file for each different reason I had to edit something. Which also means it easy to delete it again instead of finding what I edited in a convoluted file. And probably even more important, it allows for easier automatic updates because the main configuration file can just be updated automatically.

sudo mv '/etc/systemd/system/ananicy-cpp.service.d/override.conf' '/etc/systemd/system/ananicy-cpp.service.d/override-fix_cgroup_not_available_by_adding_delegate-yes.conf

  1. reboot and check if it worked

Do you all think this is a good solution? Should I try and upstream it?


I don’t fully understand the impacts of Delegate=yes and the ramifications / the impact on ananicy-cpp and the whole system. The documentation about it can be found be here: https://systemd.io/CGROUP_DELEGATION/


Let me know how it goes

Wabuo avatar Oct 07 '25 12:10 Wabuo

Ok, I found an already existing issue for it — they say it's a distribution issue, so ... it's on us to fix it.

The issue can be found here: https://gitlab.com/ananicy-cpp/ananicy-cpp/-/issues/86

Adding the overwrite for ananicy-cpp.service worked for me. Thanks.

tailorrr avatar Nov 09 '25 11:11 tailorrr

Cheers for letting me know!

I will try and see if upstream is keen on onboarding this. https://gitlab.com/ananicy-cpp/ananicy-cpp/-/issues/86#note_2911011671

Wabuo avatar Nov 25 '25 00:11 Wabuo

Its already delegated here

https://github.com/CachyOS/CachyOS-Settings/blob/master/usr/lib/systemd/system/user%40.service.d/delegate.conf

vnepogodin avatar Nov 25 '25 04:11 vnepogodin

@vnepogodin Well I just went and tested it.

If I mv the override file away and reboot, I still get the same buggy behavior ...

systemctl status ananicy-cpp.service
● ananicy-cpp.service - Ananicy-Cpp - ANother Auto NICe daemon in C++
     Loaded: loaded (/usr/lib/systemd/system/ananicy-cpp.service; enabled; preset: disabled)
     Active: active (running) since Wed 2025-11-26 11:00:53 +08; 38min ago
 Invocation: 9bfdf22627fe4d3cbf14d0d0e0d66bf8
   Main PID: 692 (ananicy-cpp)
      Tasks: 4 (limit: 17696)
     Memory: 10.5M (high: 16M, max: 64M, available: 5.4M, peak: 11.8M)
        CPU: 1.753s
     CGroup: /system.slice/ananicy-cpp.service
             └─692 /usr/bin/ananicy-cpp start

Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: Ananicy Cpp
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.282] [info] Starting Ananicy
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.284] [warning] cgroup2 at /sys/fs/cgroup/ananicy_test_cgroup2 doesn'>
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.284] [info] Creating Cgroups...
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.284] [warning] Cgroups are not available on this platform (or are no>
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.284] [warning] Cgroups are not available on this platform (or are no>
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.284] [warning] Cgroups are not available on this platform (or are no>
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.284] [info] Finished creating Cgroups...
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.286] [info] Doing a full scan
Nov 26 11:00:53 wisejackal-laptop ananicy-cpp[692]: [2025-11-26 11:00:53.296] [info] Worker initialized with 1564 rules
lines 1-21/21 (END)

Now let me move it back and reboot: sudo mv ./Desktop/override-fix_cgroup_not_available_by_adding_delegate-yes.conf /etc/systemd/system/ananicy-cpp.service.d/override-fix_cgroup_not_available_by_adding_delegate-yes.conf

And it works as intended again:

systemctl status ananicy-cpp.service
● ananicy-cpp.service - Ananicy-Cpp - ANother Auto NICe daemon in C++
     Loaded: loaded (/usr/lib/systemd/system/ananicy-cpp.service; enabled; preset: disabled)
    Drop-In: /etc/systemd/system/ananicy-cpp.service.d
             └─override-fix_cgroup_not_available_by_adding_delegate-yes.conf
     Active: active (running) since Wed 2025-11-26 11:43:42 +08; 1min 24s ago
 Invocation: 93df5ca8b6894b40a66ddffdda63b6e5
   Main PID: 685 (ananicy-cpp)
      Tasks: 4 (limit: 17696)
     Memory: 10.8M (high: 16M, max: 64M, available: 5.1M, peak: 12M)
        CPU: 745ms
     CGroup: /system.slice/ananicy-cpp.service
             └─685 /usr/bin/ananicy-cpp start

Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.786] [info] Config apply_ionice: true
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.786] [info] Config cgroup_load: true
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.786] [info] Config apply_sched: true
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.786] [info] Config apply_nice: true
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: Ananicy Cpp
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.810] [info] Starting Ananicy
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.812] [info] Creating Cgroups...
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.813] [info] Finished creating Cgroups...
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.814] [info] Doing a full scan
Nov 26 11:43:42 wisejackal-laptop ananicy-cpp[685]: [2025-11-26 11:43:42.826] [info] Worker initialized with 1564 rul>
lines 1-23/23 (END)

Wabuo avatar Nov 26 '25 03:11 Wabuo

If you want me to try out something to get to the bottom of this, just let me know.

Wabuo avatar Nov 26 '25 03:11 Wabuo