Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cant start apache [Solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 417

PostPosted: Sun Nov 15, 2015 10:01 pm    Post subject: cant start apache [Solved] Reply with quote

Today I had to change the router TP-LINK for ZyXEL. After reboot hostname has changed from localhost to dhcppc1.
Quote:
/etc/host
127.0.0.1 localhost
::1 localhost
/etc/conf.d/hostname
Quote:
hostname="localhost"
and
Quote:
# echo $HOSTNAME
dhcppc1
Quote:
# /etc/init.d/apache2 restart
* Starting apache2 ...
* start-stop-daemon: failed to start `/usr/sbin/apache2' [ !! ]
* ERROR: apache2 failed to start
I have to say, that I am confused and do not know how to fix it.

Last edited by apiaio on Mon Nov 23, 2015 6:04 pm; edited 1 time in total
Back to top
View user's profile Send private message
Buffoon
Veteran
Veteran


Joined: 17 Jun 2015
Posts: 1369
Location: EU or US

PostPosted: Sun Nov 15, 2015 10:07 pm    Post subject: Reply with quote

Configure your DHCP client not to pull hostname from DHCP server. Or even better, do not use DHCP at all.
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 417

PostPosted: Mon Nov 16, 2015 4:56 pm    Post subject: Reply with quote

Let's say solved. Apache works after editing /etc/dhdcpcd.conf
Quote:
nooption option

but I am not absolutely satisfied. After connecting to the router HOSTAME is still dhcppcX.
I am not able
Quote:
Configure your DHCP client not to pull hostname from DHCP server.
as Buffoon suggested. How to do that?
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 417

PostPosted: Tue Nov 17, 2015 7:10 pm    Post subject: Reply with quote

Unfortunatelly
Quote:
nooption option
is not the best solution too. E.g. after rebooting from Windows apache doesnt start. I do not know why. So that I removed apache from startup services and after reboot when I neet to use apache I run
Code:
sysctl kernel.hostname=localhost
/etc/init.d/apache2 start
But main problem, that ZyXEL assigns hostname of my comp persists.
Back to top
View user's profile Send private message
kikko
Apprentice
Apprentice


Joined: 29 Apr 2014
Posts: 276
Location: Milan, IT

PostPosted: Tue Nov 17, 2015 7:30 pm    Post subject: Reply with quote

Hi apiaio
which dhcp client are you using? There is a pretty big difference between e.g. dhclient and dhcpcd
On the other hand, you can also configure your dhcp server (the ZyXEL AP) to not push the hostname for your internal network

Regards
_________________
Regards

root is the root of all evil
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 417

PostPosted: Tue Nov 17, 2015 8:19 pm    Post subject: Reply with quote

Hi kikko.

Using dhcpcd. Concerning hostname I am not sure if is possible to change ZyXEL's configuration.
But I am sure that must exists the way how to ignore sent hostname.
I have installed Sabayon, which hostname is aswell overwritten by hostname sent by server, but apache starts without any problems.
Back to top
View user's profile Send private message
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 977
Location: Somewhere in Denmark

PostPosted: Tue Nov 17, 2015 8:43 pm    Post subject: Reply with quote

Then I'd start comparing the apache-configs ;)
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 417

PostPosted: Wed Nov 18, 2015 3:52 pm    Post subject: Reply with quote

freke wrote:
Then I'd start comparing the apache-configs ;)
I did, but no significant differencies found. Concerning dhcpcd config's files dhdcpcd.conf are the same and others is not compareble becouse my Gentoo uses OpenRC and SL Systemd.
Back to top
View user's profile Send private message
kikko
Apprentice
Apprentice


Joined: 29 Apr 2014
Posts: 276
Location: Milan, IT

PostPosted: Wed Nov 18, 2015 9:35 pm    Post subject: Reply with quote

Hi apiaio
you should try to start httpd daemon directly on the command line, in order to get more "valuable" output
commands are like this:
  • Configuration check
    Code:
    /sbin/httpd -f /etc/apache2/httpd.conf -t

  • Start
    Code:
    /sbin/httpd -f /etc/apache2/httpd.conf -k start

Check it, I'm not 100% sure about httpd location :P
Regards
_________________
Regards

root is the root of all evil
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 417

PostPosted: Thu Nov 19, 2015 3:15 pm    Post subject: Reply with quote

Sorry kikko.
I cant locate httpd in /bin or /sbin neither Gentoo nor SL.
Back to top
View user's profile Send private message
freke
l33t
l33t


Joined: 23 Jan 2003
Posts: 977
Location: Somewhere in Denmark

PostPosted: Thu Nov 19, 2015 5:22 pm    Post subject: Reply with quote

for Gentoo that'd be /usr/sbin/apache2 instead of /usr/(s)bin/httpd
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 417

PostPosted: Mon Nov 23, 2015 9:09 am    Post subject: Reply with quote

Quote:
dhcppc1 miro # sysctl kernel.hostname=localhost
kernel.hostname = localhost
dhcppc1 miro # /usr/sbin/apache2 -f /etc/apache2/httpd.conf -t
apache2: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
Syntax OK
dhcppc1 miro # /usr/sbin/apache2 -f /etc/apache2/httpd.conf -k start
apache2: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
no listening sockets available, shutting down
Unable to open logs
dhcppc1 miro #
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon Nov 23, 2015 1:55 pm    Post subject: Reply with quote

apiaio wrote:
I am not able "configure your DHCP client not to pull hostname from DHCP server" as Buffoon suggested. How to do that?

apiaio ... you would do the following:

/etc/conf.d/net:
dhcp_eth0="nosendhost"

... but that isn't really your problem, the issue is that apache can't resolve the FQDN (Fully Qualified Domain Name) ... 'localhost' isn't a FQDN but the name of the 'loopback' (127.0.0.1) ... it also isn't really your 'hostname', every machines loopback is 'localhost'.

/etc/conf.d/hostname:
hostname="foo"

/etc/hosts:
127.0.0.1 foo localhost

Code:
# dig +short localhost
127.0.0.1

So, you either have apache 'listen' on the loopback ... via changing apache2.conf to 'Listen 127.0.0.1:80', or you provide a FQDN in /etc/hosts, or DNS, (that matches the machines IP).

best ... khay
Back to top
View user's profile Send private message
apiaio
Guru
Guru


Joined: 04 Dec 2008
Posts: 417

PostPosted: Mon Nov 23, 2015 6:03 pm    Post subject: Reply with quote

Thanks, solved. But this part I dont understand
Quote:
... via changing apache2.conf
Where is apache2.conf?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon Nov 23, 2015 6:57 pm    Post subject: Reply with quote

apiaio wrote:
Thanks, solved. But this part I dont understand "... via changing apache2.conf"
Where is apache2.conf?

apiaio ... you're welcome. Sorry, httpd.conf.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum