Report.get_logind_session fails to determine session on cgroup2 systems

Bug #2043393 reported by Benjamin Drung
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Apport
Fix Released
Medium
Unassigned
apport (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Ubuntu >= 22.04 uses only cgroup2 (Ubuntu 20.04 used both and Ubuntu 18.04 only cgroup version 1). Report.get_logind_session will fail to determine the logind session and always return None if only cgroup2 is used.

get_logind_session searches for cgroup lines with "name=systemd:" and then extracts the session from "/session-". This worked in Ubuntu 16.04 but started failing in 18.04.

Content of /proc/self/cgroup when printed from a terminal inside a Ubuntu desktop session:

Ubuntu 16.04 (xenial)
---------------------

```
12:cpuset:/
11:perf_event:/
10:pids:/user.slice/user-1000.slice
9:blkio:/
8:hugetlb:/
7:net_cls,net_prio:/
6:cpu,cpuacct:/
5:devices:/user.slice
4:freezer:/
3:rdma:/
2:memory:/
1:name=systemd:/user.slice/user-1000.slice/session-c1.scope
```

Ubuntu 18.04 (bionic)
---------------------

```
12:freezer:/
11:net_cls,net_prio:/
10:memory:/
9:rdma:/
8:cpu,cpuacct:/
7:devices:/user.slice
6:perf_event:/
5:cpuset:/
4:pids:/user.slice/user-1000.slice/user@1000.service
3:hugetlb:/
2:blkio:/
1:name=systemd:/user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service
0::/user.slice/user-1000.slice/user@1000.service/gnome-terminal-server.service
```

Ubuntu 20.04 (focal)
---------------------

```
13:memory:/user.slice/user-1000.slice/user@1000.service
12:perf_event:/
11:misc:/
10:pids:/user.slice/user-1000.slice/user@1000.service
9:hugetlb:/
8:cpuset:/
7:blkio:/
6:devices:/user.slice
5:cpu,cpuacct:/
4:freezer:/
3:rdma:/
2:net_cls,net_prio:/
1:name=systemd:/user.slice/user-1000.slice/user@1000.service/apps.slice/apps-org.gnome.Terminal.slice/vte-spawn-ad936f4d-0d62-4ac4-bbd8-0e766d8a3b1f.scope
0::/user.slice/user-1000.slice/user@1000.service/apps.slice/apps-org.gnome.Terminal.slice/vte-spawn-ad936f4d-0d62-4ac4-bbd8-0e766d8a3b1f.scope
```

Ubuntu 22.04 (jammy)
---------------------

```
0::/user.slice/user-1000.slice/user@1000.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-0c3f8b02-b112-4cab-accc-764cbb223bac.scope
```

Benjamin Drung (bdrung)
description: updated
Revision history for this message
Benjamin Drung (bdrung) wrote :

I checked the bug reports against apport between 2018 and now, but I found none complaining about this regression. If no one objects (and provides a way to determine the current session and the session of a process), I will remove that code.

Benjamin Drung (bdrung)
Changed in apport:
milestone: none → 2.28.0
Benjamin Drung (bdrung)
Changed in apport (Ubuntu):
importance: Undecided → Medium
Changed in apport:
importance: Undecided → Medium
Revision history for this message
Benjamin Drung (bdrung) wrote :

Remove skipping crashes that happened during logout: https://github.com/canonical/apport/pull/278

Changed in apport:
status: New → In Progress
Benjamin Drung (bdrung)
Changed in apport (Ubuntu):
status: New → Triaged
Revision history for this message
Benjamin Drung (bdrung) wrote :
Changed in apport:
status: In Progress → Fix Committed
Benjamin Drung (bdrung)
Changed in apport:
status: Fix Committed → Fix Released
Benjamin Drung (bdrung)
Changed in apport (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.28.0-0ubuntu1

---------------
apport (2.28.0-0ubuntu1) noble; urgency=medium

  * New upstream release
    - ui: remove skipping crashes that happened during logout (LP: #2043393)
    - setup: set minimum Java release to 8 (LP: #2045705)
    - support systemd-coredump as core dump handler (LP: #2048136)
  * Drop patches that were applied upstream
  * Address pylint complaints in patches and package hooks
  * Replace build dependency pkg-config by pkgconf
  * Suggest python3-zstandard in python3-problem-report for read support

 -- Benjamin Drung <email address hidden> Thu, 22 Feb 2024 15:20:00 +0100

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.