Resolve circular dependency loop between nginx and nginx-common

Bug #2081308 reported by Adam Mosseri
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
nginx (Ubuntu)
Fix Released
Undecided
Unassigned
Noble
Fix Committed
Medium
Matthew Ruffell
Oracular
Fix Committed
Medium
Matthew Ruffell

Bug Description

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

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)

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.

[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

Paul White (paulw2u)
affects: ubuntu → nginx (Ubuntu)
tags: added: noble
Revision history for this message
Simon Déziel (sdeziel) wrote :

@Adam, may I ask why you are using exit code 0?
I'm more used to exit code 101 when you want to prevent service restarts for example. Also, I just test with 101 and it doesn't prevent the installation.

https://manpages.ubuntu.com/manpages/noble/man8/invoke-rc.d.8.html#status%20codes

Thomas Ward (teward)
Changed in nginx (Ubuntu):
status: New → Incomplete
Revision history for this message
Adam Mosseri (adam0x) wrote :

I think 101 should prevent the service to start automatically (for example in a chroot) and 0 should do nothing (for example for nginx, let the service start) as it was the behaviour in previous releases.

https://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt
http://jpetazzo.github.io/2013/10/06/policy-rc-d-do-not-start-services-automatically/

Revision history for this message
Simon Déziel (sdeziel) wrote :

Here's a simple way to reproduce the issue (assuming you have LXD installed):

```
lxc launch ubuntu-daily:24.04 n1
echo "exit 0" | lxc exec n1 -- tee /usr/sbin/policy-rc.d
lxc exec n1 -- chmod +x /usr/sbin/policy-rc.d

lxc exec n1 -- apt-get update -qq
lxc exec n1 -- apt-get install -y nginx

lxc shell n1
```

And once inside `n1`, to learn more about where it fails during postinst:

```
sed -i 's|set -e|set -ex|' /var/lib/dpkg/info/nginx.postinst
apt-get install -f
```

Will give this:

```
Setting up nginx (1.24.0-2ubuntu7.1) ...
+ invoke-rc.d --quiet nginx status
+ ss -nlt sport = 80
+ grep -v ^State
+ [ -z ]
+ invoke-rc.d nginx start
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 2024-09-20 18:29:38 UTC; 6ms ago
       Docs: man:nginx(8)
    Process: 1404 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
        CPU: 2ms

Sep 20 18:29:38 n1 systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Sep 20 18:29:38 n1 nginx[1404]: 2024/09/20 18:29:38 [emerg] 1404#1404: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
Sep 20 18:29:38 n1 nginx[1404]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 20 18:29:38 n1 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 20 18:29:38 n1 systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 20 18:29:38 n1 systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server.
+ exit 1
```

So `invoke-rc.d nginx start` tries to start (apparently intentional based on Adam's interpretation of exit code 0) but that is tried before the file `/etc/nginx/nginx.conf` is created. Only `/etc/nginx/nginx.conf.dpkg-new` exist at that point.

It's not clear to me why only the `.dpkg-new` file exist but maybe that's due to the split between `nginx` and `nginx-common` as teward mentioned (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082373)? Trying to install just `nginx-common` doesn't work as that automatically pulls in `nginx` :/

Revision history for this message
Robie Basak (racb) wrote :

Is this the same as https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082373 ? nginx-common and nginx have (I think incorrectly) a dependency loop, which gets broken by dpkg. If nginx-common isn't configured first, then the nginx postinst fails. The solution is to fix the dependency loop which I believe teward is working on.

Revision history for this message
Thomas Ward (teward) wrote :

I already committed to Debian Salsa an unreleased -3 of nginx that resolves this dependency loop. I am going to unilaterally upload that as an RC fix in Debian. From there we can sync to 25.04 and then SRU fix this with high bugfix priority for 24.10 and 24.04.

Changed in nginx (Ubuntu Noble):
status: New → In Progress
Changed in nginx (Ubuntu Oracular):
status: New → In Progress
Changed in nginx (Ubuntu Noble):
importance: Undecided → Medium
Changed in nginx (Ubuntu Oracular):
importance: Undecided → Medium
Changed in nginx (Ubuntu Noble):
assignee: nobody → Matthew Ruffell (mruffell)
Changed in nginx (Ubuntu Oracular):
assignee: nobody → Matthew Ruffell (mruffell)
Changed in nginx (Ubuntu):
status: Incomplete → Fix Released
Revision history for this message
Matthew Ruffell (mruffell) wrote :

Attached is a debdiff for oracular which fixes this issue.

Revision history for this message
Matthew Ruffell (mruffell) wrote :

Attached is a debdiff for noble which solves this issue.

summary: - open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
+ Resolve circular dependency loop between nginx and nginx-common
description: updated
tags: added: oracular sts
Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Adam, or anyone else affected,

Accepted nginx into oracular-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/nginx/1.26.0-2ubuntu3.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-oracular to verification-done-oracular. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-oracular. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in nginx (Ubuntu Oracular):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-oracular
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

teward, "Fixes:" in a changelog doesn't work for Debian bugs though, so the bug is still open ;)

Changed in nginx (Ubuntu Noble):
status: In Progress → Fix Committed
tags: added: verification-needed-noble
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

Hello Adam, or anyone else affected,

Accepted nginx into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/nginx/1.24.0-2ubuntu7.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Revision history for this message
Thomas Ward (teward) wrote :

Timo: The bug was closed in Debian the old ways - by hand. Marked Fixed and Done in Debian, so no the Debian bug isn't open anymore. ;)

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (nginx/1.26.0-2ubuntu3.1)

All autopkgtests for the newly accepted nginx (1.26.0-2ubuntu3.1) for oracular have finished running.
The following regressions have been reported in tests triggered by the package:

cinder/unknown (ppc64el)
libnginx-mod-http-ndk/unknown (ppc64el)
libnginx-mod-http-subs-filter/unknown (ppc64el)
mediawiki/1:1.39.10-1 (i386)
nginx/1.26.0-2ubuntu3.1 (ppc64el)
phpsysinfo/3.4.3-3 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/oracular/update_excuses.html#nginx

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (nginx/1.24.0-2ubuntu7.2)

All autopkgtests for the newly accepted nginx (1.24.0-2ubuntu7.2) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

lemonldap-ng/2.18.2+ds-1 (arm64)
nginx/1.24.0-2ubuntu7.2 (ppc64el)
phpsysinfo/3.4.3-3 (amd64, arm64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/noble/update_excuses.html#nginx

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Matthew Ruffell (mruffell) wrote :
Download full text (6.1 KiB)

Performing verification for Oracular

I deployed a fresh oracular VM, and set up policy-rc.d just like the testcase:

$ sudo apt install -y nginx
Installing:
  nginx

Installing dependencies:
  nginx-common

Suggested packages:
  fcgiwrap nginx-doc ssl-cert

Summary:
  Upgrading: 0, Installing: 2, Removing: 0, Not Upgrading: 35
  Download size: 631 kB
  Space needed: 1811 kB / 7268 MB available

Get:1 http://archive.ubuntu.com/ubuntu oracular/main amd64 nginx-common all 1.26.0-2ubuntu3 [30.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu oracular/main amd64 nginx amd64 1.26.0-2ubuntu3 [600 kB]
Fetched 631 kB in 2s (321 kB/s)
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 76072 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.26.0-2ubuntu3_all.deb ...
Unpacking nginx-common (1.26.0-2ubuntu3) ...
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 Mon 2025-02-10 02:07:58 UTC; 7ms ago
 Invocation: a2e2d2a579f54fe78b9cf60d88bac56a
       Docs: man:nginx(8)
    Process: 1632 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
   Mem peak: 1.5M
        CPU: 3ms

Feb 10 02:07:58 oracular-aaa systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Feb 10 02:07:58 oracular-aaa nginx[1632]: 2025/02/10 02:07:58 [emerg] 1632#1632: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
Feb 10 02:07:58 oracular-aaa nginx[1632]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 10 02:07:58 oracular-aaa systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Feb 10 02:07:58 oracular-aaa systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 10 02:07:58 oracular-aaa 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...

Read more...

tags: added: verification-done-oracular
removed: verification-needed-oracular
Revision history for this message
Matthew Ruffell (mruffell) wrote :
Download full text (6.7 KiB)

Performing verification for noble.

I deployed a fresh noble vm, and set up policy-rc.d just like the testcase describes.

$ sudo apt install -y nginx
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  nginx-common
Suggested packages:
  fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  nginx nginx-common
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 552 kB of archives.
After this operation, 1596 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 nginx-common all 1.24.0-2ubuntu7.1 [31.2 kB]
Get:2 http://archive.ubuntu.com/ubuntu noble-updates/main amd64 nginx amd64 1.24.0-2ubuntu7.1 [521 kB]
Fetched 552 kB in 3s (186 kB/s)
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 74736 files and directories currently installed.)
Preparing to unpack .../nginx-common_1.24.0-2ubuntu7.1_all.deb ...
Unpacking nginx-common (1.24.0-2ubuntu7.1) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.24.0-2ubuntu7.1_amd64.deb ...
Unpacking nginx (1.24.0-2ubuntu7.1) ...
Setting up nginx (1.24.0-2ubuntu7.1) ...
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 Mon 2025-02-10 02:15:30 UTC; 5ms ago
       Docs: man:nginx(8)
    Process: 1372 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
        CPU: 1ms

Feb 10 02:15:30 noble-aaa systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Feb 10 02:15:30 noble-aaa nginx[1372]: 2025/02/10 02:15:30 [emerg] 1372#1372: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
Feb 10 02:15:30 noble-aaa nginx[1372]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 10 02:15:30 noble-aaa systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Feb 10 02:15:30 noble-aaa systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 10 02:15:30 noble-aaa 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.24.0-2ubuntu7.1.1~); however:
  Package nginx is not configured yet.

dpkg: error processing package nginx-common (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                           ...

Read more...

tags: added: verification-done-noble
removed: verification-needed verification-needed-noble
Revision history for this message
Guillaume (e1msih) wrote :

I'm also interested by a fix for noble, since it also fails when installing manually the package :

Preparing to unpack .../nginx-common_1.24.0-2ubuntu7.1_all.deb ...
Unpacking nginx-common (1.24.0-2ubuntu7.1) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.24.0-2ubuntu7.1_amd64.deb ...
Unpacking nginx (1.24.0-2ubuntu7.1) ...
Setting up nginx (1.24.0-2ubuntu7.1) ...
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 Tue 2025-02-11 10:05:17 CET; 11ms ago
       Docs: man:nginx(8)
    Process: 155932 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
        CPU: 3ms

Feb 11 10:05:17 ugexesos02 systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Feb 11 10:05:17 ugexesos02 nginx[155932]: 2025/02/11 10:05:17 [emerg] 155932#155932: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
Feb 11 10:05:17 ugexesos02 nginx[155932]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 11 10:05:17 ugexesos02 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Feb 11 10:05:17 ugexesos02 systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 11 10:05:17 ugexesos02 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.24.0-2ubuntu7.1.1~); however:
  Package nginx is not configured yet.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

There is a problem here. When I install just nginx-common from noble-proposed, it won't pull in nginx as before, which is what this change intended. But nginx-common ships a service, and that service fails:

$ sudo systemctl status nginx
× 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 Thu 2025-02-20 18:16:29 UTC; 10s ago
       Docs: man:nginx(8)
    Process: 2728 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=203/EXEC)

