** Description changed:

  [ Impact ]
  
- On Noble, systemd 255 can treat a stopped service as active when it
- still has saved file descriptors (dead-resources-pinned with
- FileDescriptorStorePreserve=yes). systemd can refuse to reopen the
- socket, or a connection to a socket left open can fail to start the
- service.
+ On Noble, systemd 255 treats a stopped service that keeps its stored
+ file descriptors (FileDescriptorStorePreserve=yes) as still active
+ (SubState dead-resources-pinned). The socket unit then refuses to start
+ with "Socket service ... already active, refusing", and does not return
+ to listening, so the service cannot be re-activated through its socket.
  
  In the authd migration tests, upgrading from the stable PPA left
  authd.socket and authd.service stopped:
  https://github.com/canonical/authd/issues/2317
  
  The authd packaging patch (https://github.com/canonical/authd/pull/2318)
  keeps the socket open during upgrades on Noble. Manual socket restarts
  can still fail.
  
  [ Test Plan ]
  
- All steps as root on a disposable Noble VM. The attached sru-fdstore-test.sh
- creates temporary units under /run/systemd/system that opt into
- FileDescriptorStorePreserve=yes (no default Noble unit does) and cleans them
- up afterwards.
+ All steps as root on a disposable Noble VM or container. The attached
+ verify-socket-fdstore.sh creates temporary units under
+ /run/systemd/system that opt into FileDescriptorStorePreserve=yes (no
+ unit shipped in Noble sets it) and removes them again on exit.
  
- 1. Run: bash sru-fdstore-test.sh
-    On the stock package both activation paths fail: the script prints
-    "FAIL: ..." lines and exits non-zero; the journal shows
-    "Socket service ... already active, refusing."
+ 1. Confirm the bug on the stock package:
+ 
+        bash verify-socket-fdstore.sh
+ 
+    Both activation paths fail and the script exits 1. The journal shows
+ "Socket service ... already active, refusing":
+ 
+        FAIL: reactivate
+        FAIL: reopen
  
  2. Install the update and reboot so the new PID 1 runs:
-    sudo apt install -t noble-proposed systemd && reboot
  
- 3. Run the script again. Expect:
-    PASS: start activated the service with its original descriptor
-    PASS: reactivate activated the service with its original descriptor
-    PASS: systemd still refused to start the socket while the service was 
active
+        sudo apt install -t noble-proposed systemd
+        reboot
  
- 4. Common-use check: after the reboot the system boots normally,
-    `systemctl is-system-running` reports running/degraded without new
-    failures, and journald works.
+ 3. Run the script again. All checks pass and the script exits 0:
+ 
+        PASS: reactivate
+        PASS: reopen
+        PASS: socket start refused while the service is running
+ 
+ 4. After the reboot the system boots normally and `systemctl is-system-
+ running` reports no new failures.
  
  [ Where problems could occur ]
  
- If systemd reopens an Accept=no socket while its service is still
- running, new clients could connect but get no response: the service
- still holds the old listening socket. The test checks that systemd still
- refuses to reopen it.
+ The patch widens the service states in which a socket may start or
+ return to listening. If systemd reopened an Accept=no socket while its
+ service was running, new connections would reach the new listening
+ socket and hang, since the service keeps the old one. A re-activated
+ service could also receive the wrong descriptor. The script covers both
+ risks: the first two checks assert the stored descriptor is returned by
+ name, the third asserts the refusal. Only services that set
+ FileDescriptorStorePreserve=yes are affected; no unit shipped in Noble
+ sets it.
  
  [ Other Info ]
  
- The fix shipped in systemd v257 and is already in Resolute, Stonking, and 
Tenacious.
+ The fix shipped in systemd v257 and is already in Resolute, Stonking, and 
Tenacious. It is not in any v255 stable release, hence the targeted backport 
instead of a v255.y microrelease.
  Upstream: https://github.com/systemd/systemd/pull/33874
+ 
+ Verified before filing: on stock Noble both activation paths fail, and
+ with this patch rebuilt into the running PID 1 every check passes.

** Bug watch removed: github.com/canonical/authd/issues #2317
   https://github.com/canonical/authd/issues/2317

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2176110

Title:
  Noble: socket activation fails with a preserved fd store

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


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to