<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://dev1galaxy.org/extern.php?action=feed&amp;tid=8273&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / elogind leaks session cgroups]]></title>
		<link>http://dev1galaxy.org/viewtopic.php?id=8273</link>
		<description><![CDATA[The most recent posts in elogind leaks session cgroups.]]></description>
		<lastBuildDate>Wed, 04 Nov 2026 08:27:26 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: elogind leaks session cgroups]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=66388#p66388</link>
			<description><![CDATA[<p>For us it is called elogind-daemon. Maybe that changed between excalibur and freia?</p><p>The problem with wrong permissions in the ~/.cache file seems to be unrelated, our script does not do anything there.</p><p>Btw. the cron config we use is /etc/cron.d/session_cgroups_cleanup</p><div class="codebox"><pre><code>20 * * * * root /usr/local/bin/session-cgroups-cleanup.sh &gt;&gt; /var/log/session-cgroups-cleanup.log 2&gt;&amp;1</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (markus23)]]></author>
			<pubDate>Wed, 04 Nov 2026 08:27:26 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=66388#p66388</guid>
		</item>
		<item>
			<title><![CDATA[Re: elogind leaks session cgroups]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=66375#p66375</link>
			<description><![CDATA[<p>If I run that script manually, I get an error message that elogind-daemon is not running. I checked &#039;ps&#039; and I agree that it&#039;s not running, but elogind is running. I changed one line in the script from</p><div class="codebox"><pre><code>if ! pgrep -x elogind-daemon &gt; /dev/null</code></pre></div><p> to </p><div class="codebox"><pre><code>if ! pgrep -x elogind &gt; /dev/null</code></pre></div><p> and the error message goes away. </p><p>Script works to remove cruft in /sys/fs/cgroups, but it doesn&#039;t fix a different problem I have in the freia desktop-live iso - gparted works on first login but does not start on subsequent logins. Message in /var/log/auth.log is &quot;The gnome keyring socket is not owned with the same credentials as the user login: /home/devuan/.cache/keyring-4FE4X3/control&quot;&#160; I&#039;m not sure if it&#039;s supposed to fix that.</p>]]></description>
			<author><![CDATA[dummy@example.com (fsmithred)]]></author>
			<pubDate>Tue, 03 Nov 2026 15:06:02 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=66375#p66375</guid>
		</item>
		<item>
			<title><![CDATA[Re: elogind leaks session cgroups]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=66368#p66368</link>
			<description><![CDATA[<p>Thanks for confirming that this could be the issue and might be fixed with next stable release. Will Devuan take this into a point release or will this have to wait until Freia?</p><p>We already have a working solution from Paul Bachinger, we can share it:</p><div class="codebox"><pre class="vscroll"><code>#!/usr/bin/env bash

# elogind without systemd creates one cgroup per login session directly
# below the cgroup root, named after the session ID, and never removes it.

# License you can choose either:
# Perma License to be published at https://www.perma.health
# AGPL
# BSD-3-Clause
# MIT

# Install the script to run about hourly.

# This script will not be needed after bug is fixed:
# patched on the 257 stable branch, so should be in release 257.17
# https://dev1galaxy.org/viewtopic.php?pid=66324#p66324

# Detailed problem:
# Leaked cgroups exhaust the kernel&#039;s memory cgroup IDs, after which e.g. Docker
# can no longer start containers (&quot;mkdir ...: device or resource busy&quot;).

set -euo pipefail

CGROUP_ROOT=/sys/fs/cgroup
LOCK_FILE=/run/lock/session-cgroups-cleanup.lock

exec 9&gt; &quot;$LOCK_FILE&quot;

if ! flock --nonblock 9
then
  echo &quot;$(date): Another session cgroups cleanup is active; skipping&quot;
  exit 0
fi

if ! pgrep -x elogind-daemon &gt; /dev/null
then
  echo &quot;$(date): elogind is not running; skipping&quot;
  exit 0
fi

ACTIVE_SESSIONS=&quot; $(
  timeout 30 loginctl list-sessions --no-legend | awk &#039;{ print $1 }&#039; | tr &#039;\n&#039; &#039; &#039;
) &quot;

# Session IDs increase monotonically. A session newer than this snapshot
# may not have moved its first process into its cgroup yet, so only IDs up
# to the highest known session are removed.
MAX_ACTIVE_SESSION=&quot;$(
  tr &#039; &#039; &#039;\n&#039; &lt;&lt;&lt; &quot;$ACTIVE_SESSIONS&quot; | grep -E &#039;^[0-9]+$&#039; | sort -n | tail -1 || true
)&quot;

if [[ -z &quot;$MAX_ACTIVE_SESSION&quot; ]]
then
  echo &quot;$(date): No numeric elogind sessions found; skipping&quot;
  exit 0
fi

REMOVED_COUNT=0

while IFS= read -r -d &#039;&#039; cgroup
do
  session=&quot;${cgroup##*/}&quot;

  if (( session &gt; MAX_ACTIVE_SESSION ))
  then
    continue
  fi

  if [[ &quot;$ACTIVE_SESSIONS&quot; == *&quot; $session &quot;* ]]
  then
    continue
  fi

  if ! grep -qx &#039;populated 0&#039; &quot;$cgroup/cgroup.events&quot;
  then
    continue
  fi

  # rmdir is refused by the kernel for cgroups that still have processes or children
  if rmdir -- &quot;$cgroup&quot; 2&gt; /dev/null
  then
    REMOVED_COUNT=$((REMOVED_COUNT + 1))
  fi
done &lt; &lt;(
  find &quot;$CGROUP_ROOT&quot; \
    -mindepth 1 \
    -maxdepth 1 \
    -type d \
    -regextype posix-extended \
    -regex &#039;.*/[0-9]+&#039; \
    -print0
)

echo &quot;$(date): Removed session cgroups: $REMOVED_COUNT&quot;
echo &quot;$(date): Remaining cgroups: $(awk &#039;/^nr_descendants /{ print $2 }&#039; &quot;$CGROUP_ROOT/cgroup.stat&quot;)&quot;</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (markus23)]]></author>
			<pubDate>Tue, 03 Nov 2026 03:56:13 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=66368#p66368</guid>
		</item>
		<item>
			<title><![CDATA[Re: elogind leaks session cgroups]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=66359#p66359</link>
			<description><![CDATA[<p>yeh, seems like it is patched on the 257 stable branch but that branch has had no release since june with 257.16 and devuan unstable ships 257.13 so it is a matter of waiting for the commits to land in a release and the release packaged by devuan...</p><p>on the meantime perhaps cobbling a sort of &quot;hook&quot; script to run at the elogind session end, perhaps a simple daemon to compare the output of <span class="bbc">loginctl list-sessions</span> with the subdirs of /sys/fs/cgroup/* and prune the missing ones, doing some quick commands the terminal <span class="bbc">loginctl list-sessions | tail -n +2 | head -n -2 | awk &#039;{print $1}&#039;</span> gets only the current active session ids, may cobble a simple daemon later</p>]]></description>
			<author><![CDATA[dummy@example.com (EDX-0)]]></author>
			<pubDate>Mon, 02 Nov 2026 18:18:47 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=66359#p66359</guid>
		</item>
		<item>
			<title><![CDATA[Re: elogind leaks session cgroups]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=66325#p66325</link>
			<description><![CDATA[<p>Upstream bug might be <a href="https://github.com/elogind/elogind/issues/381" rel="nofollow">https://github.com/elogind/elogind/issues/381</a></p>]]></description>
			<author><![CDATA[dummy@example.com (markus23)]]></author>
			<pubDate>Sun, 01 Nov 2026 09:25:21 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=66325#p66325</guid>
		</item>
		<item>
			<title><![CDATA[elogind leaks session cgroups]]></title>
			<link>http://dev1galaxy.org/viewtopic.php?pid=66324#p66324</link>
			<description><![CDATA[<p>Server: Devuan 6 excalibur in a VM</p><p>Problem: elogind (sysvinit hosts) creates one cgroup per login session at /sys/fs/cgroup/&lt;session-id&gt; and never removes it. On one server a CheckMK&#039;s per-minute SSH logins leaked 65533 of them, which exhausted the kernel&#039;s memory cgroup IDs and made every docker build/docker run fail with device or resource busy.</p><p>Workaround: hourly cron job that does cleanup</p><p>Is this a known problem? Is there a better solution?</p>]]></description>
			<author><![CDATA[dummy@example.com (markus23)]]></author>
			<pubDate>Sun, 01 Nov 2026 09:17:46 +0000</pubDate>
			<guid>http://dev1galaxy.org/viewtopic.php?pid=66324#p66324</guid>
		</item>
	</channel>
</rss>