Feb 20 18:16:29 n-nginx systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Feb 20 18:16:29 n-nginx systemd[1]: nginx.service: Control process exited, code=exited, status=203/EXEC
Feb 20 18:16:29 n-nginx systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 20 18:16:29 n-nginx systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server.

There is no error in the logs:

$ l /var/log/nginx/
total 0
drwxr-xr-x 1 root adm 38 Feb 20 18:16 .
drwxrwxr-x 1 root syslog 286 Feb 20 18:16 ..
-rw-r----- 1 www-data adm 0 Feb 20 18:16 access.log
-rw-r----- 1 www-data adm 0 Feb 20 18:16 error.log

The nginx.service file tries to run /usr/sbin/nginx, but that binary does not exist in nginx-common:

$ dpkg -L nginx-common|grep bin
$

It is shipped by bin:nginx, as expected:
$ sudo apt install nginx -y
(...)
$ dpkg -L nginx|grep bin
/usr/sbin
/usr/sbin/nginx

I didn't see this discussed in the SRU template, so I'm raising it now. Was this considered? Thought of? Is it a surprise?

While we are getting the policy-rc.d usage fixed I suppose, we are breaking the simple case of installing a single package. I understand this might require deeper package surgery, and would perhaps not be a good choice for an SRU.

