Bug 1438079

Summary: snapd is incompatible with unified cgroup hierarchy
Product: [Fedora] Fedora Reporter: Zbigniew Jędrzejewski-Szmek <zbyszek>
Component: snapdAssignee: Zygmunt Krynicki <me>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: maciek.borzecki, me, nerijus, ngompa13
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: snapd-2.41-1.fc31 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-09-14 00:10:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Zbigniew Jędrzejewski-Szmek 2017-03-31 20:03:24 UTC
Description of problem:
It's not something that matters much right now, but as people will be moving to unified cgroup hierarchy, this will matter more.
/usr/lib/udev/snappy-app-dev hardcodes paths which are specific to legacy hierarchy (and assumes that devices controller is mounted...).

Version-Release number of selected component (if applicable):
snapd-2.23.6-1.fc27

Expected results:
All code which touches cgroups is ready for legacy and unified hierarchies.

Comment 1 Zbigniew Jędrzejewski-Szmek 2017-03-31 20:05:15 UTC
The udev rules are in snap-confine-2.23.6-1.fc26.x86_64.rpm actually.

Comment 2 Zbigniew Jędrzejewski-Szmek 2017-03-31 20:10:55 UTC
So there's snap-confine in dist git, but snap-confine is now built from snapd. Confusing!

Comment 3 Zygmunt Krynicki 2017-04-04 07:13:00 UTC
Thank you for the bug report. We will look at solving this!

Comment 4 Zbigniew Jędrzejewski-Szmek 2018-11-04 16:01:52 UTC
It doesn't work in general on v2:

$ sudo snap run --shell hello-fedora
cannot open tasks file for freezer cgroup hierarchy for snap hello-fedora: No such file or directory

Comment 5 Neal Gompa 2019-07-04 11:14:00 UTC
Zygmunt, Maciek, what is the progress on this?

Fedora 31 will be moving to CGroups v2, so snaps will be dead in the water on F31 GA if it isn't fixed in time...

Comment 6 Maciek Borzecki 2019-07-25 14:00:28 UTC
We've made some initial progress. I'm currently looking into a way to group the processes of a given snap, so that we can freeze and count them without jumping around the `system.slice` and `user.slice` hierarchies.

We can do that right now with v1 by using controllers that aren't used by systemd and creating separate groups there. The snap-confine tool would place the process under the right group before exec()'ing the snap payload.

With v2, it seems system services from snaps can be easily addressed by setting up slices for each snap. However, I'm seeing more problems with user started applications and services. Those are reasonably placed under user-*.slice/user@*.service/{,session-*}. Even if we create a subtree there, we'd still need to check 2-3 places to get the information about running processes or to freeze them.

For now, I only managed to achieve the same by moving from under the cgroup created by systemd to another one, something we should not do. Perhaps we'll manage to discuss some ideas during Flock too.

Comment 7 Fedora Update System 2019-09-06 20:36:11 UTC
FEDORA-2019-bb0a25e48d has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2019-bb0a25e48d

Comment 8 Fedora Update System 2019-09-07 16:57:38 UTC
snapd-2.41-1.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-bb0a25e48d

Comment 9 Fedora Update System 2019-09-14 00:10:27 UTC
snapd-2.41-1.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2019-09-14 16:33:55 UTC
snapd-2.41-1.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.