troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
633 stars 64 forks source link

Failure to write to cgroup settings in Linux 5.3 #215

Closed troglobit closed 2 years ago

troglobit commented 2 years ago

Older kernels (5.3.x) with so-so support for cgroups v2 can succeed mounting, but fail later on when writing settings:

● ● ●  myLinux 2021.11-11[    1.543112] finit[1]:myLinux 2021.11-1172-g6e4791b751, entering runlevel S
72-g6e4791b751 ════════════════�[    1.543928] finit[1]:cgset():Failed setting /sys/fs/cgroup/init/cpu.weight = 100: Permission denied
��═══════════════
[    1.570365] finit[1]:cgset():Failed setting /sys/fs/cgroup/system/cpu.weight = 9800: Permission denied
[    1.584195] finit[1]:cgset():Failed setting /sys/fs/cgroup/user/cpu.weight = 100: Permission denied
[ ⋯  ] Remounting / as read-write[    1.631782] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ OK ] 
[ OK ] Mounting filesystems
[    1.662035] finit[1]:ln():Failed creating /run/lock -> /var/lock symlink: File exists
[ ⋯  ] Populating device tree[    1.805306] random: fast init done
[ OK ] 
[ OK ] Cold plugging system
[    2.502257] finit[1]:Failed restoring system clock from RTC.
[ ⋯  ] Restoring system clock (UTC)[    2.502317] finit[1]:RTC has no previously saved (valid) time.
[ ⋯  ] Restoring system clock (UTC)[    2.510405] finit[1]:Resetting RTC to kernel default, 2000-01-01 00:00.
[WARN] TC
[ ⋯  [    2.522561] random: crng init done
[ OK ] trapping random seed
[ OK ] Initializing random number generator
[    2.556704] finit[1]:cgset():Failed setting /sys/fs/cgroup/init/cpu.weight = 100: Permission denied
[    2.568188] finit[1]:cgset():Failed setting /sys/fs/cgroup/system/cpu.weight = 9800: Permission denied
[    2.577719] finit[1]:cgset():Failed setting /sys/fs/cgroup/user/cpu.weight = 100: Permission denied

We should add this as well to the detection mechanism for cgroups v2 kernel support.

troglobit commented 2 years ago

After further investigation, this looks like it's just the cpu controller that's unsupported smh on this kernel. Meaning, we need more fine grained control of capabilities. Disable them one by one as we learn.

liuming50 commented 2 years ago

@troglobit I also observed a similar issue, which could be fixed by this: https://github.com/troglobit/finit/pull/217 per my test.

troglobit commented 2 years ago

Yup thanks! I have a few more fixes for this in my $HOME patch queue, will push later tonight.