Revision history for this message
Matthew Ruffell (mruffell) wrote :

Hi Andreas,

Thanks for pointing this out. It is a surprise. I should have thought to check
that.

If we look at the situation on plucky / debian unstable:

$ sudo apt install nginx-common
...
Get:1 http://archive.ubuntu.com/ubuntu plucky/main amd64 nginx-common all 1.26.3-2ubuntu1 [43.4 kB]
...
Preparing to unpack .../nginx-common_1.26.3-2ubuntu1_all.deb ...
Unpacking nginx-common (1.26.3-2ubuntu1) ...
Setting up nginx-common (1.26.3-2ubuntu1) ...
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.
...
$ sudo systemctl status nginx
× 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 Thu 2025-02-20 23:13:37 UTC; 17s ago
 Invocation: 1e5f3a887a7944eabc463b549735371b
       Docs: man:nginx(8)
    Process: 1572 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=203/EXEC)
   Mem peak: 1.6M
        CPU: 2ms

Feb 20 23:13:37 plucky-aaa systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server...
Feb 20 23:13:37 plucky-aaa (nginx)[1572]: nginx.service: Unable to locate executable '/usr/sbin/nginx': No such file or directory
Feb 20 23:13:37 plucky-aaa (nginx)[1572]: nginx.service: Failed at step EXEC spawning /usr/sbin/nginx: No such file or directory
Feb 20 23:13:37 plucky-aaa systemd[1]: nginx.service: Control process exited, code=exited, status=203/EXEC
Feb 20 23:13:37 plucky-aaa systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 20 23:13:37 plucky-aaa systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server.

The same thing.

Do you have any thoughts teward? I can open a Debian bug.

Thanks,
Matthew

tags: added: verification-failed-noble verification-failed-oracular
removed: verification-done-noble verification-done-oracular
Revision history for this message
Thomas Ward (teward) wrote :

I think the peoblem is multifold and endemic to the Debian approach of 'flavor packages'. The problem is splitting out the nginx binary components because there are still things that haooen between the flavors with binary compile-level stuff because not every module is dynamic.

Open the bug in Debian *if you can reproduce it there* as a new bug. I'm thinking in Debian we may need to make a separate nginx-service or such that might install the SystemD service indeoendently but that introduces a major alteration to the packaging splitting out the nginx service files from -common.

(upstream nginx doesnt have flavors and similarly Apache doesn't either so this makes nginx a... little bit unique.)

Revision history for this message
Matthew Ruffell (mruffell) wrote :
Revision history for this message
Thomas Ward (teward) wrote :

Salsa bug for discussion on 1098477 is https://salsa.debian.org/nginx-team/nginx/-/issues/23 - we usually do the team discussions on Salsa there.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.