/* First, attach the PID to the main cgroup hierarchy */
q = cg_attach(SYSTEMD_CGROUP_CONTROLLER, p, pid);
if (q < 0) {
- log_unit_debug_errno(u, q, "Couldn't move process " PID_FMT " to requested cgroup '%s': %m", pid, p);
+ bool again = MANAGER_IS_USER(u->manager) && ERRNO_IS_PRIVILEGE(q);
- if (MANAGER_IS_USER(u->manager) && ERRNO_IS_PRIVILEGE(q)) {
+ log_unit_full_errno(u, again ? LOG_DEBUG : LOG_INFO, q,
+ "Couldn't move process "PID_FMT" to%s requested cgroup '%s': %m",
+ pid, again ? " directly" : "", p);
+
+ if (again) {
int z;
- /* If we are in a user instance, and we can't move the process ourselves due to
- * permission problems, let's ask the system instance about it instead. Since it's more
- * privileged it might be able to move the process across the leaves of a subtree who's
- * top node is not owned by us. */
+ /* If we are in a user instance, and we can't move the process ourselves due
+ * to permission problems, let's ask the system instance about it instead.
+ * Since it's more privileged it might be able to move the process across the
+ * leaves of a subtree whose top node is not owned by us. */
z = unit_attach_pid_to_cgroup_via_bus(u, pid, suffix_path);
if (z < 0)
- log_unit_debug_errno(u, z, "Couldn't move process " PID_FMT " to requested cgroup '%s' via the system bus either: %m", pid, p);
+ log_unit_info_errno(u, z, "Couldn't move process "PID_FMT" to requested cgroup '%s' (directly or via the system bus): %m", pid, p);
else
continue; /* When the bus thing worked via the bus we are fully done for this PID. */
}