Getting `Refusing to run under cgroup v1` at boot after update

I’m getting this error Refusing to run under cgroup v1, SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1 not specified on kernel command line at boot after update on latest nixos-unstable. From what I can see this is very likely because of a systemd update, not a kernel update.

If I do as told and I add boot.kernelParams = [ "SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1" ]; to my config (which, by the way, it didn’t even show me the entire message on the screen, I had to search for it to realise what I had to do) the system boots normally but it boots much slower than it does usually.

So why am I getting this? I don’t even use cgroups at all, so it must be something else Nix is doing.

My config is here. Sorry in advance for my custom modules.

I think that NixOS is (idk) utilizing cgroups internally even if not set. if you run systemd-cgls you can see the control groups. NixOS has shifted to a newer version of systemd which enforces cgroup v2 so
the reason the boot is slower is because you enabled compatibility which can slow down the process.

Just realised what’s going on, I have ananicy enabled in my config. That uses cgroups. Disabling it and the kernel parameter makes everything work normally. I’ll make an issue on nixpkgs too about this, maybe even on ananicy-cpp itself too.

I have just now run into it as well. I had "systemd.unified_cgroup_hierarchy=false" in boot.kernelParams which was a workaround required for nvidia-docker.

Yeah, sure, you can use that, but it won’t work permanently. cgroupsv1 are deprecated in systemd and will be removed for good one day

This has been fixed and will land on unstable in the coming days: Remove support for legacy cgroup hierachy by arianvp · Pull Request #331248 · NixOS/nixpkgs · GitHub

If there are any other uses of cgroupsv1 that we missed, please file reports.

1 Like

I just ran into this. What else could be depending on this besides containerization stuff?

I had this on boot and I looked around which one to disable first on my config and I lucked out on nailing Waydroid first. No more Stage 2 issues.