Nginx issue on bootup

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.4
Webmin version 2.111
Usermin version 2.010
Virtualmin version 7.10.0 Pro
Theme version 21.10
Package updates All installed packages are up to date

How is the issue with Nginx not starting on boot not fixed yet?
At least this “quick fix” can be added? if the issue is that it is trying to start before network is available. (as that seems to fix it)

in /lib/systemd/system/nginx.service
Change After=network.target to After=network-online.target

So people don’t need to remember to do that manually every time if they did not “fix it” by them self already.

We don’t generally modify upstream packages. The nginx package is provided by Ubuntu. And, it’s a problem that is specific to some network configurations (it is still not clear to me what makes it happen, but it doesn’t happen on my test system). So, if there isn’t already a bug filed with the Ubuntu folks, there probably should be.

If you’re modifying a service file like this, you should first copy it to /etc/systemd/system/nginx.service and modify it there, so it won’t be overwritten on updates to the nginx package.

There is at least one Ubuntu bug about it: Bug #1850272 “nginx wont be started (needs network-online.target...” : Bugs : nginx package : Ubuntu

Specifically, the reason they haven’t changed it is stated here: Comment #12 : Bug #1850272 : Bugs : nginx package : Ubuntu

And, another: Bug #1666368 “[Ubuntu 16.04] nginx won't start on boot while net...” : Bugs : nginx package : Ubuntu

I note the older ticket indicates Fedora/RHEL have “fixed” this problem, but on my EL systems, the systemd unit also has After=network.target and not After=network-online.target. I’m not sure what they’re doing differently, if it does, in fact, behave differently in whatever circumstance cause the problem (but we’ve never had a report of a problem on any of the EL distros, that I’m aware of, so I’m inclined to think it doesn’t happen there).

But, the consensus across all distros we support seems to be that network.target is the right thing.

I don’t know what the right thing for us to do would be, but mucking about with upstream packaged systemd unit files continues to feel quite wrong.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.