** 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 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. dpkg: error processing package nginx-common (--configure): 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. + Start a fresh 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 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 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. dpkg: error processing package nginx-common (--configure): 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) ... Errors were encountered while processing: nginx nginx-common needrestart is being skipped since dpkg has failed Error: Sub-process /usr/bin/dpkg returned an error code (1) + Additionally, if we just install nginx-common, nginx should not be + pulled in as a dependency, and the systemd service should not be running + without the nginx package installed: + + $ sudo apt install nginx-common + Installing: + nginx-common + + Summary: + Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 84 + Download size: 43.3 kB + Space needed: 238 kB / 7258 MB available + + Get:1 http://archive.ubuntu.com/ubuntu oracular-updates/main amd64 nginx-common all 1.26.0-2ubuntu3.2 [43.3 kB] + Fetched 43.3 kB in 1s (43.4 kB/s) + Preconfiguring packages ... + Selecting previously unselected package nginx-common. + (Reading database ... 76069 files and directories currently installed.) + Preparing to unpack .../nginx-common_1.26.0-2ubuntu3.2_all.deb ... + Unpacking nginx-common (1.26.0-2ubuntu3.2) ... + Setting up nginx-common (1.26.0-2ubuntu3.2) ... + Created symlink '/etc/systemd/system/multi-user.target.wants/nginx.service' → '/usr/lib/systemd/system/nginx.service'. + Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 148. + Processing triggers for ufw (0.36.2-6) ... + + $ systemctl status nginx.service + × nginx.service - A high performance web server and a reverse proxy server + Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled) + Active: failed (Result: exit-code) since Tue 2025-05-27 04:19:32 UTC; 20s ago + Invocation: 9fd4a72806db4a3da5109206a3508ba5 + Docs: man:nginx(8) + Process: 1713 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=203/EXEC) + Mem peak: 1.4M + CPU: 2ms + + May 27 04:19:32 oracular-nginx systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server... + May 27 04:19:32 oracular-nginx (nginx)[1713]: nginx.service: Unable to locate executable '/usr/sbin/nginx': No such file or directory + May 27 04:19:32 oracular-nginx (nginx)[1713]: nginx.service: Failed at step EXEC spawning /usr/sbin/nginx: No such file or directory + May 27 04:19:32 oracular-nginx systemd[1]: nginx.service: Control process exited, code=exited, status=203/EXEC + May 27 04:19:32 oracular-nginx systemd[1]: nginx.service: Failed with result 'exit-code'. + May 27 04:19:32 oracular-nginx systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server. + + 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. + policy-rc.d. Also, if you just install nginx-common only, the systemd + service will not be started. 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. [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
** 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 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. dpkg: error processing package nginx-common (--configure): 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] Start a fresh 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 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 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. dpkg: error processing package nginx-common (--configure): 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) ... Errors were encountered while processing: nginx nginx-common needrestart is being skipped since dpkg has failed Error: Sub-process /usr/bin/dpkg returned an error code (1) - Additionally, if we just install nginx-common, nginx should not be - pulled in as a dependency, and the systemd service should not be running - without the nginx package installed: + Additionally, if we just install nginx-common, nginx should not be pulled in as + a dependency, and the systemd service should not be running without the nginx + package installed: $ sudo apt install nginx-common - Installing: - nginx-common + Installing: + nginx-common Summary: - Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 84 - Download size: 43.3 kB - Space needed: 238 kB / 7258 MB available + Upgrading: 0, Installing: 1, Removing: 0, Not Upgrading: 84 + Download size: 43.3 kB + Space needed: 238 kB / 7258 MB available Get:1 http://archive.ubuntu.com/ubuntu oracular-updates/main amd64 nginx-common all 1.26.0-2ubuntu3.2 [43.3 kB] - Fetched 43.3 kB in 1s (43.4 kB/s) + Fetched 43.3 kB in 1s (43.4 kB/s) Preconfiguring packages ... Selecting previously unselected package nginx-common. (Reading database ... 76069 files and directories currently installed.) Preparing to unpack .../nginx-common_1.26.0-2ubuntu3.2_all.deb ... Unpacking nginx-common (1.26.0-2ubuntu3.2) ... Setting up nginx-common (1.26.0-2ubuntu3.2) ... Created symlink '/etc/systemd/system/multi-user.target.wants/nginx.service' → '/usr/lib/systemd/system/nginx.service'. Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 148. Processing triggers for ufw (0.36.2-6) ... - $ systemctl status nginx.service + $ systemctl status nginx.service × nginx.service - A high performance web server and a reverse proxy server - Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled) - Active: failed (Result: exit-code) since Tue 2025-05-27 04:19:32 UTC; 20s ago - Invocation: 9fd4a72806db4a3da5109206a3508ba5 - Docs: man:nginx(8) - Process: 1713 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=203/EXEC) - Mem peak: 1.4M - CPU: 2ms + Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled) + Active: failed (Result: exit-code) since Tue 2025-05-27 04:19:32 UTC; 20s ago + Invocation: 9fd4a72806db4a3da5109206a3508ba5 + Docs: man:nginx(8) + Process: 1713 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=203/EXEC) + Mem peak: 1.4M + CPU: 2ms May 27 04:19:32 oracular-nginx systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server... May 27 04:19:32 oracular-nginx (nginx)[1713]: nginx.service: Unable to locate executable '/usr/sbin/nginx': No such file or directory May 27 04:19:32 oracular-nginx (nginx)[1713]: nginx.service: Failed at step EXEC spawning /usr/sbin/nginx: No such file or directory May 27 04:19:32 oracular-nginx systemd[1]: nginx.service: Control process exited, code=exited, status=203/EXEC May 27 04:19:32 oracular-nginx systemd[1]: nginx.service: Failed with result 'exit-code'. May 27 04:19:32 oracular-nginx systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server. - 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. Also, if you just install nginx-common only, the systemd service will not be started. 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. [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 ** Tags removed: verification-failed-noble verification-failed-oracular ** Tags added: plucky -- 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 [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
