Snapd with unified cgroup hierarchy

Last week, we have started looking into supporting a unified cgroup hierarchy (cgroupv2) in snapd. This topic shall gather information about progress and issues that come up.

So far I have been collecting notes in a gist: https://gist.github.com/bboozzoo/76b1535c93686a27bb7fdbaad0f560f7 but eventually this should all end up here.

Related:

Intial PR by @mvo adds a warning message and attempts to degrade the functionality, rather than failing right away: https://github.com/snapcore/snapd/pull/7109

As hinted by the gist, intial work was done on Fedora 31. The branch provided here https://github.com/snapcore/snapd/pull/7193 is a collection of all changes that were required to build snapd on Fedora 31. Thanks to @cachio a Fedora 31 image, with cgroupv2 enabled OOTB is available for spread. Spread summary when running spread manually:

2019-07-30 11:54:59 Successful tasks: 339
2019-07-30 11:54:59 Aborted tasks: 0
2019-07-30 11:54:59 Failed tasks: 16
    - google:fedora-30-64-unified:tests/main/cgroup-freezer
    - google:fedora-30-64-unified:tests/main/cgroup-pids
    - google:fedora-30-64-unified:tests/main/document-portal-activation
    - google:fedora-30-64-unified:tests/main/interfaces-calendar-service
    - google:fedora-30-64-unified:tests/main/interfaces-contacts-service
    - google:fedora-30-64-unified:tests/main/interfaces-packagekit-control
    - google:fedora-30-64-unified:tests/main/refresh-app-awareness
    - google:fedora-30-64-unified:tests/main/selinux-clean
    - google:fedora-30-64-unified:tests/main/selinux-lxd
    - google:fedora-30-64-unified:tests/main/snap-run
    - google:fedora-30-64-unified:tests/main/stale-base-snap
    - google:fedora-30-64-unified:tests/main/xdg-open
    - google:fedora-30-64-unified:tests/main/xdg-settings
    - google:fedora-30-64-unified:tests/regression/rhbz-1584461
    - google:fedora-30-64-unified:tests/smoke/install
    - google:fedora-30-64-unified:tests/upgrade/basic
2019-07-30 11:54:59 Failed task restore: 1
    - google:fedora-30-64-unified:tests/main/selinux-lxd
error: unsuccessful run

Complete log is available here: https://paste.ubuntu.com/p/xWDFrYy9d9/

List of failed tasks on F30, with 5.1.9 kernel & unified cgroup hierarchy.

2019-07-31 15:49:52 Successful tasks: 346
2019-07-31 15:49:52 Aborted tasks: 0
2019-07-31 15:49:52 Failed tasks: 9
    - google:fedora-30-64-unified:tests/main/cgroup-freezer
    - google:fedora-30-64-unified:tests/main/cgroup-pids
    - google:fedora-30-64-unified:tests/main/document-portal-activation
    - google:fedora-30-64-unified:tests/main/refresh-app-awareness
    - google:fedora-30-64-unified:tests/main/stale-base-snap
    - google:fedora-30-64-unified:tests/main/xdg-open
    - google:fedora-30-64-unified:tests/main/xdg-settings
    - google:fedora-30-64-unified:tests/smoke/install
    - google:fedora-30-64-unified:tests/upgrade/basic
2019-07-31 15:49:52 Failed task restore: 1
    - google:fedora-30-64-unified:tests/main/selinux-lxd

The tests/main/selinux-lxd restore failure is caused by the test itself. So we’re ~9 affected tests. Most are expected.