Attached is a debdiff for noble which fixes this issue V2

** Description changed:

  [Impact]
  
  If you use policy-rc.d to prevent unattended-upgrades from restarting your
  services outside of a reboot or shutdown, it reveals a circular dependency
  loop between nginx and nginx-common, where it cannot start nginx before
  nginx-common is configured.
  
  systemd[1]: Starting nginx.service - A high performance web server and a 
reverse proxy server...
  nginx[1634]: 2025/02/07 02:21:56 [emerg] 1634#1634: open() 
"/etc/nginx/nginx.conf" failed (2: No such file or directory)
  nginx[1634]: nginx: configuration file /etc/nginx/nginx.conf test failed
  ...
  dpkg: error processing package nginx (--configure):
-  installed nginx package post-installation script subprocess returned error 
exit status 1
+  installed nginx package post-installation script subprocess returned error 
exit status 1
  dpkg: dependency problems prevent configuration of nginx-common:
-  nginx-common depends on nginx (<< 1.26.0-2ubuntu3.1~); however:
-   Package nginx is not configured yet.
+  nginx-common depends on nginx (<< 1.26.0-2ubuntu3.1~); however:
+   Package nginx is not configured yet.
  
  dpkg: error processing package nginx-common (--configure):
-  dependency problems - leaving unconfigured
-  
+  dependency problems - leaving unconfigured
+ 
  The solution is to remove the circular dependency, by dropping the dependency 
for
  nginx from nginx-common, as suggested by Thomas Ward.
  
  [Testcase]
  
  Deploy a fresh Noble or Oracular VM.
  
  1) sudo vim /usr/sbin/policy-rc.d
  #!/bin/sh
  
  exit 0
  2) sudo chmod 755 /usr/sbin/policy-rc.d
  3) sudo apt update
  4) sudo apt install -y nginx
  Selecting previously unselected package nginx.
  Preparing to unpack .../nginx_1.26.0-2ubuntu3_amd64.deb ...
  Unpacking nginx (1.26.0-2ubuntu3) ...
  Setting up nginx (1.26.0-2ubuntu3) ...
  Job for nginx.service failed because the control process exited with error 
code.
  See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for 
details.
  invoke-rc.d: initscript nginx, action "start" failed.
  × nginx.service - A high performance web server and a reverse proxy server
-      Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; preset: 
enabled)
-      Active: failed (Result: exit-code) since Fri 2025-02-07 02:21:56 UTC; 
8ms ago
-  Invocation: 774e214ca6b04b2dbea5569234bfdb4b
-        Docs: man:nginx(8)
-     Process: 1634 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; 
master_process on; (code=exited, status=1/FAILURE)
-    Mem peak: 1.4M
-         CPU: 3ms
+      Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; preset: 
enabled)
+      Active: failed (Result: exit-code) since Fri 2025-02-07 02:21:56 UTC; 
8ms ago
+  Invocation: 774e214ca6b04b2dbea5569234bfdb4b
+        Docs: man:nginx(8)
+     Process: 1634 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; 
master_process on; (code=exited, status=1/FAILURE)
+    Mem peak: 1.4M
+         CPU: 3ms
  
  systemd[1]: Starting nginx.service - A high performance web server and a 
reverse proxy server...
  nginx[1634]: 2025/02/07 02:21:56 [emerg] 1634#1634: open() 
"/etc/nginx/nginx.conf" failed (2: No such file or directory)
  nginx[1634]: nginx: configuration file /etc/nginx/nginx.conf test failed
  systemd[1]: nginx.service: Control process exited, code=exited, 
status=1/FAILURE
  systemd[1]: nginx.service: Failed with result 'exit-code'.
  systemd[1]: Failed to start nginx.service - A high performance web server and 
a reverse proxy server.
  dpkg: error processing package nginx (--configure):
-  installed nginx package post-installation script subprocess returned error 
exit status 1
+  installed nginx package post-installation script subprocess returned error 
exit status 1
  dpkg: dependency problems prevent configuration of nginx-common:
-  nginx-common depends on nginx (<< 1.26.0-2ubuntu3.1~); however:
-   Package nginx is not configured yet.
+  nginx-common depends on nginx (<< 1.26.0-2ubuntu3.1~); however:
+   Package nginx is not configured yet.
  
  dpkg: error processing package nginx-common (--configure):
-  dependency problems - leaving unconfigured
+  dependency problems - leaving unconfigured
  Processing triggers for ufw (0.36.2-6) ...
  No apport report written because the error message indicates its a followup 
error from a previous failure.
-                                                                               
                            Processing triggers for man-db (2.12.1-3) ...
+                                                                               
                            Processing triggers for man-db (2.12.1-3) ...
  Errors were encountered while processing:
-  nginx
-  nginx-common
+  nginx
+  nginx-common
  needrestart is being skipped since dpkg has failed
  Error: Sub-process /usr/bin/dpkg returned an error code (1)
  
  Test packages are available in the following ppa:
  
  https://launchpad.net/~mruffell/+archive/ubuntu/sf405956-updates
  
  If you install the test package, you can install nginx correctly with
  policy-rc.d.
  
  We also need to test the upgrade path from old packages to new packages to
  ensure there are no dependency issues.
  
  [Where problems can occur]
  
  We are changing the dependencies on the nginx-common package to not point back
  to nginx. nginx already depends on nginx-common, so we shouldn't be dropping
  any dependencies in the process.
  
  If a regression were to occur, it would happen during apt dependency 
resolution
  or package installation time, which for a lot of users will be handled by
- unattended-upgrades, and might trigger nginx service restarts. 
+ unattended-upgrades, and might trigger nginx service restarts.
  
  [Other info]
  
  This was fixed in debian in 1.26.0-3 by Thomas Ward
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082373
+ 
https://salsa.debian.org/nginx-team/nginx/-/commit/0722a5648de88e45079f9c7c4efa9271df0d12bf
+ 
+ We needed a further fix to the nginx-common nginx.service file, documented in:
+ https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1098477
+ https://salsa.debian.org/nginx-team/nginx/-/issues/23
+ 
https://salsa.debian.org/nginx-team/nginx/-/commit/54cc7989701eb5d8ff561c6891f0a819cc54dcae
+ 
https://salsa.debian.org/nginx-team/nginx/-/commit/bfbdc5aef2d486391f4ca542c23d6ecf52b34d72

** Patch removed: "Debdiff for nginx on plucky"
   
https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/2081308/+attachment/5880529/+files/lp2081308_plucky.debdiff

** Patch removed: "Debdiff for nginx on oracular"
   
https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/2081308/+attachment/5880530/+files/lp2081308_oracular_V2.debdiff

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

Title:
  Resolve circular dependency loop between nginx and nginx-common

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


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to