Upgrade to Bullseye fails on Pi-hole reinstall

Hi,

I’m trying the upgrade to Bullseye on my Raspberry Pi Zero W.
I was going by https://dietpi.com/blog/?p=811, got as far as 2.2.4 Software migrations, put the command:

dietpi-software reinstall 31 38 40 47 48 56 83 84 85 88 89 93 114 118 130 143

When it got to Pi-hole it failed on

DietPi-Software | ./install.sh --disable-install-webserver

The whole output in shell:

DietPi-Software
─────────────────────────────────────────────────────
 Step: Installing Pi-hole: block adverts for any device on your network

[  OK  ] DietPi-Software | Checking URL: https://raw.githubusercontent.com/pi-hole/pi-hole/master/automated%20install/basic-install.sh
[ INFO ] DietPi-Software | APT install for: php7.4-xml php7.4-sqlite3 php7.4-intl, please wait...
[  OK  ] DietPi-Software | APT install for: php7.4-xml php7.4-sqlite3 php7.4-intl
[  OK  ] DietPi-Software | curl -sSfL https://raw.githubusercontent.com/pi-hole/pi-hole/master/automated%20install/basic-install.sh -o install.sh
[  OK  ] DietPi-Software | chmod +x install.sh
[ INFO ] DietPi-Software | ./install.sh --disable-install-webserver, please wait...

  [✓] Root user check

        .;;,.
        .ccccc:,.
         :cccclll:.      ..,,
          :ccccclll.   ;ooodc
           'ccll:;ll .oooodc
             .;cll.;;looo:.
                 .. ','.
                .',,,,,,'.
              .',,,,,,,,,,.
            .',,,,,,,,,,,,....
          ....''',,,,,,,'.......
        .........  ....  .........
        ..........      ..........
        ..........      ..........
        .........  ....  .........
          ........,,,,,,,'......
            ....',,,,,,,,,,,,.
               .',,,,,,,,,'.
                .',,,,,,'.
                  ..'''.

  [✓] Update local cache of available packages
  [i] Existing PHP installation detected : PHP version 7.4.25

  [✓] Checking apt-get for upgraded packages... up to date!

  [i] Checking for / installing Required dependencies for OS Check...
  [✓] Checking for grep
  [✓] Checking for dnsutils

  [i] PIHOLE_SKIP_OS_CHECK env variable set to true - installer will continue
  [i] Checking for / installing Required dependencies for this install script...
  [✓] Checking for git
  [✓] Checking for iproute2
  [✓] Checking for whiptail
  [✓] Checking for ca-certificates

  [i] SELinux not detected
  [i] Update option selected
  [✓] Check for existing repository in /etc/.pihole
  [i] Update repo in /etc/.pihole...HEAD is now at b5e0f14 Merge pull request #4405 from pi-hole/development
  [✓] Update repo in /etc/.pihole

  [✓] Check for existing repository in /var/www/html/admin
  [i] Update repo in /var/www/html/admin...HEAD is now at ee50954 Merge pull request #1935 from pi-hole/devel
  [✓] Update repo in /var/www/html/admin

  [i] Checking for / installing Required dependencies for Pi-hole software...
  [✓] Checking for cron
  [✓] Checking for curl
  [✓] Checking for iputils-ping
  [✓] Checking for lsof
  [✓] Checking for psmisc
  [✓] Checking for sudo
  [✓] Checking for unzip
  [✓] Checking for idn2
  [✓] Checking for sqlite3
  [✓] Checking for libcap2-bin
  [✓] Checking for dns-root-data
  [✓] Checking for libcap2
  [✓] Checking for lighttpd
  [✓] Checking for php7.4-common
  [i] Checking for php7.4-cgi (will be installed)
  [✓] Checking for php7.4-sqlite3
  [✓] Checking for php7.4-xml
  [✓] Checking for php7.4-intl
  [✓] Checking for php7.4-json
  [i] Processing apt-get install(s) for: php7.4-cgi, please wait...

Selecting previously unselected package php7.4-cgi.
(Reading database ... 86101 files and directories currently installed.)
Preparing to unpack .../php7.4-cgi_7.4.25-1+deb11u1_armhf.deb ...
Unpacking php7.4-cgi (7.4.25-1+deb11u1) ...
Setting up php7.4-cgi (7.4.25-1+deb11u1) ...
update-alternatives: using /usr/bin/php-cgi7.4 to provide /usr/bin/php-cgi (php-cgi) in auto mode
update-alternatives: using /usr/lib/cgi-bin/php7.4 to provide /usr/lib/cgi-bin/php (php-cgi-bin) in auto mode

