"Unable to install Pi-hole dependency package" during v6 upgrade attempt

My debug token is https://tricorder.pi-hole.net/Rcd1PgBn/

Running a 3b Pi on Bullseye I think (updated in place from Buster over a year ago, it was a chore but it's been working since then).

After making a Teleport backup, I ran pihole -up. It stopped on /opt/pihole/update.sh: line 108: : No such file or directory

After some time, it gave the error Unable to install Pi-hole dependency package.

I tried pihole -r and it returned Unable to install Pi-hole dependency package again.

Trying pihole -up again returns /opt/pihole/update.sh: line 108: : No such file or directory

Pihole is operational, although the web interface is down at the moment (403 forbidden).

Edit to add: contents of /opt/pihole/:

pi@raspberrypi:/var/log/pihole $ ls -lah /opt/pihole/
total 276K
drwxr-xr-x 2 root root 4.0K Feb 25 17:53 .
drwxr-xr-x 5 root root 4.0K Feb  7  2023 ..
-rwxr-xr-x 1 root root  21K Jul 20  2024 chronometer.sh
-rwxr-xr-x 1 root root 1.1K Jul 20  2024 COL_TABLE
-rwxr-xr-x 1 root root  35K Jul 20  2024 gravity.sh
-rwxr-xr-x 1 root root  11K Jul 20  2024 list.sh
-rwxr-xr-x 1 root root 2.0K Jul 20  2024 piholeARPTable.sh
-rwxr-xr-x 1 root root 8.4K Jul 20  2024 piholeCheckout.sh
-rwxr-xr-x 1 root root  64K Jul 20  2024 piholeDebug.sh
-rwxr-xr-x 1 root root  299 Jul 20  2024 pihole-FTL-poststop.sh
-rwxr-xr-x 1 root root 2.1K Jul 20  2024 pihole-FTL-prestart.sh
-rwxr-xr-x 1 root root 2.9K Jul 20  2024 piholeLogFlush.sh
-rwxr-xr-x 1 root root  823 Jul 20  2024 pihole-reenable.sh
-rwxr-xr-x 1 root root 9.1K Jul 20  2024 query.sh
-rwxr-xr-x 1 root root 9.7K Jul 20  2024 uninstall.sh
-rwxr-xr-x 1 root root 4.2K Jul 20  2024 updatecheck.sh
-rwxr-xr-x 1 root root 8.1K Jul 20  2024 update.sh
-rwxr-xr-x 1 root root 4.6K Jul 20  2024 utils.sh
-rwxr-xr-x 1 root root 4.8K Jul 20  2024 version.sh
-rwxr-xr-x 1 root root  30K Jul 20  2024 webpage.sh
-rwxr-xr-x 1 root root 1.2K Feb 27  2021 wildcard_regex_converter.sh
1 Like

This may be a red herring, but I figured out how to check what dependencies Pihole is using at pi-hole/automated install/basic-install.sh at master · pi-hole/pi-hole · GitHub.

I went down the list running apt-list --installed for each one, and I think all but one shows "installed" or some variant thereof. The one package that didn't was lshw - it's output was:

pi@raspberrypi:/etc/pihole $ apt list --installed lshw
Listing... Done

So I tried installing it with sudo apt-get install lshw, and it returned:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package lshw is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'lshw' has no installation candidate

So I'm stuck again, or this doesn't matter and the root cause is something else.

What repositories is your system using?

cat /etc/apt/sources.list
pi@raspberrypi:/etc/pihole $ cat /etc/apt/sources.list
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

@Bucking_Horn, your query gave me a hint. So I added the following line to /etc/apt/sources.list:

deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi

I ran sudo apt update then sudo apt install lshw, and it found and installed the package (wonder why it wouldn't with prior setup?).

Then I ran pihole -r, which actually ran the rest of the upgrade successfully, I think!

Here's a new debug log; if someone could verify it looks okay, this will be a closed case!
https://tricorder.pi-hole.net/ThFM4MYc/

I'm guessing:
This may have been caused by your in-place upgrade.
It may have left behind package lists (as gathered by apt update) that would have suggested lshw to be available in one of Buster's lists, probably preventing further matches while failing to allow you downloading it, as Buster's repository wasn't configured anymore in sources.list.
Re-adding it could, then have allowed apt to download lshw from buster repos for installing.

The following should return which package lists would hold references to lshw:

sudo grep -c lshw /var/lib/apt/lists/* | grep -v :0

Also, what's the output of

sudo apt policy lshw

Meanwhile, I'll have a look at your debug log.

Your debug log looks like a proper v6 one, with your Pi-hole's webserver running on ports 80 and 443, using unbound as upstream, and a nice v6 style pihole.toml configuration. :wink:

If you'd share the output hunting lshw, that may help us to better understand your issue and potentially help other users with update.sh: line 108 / Unable to install Pi-hole dependency package error messages.


grep: /var/lib/apt/lists/auxfiles: Is a directory
grep: /var/lib/apt/lists/partial: Is a directory
/var/lib/apt/lists/raspbian.raspberrypi.org_raspbian_dists_bullseye_main_binary-armhf_Packages:16

sudo apt policy lshw output:

lshw:
  Installed: 02.18.85-0.1
  Candidate: 02.18.85-0.1
  Version table:
     02.18.85-0.7 -1
         -1 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages
 *** 02.18.85-0.1 100
        100 /var/lib/dpkg/status

I agree with your overall assessment; this was almost certainly a results of my ill-considered in-place upgrade. I had issues when I did it, but worked through the ones that popped up at the time. I should have known it would rear its ugly head again. :slight_smile:

This still looks confusing/confused:
apt knows a newer package is available from Bullseye, but it still refuses to list that as installation candidate.

You could consider to remove all those package lists and have apt rebuild them from repo sources.

Before you do so, you should remove that buster repository from /etc/apt/sources.list/sources.list first.

Then remove the package lists completely:

cd /var/lib/apt
sudo rm -r lists

After that, let apt rebuild them:

sudo apt update

Then recheck installation candidates for lshw:

sudo apt policy lshw

If that still doesn't pull Bullseye's 02.18.85-0.7, bringing in buster repos again would be an option, but it would probably be a better idea to flash a fresh RPi OS image to a new sd card, install Pi-hole and restore Teleporter backup.

@Bucking_Horn, in my troubleshooting before I happened upon the solution, I actually did all those steps you listed for purging the repo lists and letting them rebuild. The result was the same. That was when I decided to try listing the Buster repo, which resulted in a successful install of lshw.
Also, I removed the Buster repo listiing before I ran pihole -r, so it's gone and the command results I posted above reflect that state.
In any case, Pihole v6 is working great (and looks fantastic by the way), so let me get out of your way while you deal with other users! And if I have to deal with this again, I won't hesitate to reimage!

1 Like

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