Lighttpd not loaded, does not start

The interface was working well before a week but I was having problem with package update and installation with apt and apt-get. Now the pihole DNS services are running but the web interface is unreachable. tried to find solutions but didn't help

Expected Behaviour:

Connect to web interface on http://pi.hole and http://IP.ADDRESS

Actual Behaviour:

Connection Closed. Lightttpd is not loaded

Debug Token:

https://tricorder.pi-hole.net/o658dc6o7w

$ lighttpd -v
lighttpd/1.4.45 (ssl) - a light and fast webserver
Build-Date: Jan 14 2017 21:07:19

$ systemctl status lighttpd.service
● lighttpd.service
   Loaded: error (Reason: Invalid argument)
   Active: inactive (dead)
$ journalctl -u lighttpd -l
-- No entries --
$ ls -l /etc/lighttpd/
total 16
drwxr-xr-x 2 root root 4096 Jan  1  2019 conf-available
drwxr-xr-x 2 root root 4096 Jan  1  2019 conf-enabled
-rw-r--r-- 1 root root    0 Jan  1 18:34 external.conf
-rw-r--r-- 1 root root 3499 Sep 18 13:48 lighttpd.conf
-rw-r--r-- 1 root root 3498 Sep  4 07:18 lighttpd.conf.orig

$ cat /etc/lighttpd/lighttpd.conf
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Lighttpd config for Pi-hole
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.

###############################################################################
#     FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE.     #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
#                                                                             #
#              CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE:              #
#                         /etc/lighttpd/external.conf                         #
###############################################################################

server.modules = (
        "mod_access",
        "mod_accesslog",
        "mod_auth",
        "mod_expire",
        "mod_compress",
        "mod_redirect",
        "mod_setenv",
        "mod_rewrite"
)

server.document-root        = "/var/www/html"
server.error-handler-404    = "/pihole/index.php"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80
accesslog.filename          = "/var/log/lighttpd/access.log"
accesslog.format            = "%{%s}t|%V|%r|%s|%b"

index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc", ".md", ".yml", ".ini" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

mimetype.assign   = ( ".png"  => "image/png",
                      ".jpg"  => "image/jpeg",
                      ".jpeg" => "image/jpeg",
                      ".html" => "text/html",
                      ".css" => "text/css; charset=utf-8",
                      ".js" => "application/javascript",
                      ".json" => "application/json",
                      ".txt"  => "text/plain",
                      ".svg"  => "image/svg+xml" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port

# Prevent Lighttpd from enabling Let's Encrypt SSL for every blocked domain
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
include_shell "find /etc/lighttpd/conf-enabled -name '*.conf' -a ! -name 'letsencrypt.conf' -printf 'include \"%p\"\n' 2>/dev/null"

# If the URL starts with /admin, it is the Web interface
$HTTP["url"] =~ "^/admin/" {
    # Create a response header for debugging using curl -I
    setenv.add-response-header = (
        "X-Pi-hole" => "The Pi-hole Web interface is working!",
        "X-Frame-Options" => "DENY"
    )

    $HTTP["url"] =~ ".ttf$" {
        # Allow Block Page access to local fonts
        setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
    }
}

# Block . files from being served, such as .git, .github, .gitignore
$HTTP["url"] =~ "^/admin/\.(.*)" {
     url.access-deny = ("")
}

# Add user chosen options held in external file
# This uses include_shell instead of an include wildcard for compatibility
include_shell "cat external.conf 2>/dev/null"

Does below show you more ?

sudo lighttpd -tt -f /etc/lighttpd/lighttpd.conf

Below might fix resetting everything to default:

Thanks for the reply,

My apt and perl installation seems to be broken. and raspi-config localization options aren't working as well.

$ sudo lighttpd -tt -f /etc/lighttpd/lighttpd.conf
String found where operator expected at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 153, near "croak "usage:   (port,iaddr) = sockaddr_in(sin_sv)""
        (Do you need to predeclare croak?)
String found where operator expected at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 156, near "croak "usage:   sin_sv = sockaddr_in(port,iaddr))""
        (Do you need to predeclare croak?)
String found where operator expected at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 163, near "croak "usage:   (port,in6addr,scope_id,flowinfo) = sockaddr_in6(sin6_sv)""
        (Do you need to predeclare croak?)
String found where operator expected at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 167, near "croak "usage:   sin6_sv = sockaddr_in6(port,in6addr,[scope_id,[flowinfo]])""
        (Do you need to predeclare croak?)
String found where operator expected at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 174, near "croak "usage:   (filename) = sockaddr_un(sun_sv)""
        (Do you need to predeclare croak?)
String found where operator expected at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 177, near "croak "usage:   sun_sv = sockaddr_un(filename)""
        (Do you need to predeclare croak?)
