Lighttpd only runs once after installation


#1

Please follow the below template, it will help us to help you!

Expected Behaviour:

Webserver should run after reboot of raspberry

Actual Behaviour:

Webserver only works once after installing, once the raspberry is rebooted it doesn´t start
When i remove lighttpd and install it again it works until the next reboot

Debug Token:

Working Debug: fkgfxgh737
Error Debug: 9ds25yeq7e


#2

What is the output from sudo systemctl status --full --no-pager lighttpd?


#3

pi@raspberrypi:~ $ sudo systemctl status --full --no-pager lighttpd
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-01-10 01:00:10 CET; 15h ago
Process: 599 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)
Process: 589 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
Main PID: 599 (code=exited, status=255)

Jan 10 01:00:10 raspberrypi systemd[1]: lighttpd.service: Failed with result ‘exit-code’.
Jan 10 01:00:10 raspberrypi systemd[1]: lighttpd.service: Service hold-off time over, scheduling restart.
Jan 10 01:00:10 raspberrypi systemd[1]: Stopped Lighttpd Daemon.
Jan 10 01:00:10 raspberrypi systemd[1]: lighttpd.service: Start request repeated too quickly.
Jan 10 01:00:10 raspberrypi systemd[1]: Failed to start Lighttpd Daemon.
Jan 10 01:00:10 raspberrypi systemd[1]: lighttpd.service: Unit entered failed state.
Jan 10 01:00:10 raspberrypi systemd[1]: lighttpd.service: Failed with result ‘exit-code’.


#4

Try sudo /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

That should try to start lighttpd in the foreground and show any start up errors.


#5

pi@raspberrypi:~ $ sudo /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
2019-01-10 17:27:43: (log.c.171) opening errorlog ‘/var/log/lighttpd/error.log’ failed: No such file or directory
daemonized server failed to start; check error log for details
pi@raspberrypi:~ $


#6

It looks like lighttpd can’t open a logfile. Do you have any special configurations for /var/ directory, like a ramlog or a remote filesystem? What does sudo ls -la /var/log/lighttpd/ show?


#7

No there is nothing special.
Homebridge is also running on this pi.
Here the result:
pi@raspberrypi:~ $ sudo ls -la /var/log/lighttpd/
ls: Zugriff auf ‘/var/log/lighttpd/’ nicht möglich: Datei oder Verzeichnis nicht gefunden
pi@raspberrypi:~ $


#8

That directory needs to exist in order for lighttpd to run. Since you have a debug log from a point where lighttpd was running then either /var/log is not permanent or the SDCard is in read-only mode.

Try sudo mkdir /var/log/lighttpd and then reboot the pi. Check and see if that directory exists after the reboot.


#9

After the reboot the folder is gone.
What can cause this?


#10

Some SDCards that are about to fail will go in to read-only mode so that you can recover the data from them. Any writes are discarded as soon as the Pi is rebooted. It’s also possible that the directory is set to be logged to RAM instead of the drive, but you would know of that kind of configuration.

Just to check, see what sudo df -h and sudo mount shows for /var/log/ or just /var/.


#11

If the sd card is read only would I be able to install pihole ? Here the results:

pi@raspberrypi:~ $ sudo df -h
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
/dev/root        28G    4,4G   22G   17% /
devtmpfs        460M       0  460M    0% /dev
tmpfs           464M       0  464M    0% /dev/shm
tmpfs           464M    6,2M  458M    2% /run
tmpfs           5,0M    4,0K  5,0M    1% /run/lock
tmpfs           464M       0  464M    0% /sys/fs/cgroup
none            5,0M    368K  4,7M    8% /var/log
/dev/mmcblk0p6   68M     22M   46M   33% /boot
tmpfs            93M       0   93M    0% /run/user/1000
tmpfs            93M       0   93M    0% /run/user/999
pi@raspberrypi:~ $
pi@raspberrypi:~ $ sudo mount
/dev/mmcblk0p7 on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=470116k,nr_inodes=117529,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
none on /var/log type tmpfs (rw,noatime,size=5120k)
/dev/mmcblk0p6 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=94944k,mode=700,uid=1000,gid=1000)
tmpfs on /run/user/999 type tmpfs (rw,nosuid,nodev,relatime,size=94944k,mode=700,uid=999,gid=996)
pi@raspberrypi:~ $

#12

It looks like it may be a mounting problem instead of a bad card. The temporary file system for the /var/log partition is set to none instead of tmpfs to store the changes. What does sudo cat /etc/fstab show for the automounting configuration?


#13
pi@raspberrypi:~ $ sudo cat /etc/fstab 
proc            /proc           proc    defaults          0       0
/dev/mmcblk0p6  /boot           vfat    defaults          0       2
/dev/mmcblk0p7  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
none /var/log tmpfs size=5M,noatime 00
pi@raspberrypi:~ $

#14

i removed this line and now lighttpd works as expected.
I found some infos about reducing sd card write access for this line. Any suggestions how both can work together?


#15

Personally I don’t think there’s an issue with the modern Raspberry Pi and Raspbian Stretch. But everyone has their own opinion on the matter.


#16

Ok, thank you very much for your great help!