Alessandro Baggi
2020-Jun-16 06:11 UTC
[CentOS] Apache (httpd) fails to start at boot - Centos 8.1
Il 16/06/20 06:21, Gordon Messmer ha scritto:> On 6/15/20 7:06 PM, Jay Hart wrote: >> If I do 'systemctl start httpd', apache will start right up.? But >> during boot, it doesn't and I >> get the resulting errors below. >> >> Jun 15 21:17:28 dream httpd[1534]: (99)Cannot assign requested >> address: AH00072: make_sock: could >> not bind to address 10.20.30.11:80 > > > httpd is starting before an interface has been configured with 10.20.30.11. > > The default configuration starts httpd after "network.target" but you > want to start it after "network-online.target". > > IIRC: run "systemctl edit httpd.service" and insert: > > [Unit] > After=network-online.target > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos+1 This happened to me with ssh.
Alessandro Baggi
2020-Jun-16 06:15 UTC
[CentOS] Apache (httpd) fails to start at boot - Centos 8.1
Il 16/06/20 08:11, Alessandro Baggi ha scritto:> > > Il 16/06/20 06:21, Gordon Messmer ha scritto: >> On 6/15/20 7:06 PM, Jay Hart wrote: >>> If I do 'systemctl start httpd', apache will start right up.? But >>> during boot, it doesn't and I >>> get the resulting errors below. >>> >>> Jun 15 21:17:28 dream httpd[1534]: (99)Cannot assign requested >>> address: AH00072: make_sock: could >>> not bind to address 10.20.30.11:80 >> >> >> httpd is starting before an interface has been configured with >> 10.20.30.11. >> >> The default configuration starts httpd after "network.target" but you >> want to start it after "network-online.target". >> >> IIRC: run "systemctl edit httpd.service" and insert: >> >> [Unit] >> After=network-online.target >> >> _______________________________________________ >> CentOS mailing list >> CentOS at centos.org >> https://lists.centos.org/mailman/listinfo/centos > > > +1 > > This happened to me with ssh.Note: when you will get update for httpd package all could be reverted to the original status, so to avoid that your modified httpd.service will get an overwrite, create an alternative httpd.service in /etc/systemd/system (if I'm not wrong). Probably there is a new way to do this.
Simon Matter
2020-Jun-16 07:07 UTC
[CentOS] Apache (httpd) fails to start at boot - Centos 8.1
> > > Il 16/06/20 08:11, Alessandro Baggi ha scritto: >> >> >> Il 16/06/20 06:21, Gordon Messmer ha scritto: >>> On 6/15/20 7:06 PM, Jay Hart wrote: >>>> If I do 'systemctl start httpd', apache will start right up.? But >>>> during boot, it doesn't and I >>>> get the resulting errors below. >>>> >>>> Jun 15 21:17:28 dream httpd[1534]: (99)Cannot assign requested >>>> address: AH00072: make_sock: could >>>> not bind to address 10.20.30.11:80 >>> >>> >>> httpd is starting before an interface has been configured with >>> 10.20.30.11. >>> >>> The default configuration starts httpd after "network.target" but you >>> want to start it after "network-online.target". >>> >>> IIRC: run "systemctl edit httpd.service" and insert: >>> >>> [Unit] >>> Afteretwork-online.target >>> >>> _______________________________________________ >>> CentOS mailing list >>> CentOS at centos.org >>> https://lists.centos.org/mailman/listinfo/centos >> >> >> +1 >> >> This happened to me with ssh. > > Note: when you will get update for httpd package all could be reverted > to the original status, so to avoid that your modified httpd.service > will get an overwrite, create an alternative httpd.service in > /etc/systemd/system (if I'm not wrong).That's half right now, but still not good enough. If the RPM provided file changes, your copy won't get those changes. To make this work better, don't put the full file in /etc/systemd/system but just add an override.conf there which is like a diff to the original file. That way updates of the RPM are handled correctly. Simon
Anthony K
2020-Jun-16 07:34 UTC
[CentOS] Apache (httpd) fails to start at boot - Centos 8.1
On 16/6/20 4:15 pm, Alessandro Baggi wrote:> > Note: when you will get update for httpd package all could be reverted > to the original status, so to avoid that your modified httpd.service > will get an overwrite, create an alternative httpd.service in > /etc/systemd/system (if I'm not wrong). > > Probably there is a new way to do this. >The new way to do this is exactly what Gordon suggested - using `systemctl edit <servicename>` creates an override in `/etc/systemd/system/httpd.service.d/override.conf`. The only issue is that there is no `systemctl` related command to remove this override - you will have to remember to `rm -rf /etc/systemd/system/httpd.service.d` if/when you want to remove that override.