syntax error at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 153, near "croak "usage:   (port,iaddr) = sockaddr_in(sin_sv)""
syntax error at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 156, near "croak "usage:   sin_sv = sockaddr_in(port,iaddr))""
syntax error at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 163, near "croak "usage:   (port,in6addr,scope_id,flowinfo) = sockaddr_in6(sin6_sv)""
syntax error at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 167, near "croak "usage:   sin6_sv = sockaddr_in6(port,in6addr,[scope_id,[flowinfo]])""
syntax error at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 174, near "croak "usage:   (filename) = sockaddr_un(sun_sv)""
syntax error at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 177, near "croak "usage:   sun_sv = sockaddr_un(filename)""
BEGIN not safe after errors--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm line 243.
Compilation failed in require at /usr/share/lighttpd/use-ipv6.pl line 3.
BEGIN failed--compilation aborted at /usr/share/lighttpd/use-ipv6.pl line 3.
2020-01-04 20:05:58: (server.c.1295) WARNING: unknown config-key: alias.url (ignored)

Apt broken, what is output for below two ?

sudo apt update

sudo apt upgrade

Would need to fix that first!

Below issue seems similar:

pi@raspberrypi:~ $ sudo apt update
Get:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:2 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]
Fetched 11.7 MB in 23s (500 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
pi@raspberrypi:~ $ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
9 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Unquoted string "croak" may clash with future reserved word at /usr/share/perl/5.24/SelectSaver.pm line 10.
String found where operator expected at /usr/share/perl/5.24/SelectSaver.pm line 10, near "croak 'usage: SelectSaver->new( [FILEHANDLE] )'"
        (Do you need to predeclare croak?)
debconf: Perl may be unconfigured (syntax error at /usr/share/perl/5.24/SelectSaver.pm line 10, near "croak 'usage: SelectSaver->new( [FILEHANDLE] )'"
Compilation failed in require at /usr/lib/arm-linux-gnueabihf/perl/5.24/IO/File.pm line 10.
BEGIN failed--compilation aborted at /usr/lib/arm-linux-gnueabihf/perl/5.24/IO/File.pm line 10.
Compilation failed in require at /usr/share/perl/5.24/FileHandle.pm line 9.
Compilation failed in require at (eval 1) line 3.
BEGIN failed--compilation aborted at (eval 1) line 3.
) -- aborting
Setting up debconf (1.5.61) ...
Base class package "Exporter" is empty.
    (Perhaps you need to 'use' the module which defines that package first,
    or make that module available in @INC (@INC contains: /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base).
 at /usr/share/perl5/Debconf/Log.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Log.pm line 7.
Compilation failed in require at /usr/share/perl5/Debconf/Db.pm line 7.
BEGIN failed--compilation aborted at /usr/share/perl5/Debconf/Db.pm line 7.
Compilation failed in require at /usr/share/debconf/frontend line 6.
BEGIN failed--compilation aborted at /usr/share/debconf/frontend line 6.
dpkg: error processing package debconf (--configure):
 subprocess installed post-installation script returned error exit status 255
Errors were encountered while processing:
 debconf

I'm going to connect it to a monitor and force fsck check on reboot to see if SDCard is corrupted. Thanks, I'll report back

SelectSaver.pm module seems to belong to the perl-modules-5.24 package:

pi@noads:~ $ readlink -f /usr/share/perl/5.24/SelectSaver.pm
/usr/share/perl/5.24.1/SelectSaver.pm

pi@noads:~ $ dpkg -S /usr/share/perl/5.24.1/SelectSaver.pm
perl-modules-5.24: /usr/share/perl/5.24.1/SelectSaver.pm

And File.pm to the libperl5.24 package:

pi@noads:~ $ dpkg -S /usr/lib/arm-linux-gnueabihf/perl/5.24.1/IO/File.pm
libperl5.24:armhf: /usr/lib/arm-linux-gnueabihf/perl/5.24.1/IO/File.pm

If filesystem not corrupted, try purge the two packages with dpkg eg:

sudo dpkg -P perl-modules-5.24 libperl5.24

And reinstall from apt cache to reset/default a bunch:

sudo apt-get install --reinstall perl-modules-5.24 libperl5.24

And try do the upgrade again:

sudo apt upgrade

This could inadvertently break other software installed that might have made system changes!

When you initially run ligttpd -tt -f... , the file Socket.pm errors seems to be related to same libperl5.24 package:

pi@noads:~ $ readlink -f /usr/lib/arm-linux-gnueabihf/perl/5.24/Socket.pm
/usr/lib/arm-linux-gnueabihf/perl/5.24.1/Socket.pm

pi@noads:~ $ dpkg -S /usr/lib/arm-linux-gnueabihf/perl/5.24.1/Socket.pm
libperl5.24:armhf: /usr/lib/arm-linux-gnueabihf/perl/5.24.1/Socket.pm

Not really a Pi-hole issue but worth a try :wink:

EDIT: changed apt into apt-get for older distros.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.