Domain commands fail with "PI_HOLE_SCRIPT_DIR: readonly variable" error

Expected Behaviour:

  • Operating System: Debian 6.12.34
  • Hardware: Raspberry Pi 4B

Pi-hole version:

  • Core 6.1.3
  • Web 6.2.1
  • FTL 6.2.3

Actual Behaviour:

As of Core 6.1.3, all domain Pihole commands appear to fail with a "readonly variable" error.

pihole@pihole:~ $ pihole allow "me"
/opt/pihole/api.sh: line 25: PI_HOLE_SCRIPT_DIR: readonly variable

pihole@pihole:~ $ pihole allow -d "me"
/opt/pihole/api.sh: line 25: PI_HOLE_SCRIPT_DIR: readonly variable

pihole@pihole:~ $ pihole allow -l
/opt/pihole/api.sh: line 25: PI_HOLE_SCRIPT_DIR: readonly variable

Usage: pihole allow [options] <domain2 ...>
Example: 'pihole allow site.com', or 'pihole allow site1.com site2.com'
Allow one or more exact domains

Options:
remove, delete, -d Remove domain(s)
-q, --quiet Make output less verbose
-h, --help Show this help dialog
-l, --list Display domains
--comment "text" Add a comment to the domain. If adding multiple domains the same comment will be used for all
p

Unlike Core 6.1.2, these are hard failures and no results are produced.

Try the latest update, containing Core v6.1.4.

pihole@pihole:~ $ pihole -v

Core version is v6.1.4 (Latest: v6.1.4)
Web version is v6.2.1 (Latest: v6.2.1)
FTL version is v6.2.3 (Latest: v6.2.3)

pihole@pihole:~ $ pihole deny "me"
/opt/pihole/api.sh: line 25: PI_HOLE_SCRIPT_DIR: readonly variable

OK.
I can confirm this is still happening.

A new fix we be released as soon as possible.

In the meantime you can make these edits on the file yourself to get things functioning again.

diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh
index fa356f16b..c5a80ad2d 100755
--- a/advanced/Scripts/list.sh
+++ b/advanced/Scripts/list.sh
@@ -9,12 +9,12 @@
 # This file is copyright under the latest version of the EUPL.
 # Please see LICENSE file for your rights under this license.
 
-readonly PI_HOLE_SCRIPT_DIR="/opt/pihole"
-readonly utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
+PI_HOLE_SCRIPT_DIR="/opt/pihole"
+utilsfile="${PI_HOLE_SCRIPT_DIR}/utils.sh"
 # shellcheck source="./advanced/Scripts/utils.sh"
 source "${utilsfile}"
 
-readonly apifile="${PI_HOLE_SCRIPT_DIR}/api.sh"
+apifile="${PI_HOLE_SCRIPT_DIR}/api.sh"
 # shellcheck source="./advanced/Scripts/api.sh"
 source "${apifile}"

It's removing the word readonly from those lines.

Thanks!

1 Like