Creating config file /etc/php/7.4/cgi/php.ini with new version
Processing triggers for php7.4-cgi (7.4.25-1+deb11u1) ...

  [✓] Enabling lighttpd service to start on reboot...
  [✓] Checking for user 'pihole'

  [i] FTL Checks...

  [✓] Detected ARMv6 processor (with hard-float support)
  [i] Checking for existing FTL binary...
  [i] Latest FTL Binary already installed (v5.11). Confirming Checksum...
  [i] Checksum correct. No need to download!
  [✓] Installing scripts from /etc/.pihole

  [i] Installing configs from /etc/.pihole...
  [i] Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
  [✓] Installed /etc/dnsmasq.d/01-pihole.conf
  [✓] Installed /etc/dnsmasq.d/06-rfc6761.conf

  [i] Installing blocking page...
  [✓] Creating directory for blocking page, and copying files
  [i] Backing up index.lighttpd.html
      No default index.lighttpd.html file found... not backing up

  [✓] Installing sudoer file

  [✓] Installing latest Cron script

  [i] Installing latest logrotate script...
        [i] Existing logrotate file found. No changes made.
  [i] Backing up /etc/dnsmasq.conf to /etc/dnsmasq.conf.old
  [i] man not installed
  [i] Testing if systemd-resolved is enabled
  [i] Systemd-resolved is not enabled
[FAILED] DietPi-Software | ./install.sh --disable-install-webserver

It seems to fail on Restarting lighttpd service…

I guess it because Pi-hole changes /etc/lighttpd/lighttpd.conf ?

What to do?

BugReport | Reference code: 6ed542ea-5eaa-4e60-b516-eb13f3a3cf1e

the installation is started with option --disable-install-webserver. Means PiHole is not doing anything on the web server configuration.

At least on first look I don’t see a clear error message what is failing in the PiHole installer. Was there any blue error message once it failed?

Could you check if web server is running

systemctl status lighttpd.service

It’s not running.

systemctl status lighttpd.service
● lighttpd.service - Lighttpd Daemon
     Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-11-17 15:29:39 CET; 386ms ago
    Process: 26857 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=255/EXCEPTION)

Nov 17 15:29:38 DietPi systemd[1]: Failed to start Lighttpd Daemon.
Nov 17 15:29:39 DietPi systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 5.
Nov 17 15:29:39 DietPi systemd[1]: Stopped Lighttpd Daemon.
Nov 17 15:29:39 DietPi systemd[1]: lighttpd.service: Start request repeated too quickly.
Nov 17 15:29:39 DietPi systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Nov 17 15:29:39 DietPi systemd[1]: Failed to start Lighttpd Daemon.

I’m not sure what you mean by blue error message.

pls share following

/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf

usually if an error during software installation failed, a blue error message box appears.

Ah, now I maybe understand what by blue you mean. Gray box on blue background? The one that let you sent Bugreport, Retry last command etc?

It’s output is same as what I posted in first post.

Now I f**ked up and accidentally pressed something on the window, when I thought I’m working in another. The installation is somehow continuing.

Ended up with:

DietPi-Software
─────────────────────────────────────────────────────
 Step: Install completed

[  OK  ] DietPi-Survey | Sending survey data
[ SUB1 ] DietPi-Services > restart 
[  OK  ] DietPi-Services | restart : redis-server
[  OK  ] DietPi-Services | restart : mariadb
[  OK  ] DietPi-Services | restart : php7.4-fpm
[FAILED] DietPi-Services | restart : lighttpd
[  OK  ] DietPi-Services | restart : cron
[  OK  ] DietPi-Services | ncc maintenance:mode --off

Running your code returns:

/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
Duplicate config variable in conditional 0 global: server.error-handler-404
2021-11-17 15:47:18: configfile.c.1970) source: /etc/lighttpd/conf-enabled/99-dietpi-pihole.conf line: 33 pos: 1 parser failed somehow near here: (EOL)
2021-11-17 15:47:18: configfile.c.1970) source: find /etc/lighttpd/conf-enabled -name '*.conf' -a ! -name 'letsencrypt.conf' -printf 'include "%p"\n' 2>/dev/null line: 8 pos: 8 parser failed somehow near here: (EOL)
2021-11-17 15:47:18: configfile.c.1970) source: /etc/lighttpd/lighttpd.conf line: 75 pos: 1 parser failed somehow near here: (EOL)

ok let’s see were the duplicate configuration is coming from. Try following.

grep -r 'server.error-handler-404' /etc/lighttpd/

hopefully it’s going to display something.

grep -r 'server.error-handler-404' /etc/lighttpd/
/etc/lighttpd/lighttpd.conf.piholemade:server.error-handler-404    = "/pihole/index.php"
/etc/lighttpd/lighttpd.conf.orig:server.error-handler-404    = "/pihole/index.php"
/etc/lighttpd/lighttpd.conf:server.error-handler-404    = "/pihole/index.php"
/etc/lighttpd/conf-available/99-dietpi-pihole.conf:server.error-handler-404 = "/html/pihole/index.php"

ah yeah it’s an older installation I guess. In meantime 404 error handling has been removed from our config on new install. Let’s try following

sed -i '/^[[:blank:]]*server.error-handler-404/d' /etc/lighttpd/lighttpd.conf

hopefully web server is starting now

