I was able to re-produce this in a different way, but I'm pretty sure
it's the same bug that affects you. For scope units in particular, the
RuntimeMaxSec property is not applied correctly when systemd is
reloaded. E.g., if I run:

$ systemd-run --scope -u foo-1.scope /usr/bin/foo
$ mkdir -p /etc/systemd/system/foo-.scope.d/
$ cat > /etc/systemd/system/foo-.scope.d/override.conf << EOF
[Scope]
RuntimeMaxSec=10s
$ systemctl daemon-reload

Then foo-1.scope just keeps running. The setting is applied correctly if
I restart foo-1.scope, however. Running the same test for a service unit
results in the RuntimeMaxSec value being applied correctly, and the unit
is terminated.

I have built and tested a fix in ppa:enr0n/systemd-251. Does that fix
your issue?

** Changed in: systemd (Ubuntu)
   Importance: Undecided => Low

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2015126

Title:
  systemd doesn't successfully enforce RuntimeMaxSec for gnome session

Status in systemd package in Ubuntu:
  New

Bug description:
  On Jammy, I have configured systemd to set RuntimeMaxSec on certain
  user sessions:

  # cat /run/systemd/transient/session-43.scope 
  # This is a transient unit file, created programmatically via the systemd 
API. Do not edit.
  [Scope]
  Slice=user-1000.slice

  [Unit]
  Description=Session 43 of User xavier
  Wants=user-runtime-dir@1000.service
  Wants=user@1000.service
  After=systemd-logind.service
  After=systemd-user-sessions.service
  After=user-runtime-dir@1000.service
  After=user@1000.service
  RequiresMountsFor=/home/xavier

  [Scope]
  SendSIGHUP=yes
  TasksMax=infinity
  RuntimeMaxSec=2h
  #

  I have verified that this does what's expected on an ssh session, and
  kills the session when the runtime max has been reached.

  But on a GNOME login session (using X), this apparently doesn't work:
  the session is still running 17 hours after it should have been
  terminated.

  My guess is that systemd is ending the session by sending a signal
  that is being ignored by the GNOME login session?

  RuntimeMaxSec is not very useful if it's advisory...

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: systemd 249.11-0ubuntu3.7
  ProcVersionSignature: Ubuntu 5.19.0-38.39~22.04.1-generic 5.19.17
  Uname: Linux 5.19.0-38-generic x86_64
  ApportVersion: 2.20.11-0ubuntu82.3
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Mon Apr  3 12:20:22 2023
  InstallationDate: Installed on 2023-01-22 (70 days ago)
  InstallationMedia: Ubuntu 22.04.1 LTS "Jammy Jellyfish" - Release amd64 
(20220809.1)
  MachineType: LENOVO 2306CTO
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.19.0-38-generic 
root=UUID=c415e6a8-5cd2-4d08-913d-14c00b792374 ro quiet splash vt.handoff=7
  SourcePackage: systemd
  UpgradeStatus: No upgrade log present (probably fresh install)
  dmi.bios.date: 10/25/2013
  dmi.bios.release: 2.57
  dmi.bios.vendor: LENOVO
  dmi.bios.version: G2ET97WW (2.57 )
  dmi.board.asset.tag: Not Available
  dmi.board.name: 2306CTO
  dmi.board.vendor: LENOVO
  dmi.board.version: Not Defined
  dmi.chassis.asset.tag: No Asset Information
  dmi.chassis.type: 10
  dmi.chassis.vendor: LENOVO
  dmi.chassis.version: Not Available
  dmi.ec.firmware.release: 1.13
  dmi.modalias: 
dmi:bvnLENOVO:bvrG2ET97WW(2.57):bd10/25/2013:br2.57:efr1.13:svnLENOVO:pn2306CTO:pvrThinkPadX230:rvnLENOVO:rn2306CTO:rvrNotDefined:cvnLENOVO:ct10:cvrNotAvailable:skuLENOVO_MT_2306:
  dmi.product.family: ThinkPad X230
  dmi.product.name: 2306CTO
  dmi.product.sku: LENOVO_MT_2306
  dmi.product.version: ThinkPad X230
  dmi.sys.vendor: LENOVO

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2015126/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to