core: refuse cgroupv1 unless SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE
Also, add a 30s sleep even if cgroup v1 is forced. Closes #30852
This commit is contained in:
+11
-1
@@ -3017,11 +3017,21 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
if (!skip_setup) {
|
||||
/* Before we actually start deleting cgroup v1 code, make it harder to boot
|
||||
* in cgroupv1 mode first. See also #30852. */
|
||||
|
||||
r = mount_cgroup_legacy_controllers(loaded_policy);
|
||||
if (r < 0) {
|
||||
error_message = "Failed to mount cgroup v1 hierarchy";
|
||||
if (r == -ERFKILL)
|
||||
error_message = "Refusing to run under cgroup v1, SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1 not specified on kernel command line";
|
||||
else
|
||||
error_message = "Failed to mount cgroup v1 hierarchy";
|
||||
goto finish;
|
||||
}
|
||||
if (r > 0) {
|
||||
log_full(LOG_CRIT, "Legacy cgroup v1 support selected. This is no longer supported. Will proceed anyway after 30s.");
|
||||
(void) usleep_safe(30 * USEC_PER_SEC);
|
||||
}
|
||||
}
|
||||
|
||||
/* The efivarfs is now mounted, let's lock down the system token. */
|
||||
|
||||
@@ -518,6 +518,9 @@ int mount_cgroup_legacy_controllers(bool loaded_policy) {
|
||||
if (!cg_is_legacy_wanted())
|
||||
return 0;
|
||||
|
||||
if (!cg_is_legacy_force_enabled())
|
||||
return -ERFKILL;
|
||||
|
||||
FOREACH_ARRAY(mp, cgroupv1_mount_table, ELEMENTSOF(cgroupv1_mount_table)) {
|
||||
r = mount_one(mp, loaded_policy);
|
||||
if (r < 0)
|
||||
|
||||
Reference in New Issue
Block a user