systemctl restart lighttpd.service

Yep. It’s about year and half old I would say.

Didn’t help:

root@DietPi:~# sed -i '/^[[:blank:]]*server.error-handler-404/d' /etc/lighttpd/lighttpd.conf
root@DietPi:~# systemctl restart lighttpd.service
Job for lighttpd.service failed because the control process exited with error code.
See "systemctl status lighttpd.service" and "journalctl -xe" for details.
root@DietPi:~# systemctl status lighttpd.service
● lighttpd.service - Lighttpd Daemon
     Loaded: loaded (/lib/systemd/system/lighttpd.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-11-17 16:20:38 CET; 3s ago
    Process: 3008 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=255/EXCEPTION)

Nov 17 16:20:38 DietPi systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 5.
Nov 17 16:20:38 DietPi systemd[1]: Stopped Lighttpd Daemon.
Nov 17 16:20:38 DietPi systemd[1]: lighttpd.service: Start request repeated too quickly.
Nov 17 16:20:38 DietPi systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Nov 17 16:20:38 DietPi systemd[1]: Failed to start Lighttpd Daemon.

can you perform the config check again

/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
root@DietPi:~# /usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
2021-11-17 16:37:07: fdevent.c.1150) fdevent_load_file() /etc/lighttpd/server.pem: No such file or directory
2021-11-17 16:37:07: server.c.1244) Initialization of plugins failed. Going down.

ok looks like it’s trying to activate ssl. Can you share active configs

ls -la /etc/lighttpd/conf-enabled/
root@DietPi:~# ls -la /etc/lighttpd/conf-enabled/
total 8
drwxr-xr-x 2 root root 4096 Nov 17 12:29 .
drwxr-xr-x 4 root root 4096 Nov 17 16:20 ..
lrwxrwxrwx 1 root root   33 May 20  2020 10-fastcgi.conf -> ../conf-available/10-fastcgi.conf
lrwxrwxrwx 1 root root   33 May 20  2020 10-rewrite.conf -> ../conf-available/10-rewrite.conf
lrwxrwxrwx 1 root root   29 Nov 17 12:29 10-ssl.conf -> ../conf-available/10-ssl.conf
lrwxrwxrwx 1 root root   37 May 20  2020 15-fastcgi-php.conf -> ../conf-available/15-fastcgi-php.conf
lrwxrwxrwx 1 root root   33 Nov 17 12:29 20-deflate.conf -> ../conf-available/20-deflate.conf
lrwxrwxrwx 1 root root   38 Sep  3  2020 50-dietpi-https.conf -> ../conf-available/50-dietpi-https.conf
lrwxrwxrwx 1 root root   47 Sep  3  2020 98-dietpi-https_redirect.conf -> ../conf-available/98-dietpi-https_redirect.conf
lrwxrwxrwx 1 root root   45 May 20  2020 99-dietpi-dav_redirect.conf -> ../conf-available/99-dietpi-dav_redirect.conf
lrwxrwxrwx 1 root root   42 May 20  2020 99-dietpi-nextcloud.conf -> ../conf-available/99-dietpi-nextcloud.conf
lrwxrwxrwx 1 root root   58 May 20  2020 99-dietpi-pihole-block_public_admin.conf -> ../conf-available/99-dietpi-pihole-block_public_admin.conf
lrwxrwxrwx 1 root root   39 May 20  2020 99-dietpi-pihole.conf -> ../conf-available/99-dietpi-pihole.conf
lrwxrwxrwx 1 root root   38 May 20  2020 99-unconfigured.conf -> ../conf-available/99-unconfigured.conf

pls do following

rm /etc/lighttpd/conf-enabled/10-ssl.conf
systemctl restart lighttpd.service

Perfect. Lighttpd is running now.

Pi-hole is accessible, Nextcloud is throwing 403 Forbidden, tho. Guess something with ssl/certificates?

not necessarily. Can you share following config file. Maybe PiHole has overwritten our config

cat /etc/lighttpd/lighttpd.conf

Yep, it did. Already fixed it.

Seems like everything is working now, if I find something else, will report.

This is just my Nextcloud updates testing PDC and secondary Pi-hole. Tomorrow I’ll try to upgrade my another one, where my “production” is. That one is running on Apache, tho.

Thank you for all your help, I’m amazed by your knowledge.

I’m amazed by your knowledge.

It’s all about forum and GitHub search :wink:

Yeah Apache2 might be different. Do a backup before, just in case :sunglasses:

btw: how did you fixed it? Might be interesting for other users

Nothing special. Just copied my changes to the file back.

any specific changes done? Any custom entries? If yes you should use drop-in configuration files to avoid your personal changes get overwritten on next web server update again. By default Lighttpd will include files located at /etc/lighttpd/conf-enabled/*.conf

include "/etc/lighttpd/conf-enabled/*.conf"

Some examples are available at /etc/lighttpd/conf-available/. To activate, they are simply sym linked to conf-enabled