#916122 pbuilder: misleading warning about missing cgroups

#916122#5
Date:
2018-12-10 11:22:09 UTC
From:
To:
Dear maintainer,

I noticed that pbuilder prints a warning at the beginning of each build
that cgroups are not available:

# grep cgroup /proc/mounts
cgroup /sys/fs/cgroup cgroup rw,relatime,cpuset,cpu,cpuacct,blkio,memory,devices,freezer,net_cls,perf_event,net_prio,pids 0 0

pbuilder assumes that cgroup support is only available on systems with systemd.
But they can also be used with some basic file system operations in the cgroup
mount point.

Please change the warning message to something like:
"W: cgroup support is currenly only implemented for hosts running systemd"

(Or instead add cgroup support independent of systemd (and change
severity to wishlist) ;) )

Kind regards,
  Reiner

#916122#10
Date:
2019-01-06 10:47:03 UTC
From:
To:
rw,relatime,cpuset,cpu,cpuacct,blkio,memory,devices,freezer,net_cls,perf_event
,net_prio,pids 0 0
systemd.
cgroup

Also, I also have the message while I *am* using systemd as init system.

Regards.

#916122#13
Date:
2019-01-07 15:03:56 UTC
From:
To:
Most likely that's a different issue, filed as #917354
Check your system with `systemctl list-units --failed`.

#916122#18
Date:
2019-01-07 17:01:01 UTC
From:
To:
Indeed, my system is basically half the time in degraded mode:

root@scapa:~# systemctl is-system-running
degraded
root@scapa:~# echo $?
1
root@scapa:~# systemctl --failed
  UNIT                      LOAD   ACTIVE
SUB    DESCRIPTION
● mnt-scapa\x2dbackup.mount loaded failed failed /mnt/scapa-backup

(this is my external backup drive). Thanks for the tip anyway.

Regards,

#916122#23
Date:
2024-01-10 17:30:27 UTC
From:
To:
We still have pbuilder version 0.231 for current Debian OS 12 (Bookworm)
and warning message about not using cgroups is still shown.

It is in shell script file "/usr/lib/pbuilder/pbuilder-checkparams":

1) The check in line 398 "systemctl is-system-running --quiet >/dev/null
2>&1" returns with shell exit code 1 which must 0 and if-condition using
cgroups is never fulfilled.

2) Semantically, the if-condition in line 398 and 394 does not work
anymore for newer bash releases

391     if [ "$USECGROUP" = "yes" ]; then
392         # v215 is required for systemd-escape
393         if systemctl is-system-running --quiet >/dev/null 2>&1 && \
394                 dpkg --compare-versions "$(dpkg-query -W
--showformat='${Version}' systemd)" gt 215; then
395             # --description uses that no-spaces string because the
quoting sucks
396             # right now, and it would end up trying to execute
$PBUILDER_OPERATION…
397             # long-term solution is to turn $CHROOTEXEC into a
command and properly
398             # use arrays instead of plain strings.
399
             SYSTEMD_SLICE="system-pbuilder-${PBUILDER_OPERATION}${1:+-"$(systemd-escape "$(basename "$1" .dsc)")"}-$$.slice"
400             systemctl_run=(
401                 systemd-run
402                 --quiet
403                 --scope
404
                 --description="pbuilder_${PBUILDER_OPERATION}${1:+_"$(basename "$1")"}"
405                 --slice="$SYSTEMD_SLICE"
406             )
407             CHROOTEXEC="${systemctl_run[*]} $CHROOTEXEC"
408         else
409             log.w "cgroups are not available on the host, not using
them."
410             USECGROUP=not-available
411         fi


I changed the code in this way from line 393 until 395:

391     if [ "$USECGROUP" = "yes" ]; then
392         # v215 is required for systemd-escape
393         _systemd_ver=$(systemd --version | grep 'systemd' | sed -r
's/(^systemd[[:blank:]]+)([0-9]{3})(.*$)/\2/')
394
395         if [[ ${_systemd_ver} -gt 215 ]] ; then
396             # --description uses that no-spaces string because the
quoting sucks
397             # right now, and it would end up trying to execute
$PBUILDER_OPERATION…
398             # long-term solution is to turn $CHROOTEXEC into a
command and properly
399             # use arrays instead of plain strings.
400
             SYSTEMD_SLICE="system-pbuilder-${PBUILDER_OPERATION}${1:+-"$(systemd-escape "$(basename "$1" .dsc)")"}-$$.slice"
401             systemctl_run=(
402                 systemd-run
403                 --quiet
404                 --scope
405
                 --description="pbuilder_${PBUILDER_OPERATION}${1:+_"$(basename "$1")"}"
406                 --slice="$SYSTEMD_SLICE"
407             )
408             CHROOTEXEC="${systemctl_run[*]} $CHROOTEXEC"
409         else
410             log.w "cgroups are not available on the host, not using
them."
411             USECGROUP=not-available
412         fi

1) Problematic check if systemd is running was eliminated, it was
introduced with Debian 8, long time ago. So systemd is status quo!

2) The evaluation of the systemd version is done in line 393 using the
"systemd --version" command

3) Line 395, simplified expression in if-clause, executing shell
commands in clause will/may not work anymore like in my case

On Mon, 07 Jan 2019 18:01:01 +0100 Yves-Alexis Perez <corsac@debian.org> wrote: