** Description changed:

  [ Impact ]
  
  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 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.
+ A user hits this through socket activation: on Noble, authd opts into
+ FileDescriptorStorePreserve=yes, and an upgrade or restart can leave
+ authd.socket and authd.service stopped. The attached verify-socket-
+ fdstore.sh reproduces that systemd behavior with a minimal socket and
+ service pair, so no authd setup is needed to verify it. All steps as
+ root on a disposable Noble VM or container.
  
  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. 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.
+ 4. The system boots normally and `systemctl is-system-running` reports
+ no new failures.
  
  [ Where problems could occur ]
  
- 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.
+ The patch lets a socket start or return to listening while its service
+ is dead-resources-pinned. An Accept=no socket reopened while its service
+ actually runs would leave new clients hanging, because the service keeps
+ the old listening socket. A re-activated service could also receive the
+ wrong descriptor. The script covers both: the first two checks assert
+ the descriptor comes back, the third asserts the refusal. No unit
+ shipped in Noble sets FileDescriptorStorePreserve=yes.
  
  [ Other Info ]
  
- 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.
+ The fix shipped in systemd v257 and is already in Resolute, Stonking, and 
Tenacious.
  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.
+ Verified on Noble: the stock package fails both activation paths, and a
+ PID 1 rebuilt with this patch passes every check. The script also passes
+ on Resolute, which already has the fix.

** Description changed:

  [ Impact ]
  
  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
+ (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 ]
  
  A user hits this through socket activation: on Noble, authd opts into
  FileDescriptorStorePreserve=yes, and an upgrade or restart can leave
  authd.socket and authd.service stopped. The attached verify-socket-
  fdstore.sh reproduces that systemd behavior with a minimal socket and
  service pair, so no authd setup is needed to verify it. All steps as
  root on a disposable Noble VM or container.
  
  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. All checks pass and the script exits 0:
  
         PASS: reactivate
         PASS: reopen
         PASS: socket start refused while the service is running
  
  4. The system boots normally and `systemctl is-system-running` reports
  no new failures.
  
  [ Where problems could occur ]
  
  The patch lets a socket start or return to listening while its service
  is dead-resources-pinned. An Accept=no socket reopened while its service
  actually runs would leave new clients hanging, because the service keeps
  the old listening socket. A re-activated service could also receive the
  wrong descriptor. The script covers both: the first two checks assert
  the descriptor comes back, the third asserts the refusal. No unit
  shipped in Noble sets FileDescriptorStorePreserve=yes.
  
  [ Other Info ]
  
  The fix shipped in systemd v257 and is already in Resolute, Stonking, and 
Tenacious.
  Upstream: https://github.com/systemd/systemd/pull/33874
  
  Verified on Noble: the stock package fails both activation paths, and a
  PID 1 rebuilt with this patch passes every check. The script also passes
  on Resolute, which already has the fix.

-- 
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