When starting apache2 through the init.d script - it fails to create a proper pid file, which will make stopping through init fail. (I'm on 2.2.4 at the moment, 2.2.3 had the same behaviour if im not mistaken) host / # /etc/init.d/apache2 stop ; ps aux | grep apache2 * Stopping apache2 ... No /usr/sbin/apache2 found running; none killed. [ !! ] root 7357 0.0 0.0 40120 3056 ? Ss Apr10 0:00 /usr/sbin/apache2 -d /usr/lib64/apache2 -f /usr/local/app/conf/httpd.conf -k start apache 7358 0.0 0.1 582848 3188 ? Sl Apr10 0:00 /usr/sbin/apache2 -d /usr/lib64/apache2 -f /usr/local/app/conf/httpd.conf -k start apache 7360 0.0 0.0 582708 3064 ? Sl Apr10 0:00 /usr/sbin/apache2 -d /usr/lib64/apache2 -f /usr/local/app/conf/httpd.conf -k start apache 7363 0.0 0.0 582528 2524 ? Sl Apr10 0:00 /usr/sbin/apache2 -d /usr/lib64/apache2 -f /usr/local/app/conf/httpd.conf -k start apache 7366 0.0 0.0 582528 2524 ? Sl Apr10 0:00 /usr/sbin/apache2 -d /usr/lib64/apache2 -f /usr/local/app/conf/httpd.conf -k start --pidfile=/var/run/apache2.pid? Additionally; a httpd.pid is created - why is that? host run # ls -al /var/run/ | grep -P " httpd|apache2" -rw-r--r-- 1 root root 4 Apr 11 13:21 httpd.pid Reproducible: Always
Johan, what is the output of running "md5sum /etc/init.d/apache2" on your system? I'd like to check if you're using the same init.d script as me, which has an md5sum of 87d0730dcb0ee4aedcebecf300691245 and was installed by the apache-2.2.4 ebuild ($Header: /var/cvsroot/gentoo-x86/net-www/apache/apache-2.2.4.ebuild,v 1.2 2007/01/28 20:00:33 chtekk Exp $). I'm not having any trouble stopping apache, and the pid file is created on my system. [ebuild R ] net-www/apache-2.2.4 USE="ldap no-suexec ssl -debug -doc -mpm-event -mpm-peruser -mpm-prefork -mpm-worker (-selinux) -static-modules -threads" 0 kB Portage 2.1.2.2 (hardened/x86/2.6, gcc-3.4.6, glibc-2.3.6-r5, 2.6.18-hardened i686)=================================================================System uname: 2.6.18-hardened i686 AMD Athlon(tm) XP 1800+Gentoo Base System release 1.12.9Timestamp of tree: Sun, 15 Apr 2007 22:20:01 +0000dev-lang/python: 2.4.3-r4dev-python/pycrypto: 2.0.1-r5sys-apps/sandbox: 1.2.17sys-devel/autoconf: 2.13, 2.60sys-devel/automake: 1.4_p6, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10sys-devel/binutils: 2.16.1-r3sys-devel/gcc-config: 1.3.14sys-devel/libtool: 1.5.22virtual/os-headers: 2.6.17-r2ACCEPT_KEYWORDS="x86"AUTOCLEAN="yes"CBUILD="i686-pc-linux-gnu"CFLAGS="-mtune=athlon-xp -O2 -pipe"CHOST="i686-pc-linux-gnu"CONFIG_PROTECT="/etc"CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache1-php5/ext-active/ /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo"CXXFLAGS="-mtune=athlon-xp -O2 -pipe"DISTDIR="/usr/portage/distfiles"FEATURES="collision-protect distlocks metadata-transfer parallel-fetch sandbox sfperms strict test userfetch userpriv usersandbox"GENTOO_MIRRORS="http://ftp.swin.edu.au/gentoo http://mirror.aarnet.edu.au/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"PKGDIR="/usr/portage/packages"PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes"PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"PORTAGE_TMPDIR="/var/tmp"PORTDIR="/usr/portage"PORTDIR_OVERLAY="/usr/local/portage/aross"SYNC="rsync://rsync.au.gentoo.org/gentoo-portage"USE="acl apache2 bash-completion berkdb bzip2 caps crypt cups enscript fam hardened jpeg jpeg2k ldap midi ncurses nls pic png postgres python readline sasl silvercity sqlite ssl test tiff truetype unicode urandom vhosts x86 xml xorg zlib" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU"Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS
Hey; here's answers to your questions: MD5: 9eb004cd5ebc92d703849b2274e8a692 /etc/init.d/apache2 ebuild: # $Header: /var/cvsroot/gentoo-x86/net-www/apache/apache-2.2.4.ebuild,v 1.2 2007/01/28 20:00:33 chtekk Exp $ emerge -pv: [ebuild R ] net-www/apache-2.2.4 USE="mpm-event -debug -doc -ldap -mpm-peruser -mpm-prefork -mpm-worker -no-suexec (-selinux) -ssl -static-modules -threads" 0 kB emerge --info Portage 2.1.2.2 (default-linux/amd64/2006.1, gcc-4.1.1, glibc-2.5-r0, 2.6.20-gentoo-r5 x86_64) ================================================================= System uname: 2.6.20-gentoo-r5 x86_64 Intel(R) Xeon(TM) CPU 3.00GHz Gentoo Base System release 1.12.9 Timestamp of tree: Wed, 11 Apr 2007 10:30:01 +0000 dev-lang/python: 2.4.3-r4 dev-python/pycrypto: 2.0.1-r5 sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.61 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10 sys-devel/binutils: 2.16.1-r3 sys-devel/gcc-config: 1.3.14 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.17-r2 ACCEPT_KEYWORDS="amd64" AUTOCLEAN="yes" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=nocona -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/terminfo" CXXFLAGS="-march=nocona -O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="distlocks metadata-transfer sandbox sfperms strict" GENTOO_MIRRORS="http://ftp.port80.se/gentoo/" MAKEOPTS="-j3" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://svetlana/gentoo-portage" USE="amd64 apache2 berkdb cracklib crypt dri fortran gdbm gpm iconv isdnlog libg++ logrotate ncurses nls nptl nptlonly pam pcre python readline ssl symlink tcpd unicode zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark ati chips cirrus cyrix dummy fbdev glint i128 i810 mga neomagic nv rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS Since our md5's seems to differ (?), here's my /etc/init.d/apache2: http://p.caboo.se/54124
(In reply to comment #2) > Hey; here's answers to your questions: Thanks for such a speedy reply! > MD5: > 9eb004cd5ebc92d703849b2274e8a692 /etc/init.d/apache2 > > ebuild: > # $Header: /var/cvsroot/gentoo-x86/net-www/apache/apache-2.2.4.ebuild,v 1.2 > 2007/01/28 20:00:33 chtekk Exp $ > Since our md5's seems to differ (?), here's my /etc/init.d/apache2: > http://p.caboo.se/54124 As you can see in the diff below, the only non-trivial difference between our init scripts is the /usr/lib vs /usr/lib64 (since I'm on x86 and you're on amd64). At least we know the init script isn't responsible for your problem :-) diff -u --ignore-space-change /etc/init.d/apache2 johan --- /etc/init.d/apache2 2007-04-16 09:28:11.000000000 +1000 +++ johan 2007-04-17 16:40:05.000000000 +1000 @@ -47,7 +47,7 @@ checkconfig() { - SERVERROOT="${SERVERROOT:-/usr/lib/apache2}" + SERVERROOT="${SERVERROOT:-/usr/lib64/apache2}" if [ ! -d ${SERVERROOT} ]; then eerror "SERVERROOT does not exist: ${SERVERROOT}" return 1 @@ -149,5 +149,3 @@ ${LYNX} ${STATUSURL} } - - > emerge -pv: > [ebuild R ] net-www/apache-2.2.4 USE="mpm-event -debug -doc -ldap > -mpm-peruser -mpm-prefork -mpm-worker -no-suexec (-selinux) -ssl > -static-modules -threads" 0 kB Although we're using different MPMs, that isn't the problem either (I recompiled with mpm-event and still got the /var/run/apache.pid file created). Since you're getting httpd.pid, could you check out the contents of your /etc/apache2/modules.d/00_mpm.conf file? andrew@elm /etc/apache2/modules.d $ fgrep PidFile /etc/apache2/modules.d/00_mpm.conf # PidFile: The file in which the server should record its process # Note that this is the default PidFile for most MPMs. PidFile /var/run/apache2.pid
Ouch. I commented out mpm since i rather handle all my apache configs in one file than splitting them out - therefore never changing pid to apache2.pid instead of httpd.pid... So i guess this is INVALID or WORKSFORME? :) One stab at this would maybe be considering using httpd.pid (that is - the "default") instead of apache2.pid to avoid further similar complications? Andrew: Thank you for taking the time to help a fellow user out!