Bug 10447 - lighttpd is not starting
Summary: lighttpd is not starting
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 3
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL: http://www.linux-pour-lesnuls.com
Whiteboard: has_procedure mga3-64-ok mga3-32-ok
Keywords: validated_update
Depends on:
Blocks:
 
Reported: 2013-06-06 17:49 CEST by deny deny
Modified: 2013-08-17 10:52 CEST (History)
7 users (show)

See Also:
Source RPM:
CVE:
Status comment:


Attachments

Description deny deny 2013-06-06 17:49:23 CEST
Description of problem:

lighttpd is not starting 

Version-Release number of selected component (if applicable):
ighttpd -v
lighttpd/1.4.32 (ssl) - a light and fast webserver



How reproducible:
service lighttpd start

start lighttpd.service
Job for lighttpd.service failed. See 'systemctl status lighttpd.service' and 'journalctl -n' for details.


Jun 06 17:42:49 localhost lighttpd[19480]: 2013-06-06 17:42:49: (network.c.2...s
Jun 06 17:42:49 localhost lighttpd[19480]: 2013-06-06 17:42:49: (network.c.3...e
Jun 06 17:42:49 localhost systemd[1]: Failed to start Lightning Fast Webser...s.
Jun 06 17:42:49 localhost systemd[1]: Unit lighttpd.service entered failed state



Reproducible: 

Steps to Reproduce:
Comment 1 Jani Välimaa 2013-06-07 22:03:30 CEST
Please paste/attach the output of cmd 'systemctl -a status lighttpd.service'.
Comment 2 Dan Fandrich 2013-06-16 11:27:59 CEST
And anything relevant from /var/log/lighttpd/error.log

CC: (none) => dan

Comment 3 David Walser 2013-08-11 00:37:47 CEST
There is more information about this in this thread:
https://ml.mageia.org/l/arc/discuss/2013-05/msg00054.html

The issue is that it is trying to put its PID file in /var/run, but it should instead be using /var/run/lighttpd and shipping an appropriate tmpfiles config file for systemd.

CC: (none) => fundawang, guillomovitch, luigiwalser

Comment 4 David Walser 2013-08-12 16:27:39 CEST
Fixed in Cauldron by guillomovitch in lighttpd-1.4.32-5.mga4.

I backported the fix to Mageia 3.

deny, thanks for filing this bug report!  I would have looked at this sooner, but I didn't realize you had filed the bug.

Advisory:
----------------------------------------

The lighttpd service was not working correctly because it was saving its PID
file in the wrong location.  This has been corrected.

----------------------------------------
Updated packages in core/updates_testing:
----------------------------------------
lighttpd-1.4.32-3.1.mga3
lighttpd-mod_auth-1.4.32-3.1.mga3
lighttpd-mod_cml-1.4.32-3.1.mga3
lighttpd-mod_compress-1.4.32-3.1.mga3
lighttpd-mod_mysql_vhost-1.4.32-3.1.mga3
lighttpd-mod_trigger_b4_dl-1.4.32-3.1.mga3
lighttpd-mod_webdav-1.4.32-3.1.mga3
lighttpd-mod_magnet-1.4.32-3.1.mga3

from lighttpd-1.4.32-3.1.mga3.src.rpm

Hardware: x86_64 => All
Assignee: bugsquad => qa-bugs
Severity: critical => normal

Comment 5 claire robinson 2013-08-12 16:46:42 CEST
Advisory 10447.adv uploaded
Comment 6 David Walser 2013-08-12 17:24:02 CEST
The package was also not using the _post_service and _preun_service macros as it should be, according to the system service policy.  Fixing this allows systemd to automatically see the updated service file when the package is updated.

I have fixed this in lighttpd-1.4.32-6.mga4 and lighttpd-1.4.32-3.2.mga3.
Comment 7 claire robinson 2013-08-12 18:02:24 CEST
Advisory updated
Comment 8 claire robinson 2013-08-12 18:29:10 CEST
Testing mga3 64

Confirmed lighttpd starts/stops ok but leaves a pid file at /run/lighttpd.pid.

Stopped all instances, checked with ps and removed /run/lighttpd.pid then installed the update.

There is something not quite right still. The pid is left behind when the service is stopped. Confirmed it wasn't being started multiple times or changing PID but once stopped the pid file is still left behind.

# ps aux | grep light
root     26367  0.0  0.0  17260   944 pts/3    S+   17:21   0:00 grep --color light
# cat /run/lighttpd/lighttpd.pid 
26007
# systemctl start lighttpd.service
# cat /run/lighttpd/lighttpd.pid 
26494
# systemctl start lighttpd.service
# cat /run/lighttpd/lighttpd.pid 
26494
# systemctl start lighttpd.service
# cat /run/lighttpd/lighttpd.pid 
26494

# ps aux | grep light
apache   26494  0.0  0.0  52496  1100 ?        S    17:23   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
root     26551  0.0  0.0  17260   948 pts/3    S+   17:23   0:00 grep --color light

# systemctl stop lighttpd.service
# ps aux | grep light
root     26580  0.0  0.0  17260   948 pts/3    S+   17:24   0:00 grep --color light

# cat /run/lighttpd/lighttpd.pid 
26494

# systemctl status lighttpd.service -a
lighttpd.service - Lightning Fast Webserver With Light System Requirements
          Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; disabled)
          Active: inactive (dead) since Mon, 2013-08-12 17:23:57 BST; 3min 21s ago
         Process: 26492 ExecStart=/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
        Main PID: 26494
          CGroup: name=systemd:/system/lighttpd.service

systemd[1]: Starting Lightning Fast Webserver With Light System Requirements...
lighttpd[26492]: 2013-08-12 17:23:15: (network.c.260) warning: please use server.use-ipv6 only for hostnames, not without server.bind / empty address; your config will break if the kernel default for IPV6_V6ONLY changes
systemd[1]: Started Lightning Fast Webserver With Light System Requirements.
systemd[1]: Started Lightning Fast Webserver With Light System Requirements.
systemd[1]: Started Lightning Fast Webserver With Light System Requirements.
systemd[1]: Stopping Lightning Fast Webserver With Light System Requirements...
systemd[1]: Stopped Lightning Fast Webserver With Light System Requirements.
Comment 9 David Walser 2013-08-12 19:46:43 CEST
If I understand the mechanics correctly, systemctl stop will send a TERM signal to the process(es), and the main process is expected to remove the PID file when it receives that signal; I don't think systemd deletes it.

It might be interesting to attach a strace to the lighttpd process, do the systemctl stop, and then see what the lighttpd process is doing after it receives the TERM signal.
Comment 10 Thomas Backlund 2013-08-12 22:06:25 CEST
the reason for the  /run/lighttpd.pid is that state_dir config did not match the intended dir referenced in systemd service file.

fixed in:

lighttpd-1.4.32-7.mga4

lighttpd-1.4.32-3.3.mga3

CC: (none) => tmb

Comment 11 David Walser 2013-08-12 22:13:53 CEST
Are you sure?

Didn't this line that guillomovitch added to the SPEC earlier do the same thing that the patch you just added does?
    -e 's!^var.state_dir.*$!var.state_dir   = "/run/lighttpd"!;' \

When Claire was talking about /run/lighttpd.pid, I believe she was saying that was put there by the *original* package, not the updated one.  The updated one was already using the correct location, it just fails to *remove* it when the service is stopped.
Comment 12 claire robinson 2013-08-12 22:40:02 CEST
That's right David yes. It also started/stopped OK before the update though so I wasn't able to reproduce the problem of it not starting and not really able to verify the fix.

It does start ok and stop ok but does leave behind the pid file once stopped.
Comment 13 David Walser 2013-08-12 22:48:36 CEST
Well, for the original bug, I think it probably started OK (as in, you would see the process running), but if you tried to query the service state with systemctl status, you'd see an error since it couldn't read the PID file.
Comment 14 Dave Hodgins 2013-08-13 00:32:29 CEST
Using strace, when stopping, it's getting ...
unlink("/run/lighttpd/lighttpd.pid")    = -1 EACCES (Permission denied)

CC: (none) => davidwhodgins

Comment 15 David Walser 2013-08-13 01:29:49 CEST
Thanks Dave, that's exactly what I was looking for.  I don't know why I didn't think of it earlier...it should be using the apache user for /run/lighttpd, not root.  I've fixed it in lighttpd-1.4.32-8.mga4 and lighttpd-1.4.32-3.4.mga3.

For people testing, you'll probably need to remove the /run/lighttpd directory before installing this if it's still there from your previous tests.  Our end-users won't have to worry about this, as they wouldn't have had these intermediate packages installed.  This one should be good to release.
Comment 16 Thomas Backlund 2013-08-13 06:28:50 CEST
(In reply to David Walser from comment #11)
> Are you sure?


Ah, sorry ... I read comment 8 badly :/
so I just "fixed" and already fixed thing...

now where did I leave the brown paper bag...
Comment 17 claire robinson 2013-08-13 11:23:25 CEST
I'm still unable to reproduce the initial issue. but testing the update mga3 64 anyway..

Before
------
Cleared any old settings and pid files
# rm -f /run/lighttpd.pid
# rm -rf /run/lighttpd
# rm -f /etc/lighttpd

The latter two weren't there anyway.
Stopped apache..

# service httpd stop
Redirecting to /bin/systemctl stop httpd.service

# urpmi lighttpd

# service lighttpd start
Redirecting to /bin/systemctl start lighttpd.service

# systemctl status lighttpd.service
lighttpd.service - Lightning Fast Webserver With Light System Requirements
          Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; disabled)
          Active: active (running) since Tue, 2013-08-13 09:53:18 BST; 6s ago
         Process: 18087 ExecStart=/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
        Main PID: 18089 (lighttpd)
          CGroup: name=systemd:/system/lighttpd.service
                  â 18089 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

lighttpd[18087]: 2013-08-13 09:53:18: (network.c.260) warning: please use server.use-ipv6 only for hostnames,... changes
systemd[1]: Started Lightning Fast Webserver With Light System Requirements.

Stopped the service and confirmed with systemctl status and ps. 

# ll /run/lighttpd.pid 
-rw-r--r-- 1 root root 6 Aug 13 09:53 /run/lighttpd.pid


After
-----
# urpmi lighttpd

installing lighttpd-1.4.32-3.4.mga3.x86_64.rpm from /var/cache/urpmi/rpms

# service lighttpd start
Redirecting to /bin/systemctl start lighttpd.service

# systemctl status lighttpd.service
lighttpd.service - Lightning Fast Webserver With Light System Requirements
          Loaded: loaded (/usr/lib/systemd/system/lighttpd.service; disabled)
          Active: active (running) since Tue, 2013-08-13 10:14:56 BST; 4s ago
         Process: 19816 ExecStart=/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
        Main PID: 19818 (lighttpd)
          CGroup: name=systemd:/system/lighttpd.service
                  â 19818 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

systemd[1]: Starting Lightning Fast Webserver With Light System Requirements...
lighttpd[19816]: 2013-08-13 10:14:56: (network.c.260) warning: please use server.use-ipv6 only for hostnames,... changes
systemd[1]: Started Lightning Fast Webserver With Light System Requirements.

# ll -d /run/lighttpd
drwxr-xr-x 2 apache apache 60 Aug 13 10:14 /run/lighttpd/

# ll /run/lighttpd/lighttpd.pid 
-rw-r--r-- 1 root root 6 Aug 13 10:14 /run/lighttpd/lighttpd.pid

Browsed to http://localhost and saw the 'It Works!'

Stopped the service, confirmed with systemctl status and ps

# ll /run/lighttpd/lighttpd.pid 
ls: cannot access /run/lighttpd/lighttpd.pid: No such file or directory

So it is now removing the pid and seems to be working fine.

Whiteboard: (none) => has_procedure mga3-64-ok

Comment 18 claire robinson 2013-08-13 13:40:03 CEST
Testing complete mga3 32

Advisory uploaded/updated. Validating.

Could sysadmin please push to updates

Keywords: (none) => validated_update
Whiteboard: has_procedure mga3-64-ok => has_procedure mga3-64-ok mga3-32-ok
CC: (none) => sysadmin-bugs

Comment 19 Thomas Backlund 2013-08-17 10:52:25 CEST
Update pushed:
http://advisories.mageia.org/MGAA-2013-0088.html

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.