Error when trying to update Pi-Hole

Expected Behaviour:

Update pihole version (below is the output from pihole -v)

  Pi-hole version is v3.3.1 (Latest: v4.0)
  AdminLTE version is v3.3 (Latest: v4.0)
  FTL version is v3.0 (Latest: v4.0)

Actual Behaviour:

I am getting an error regarding the repo in /etc/.pihole (below see the output from pihole -up)

pi@phi01:/etc/.pihole $ pihole -up
  [i] Checking for updates...
  [i] Pi-hole Core:     update available
  [i] FTL:              update available
  [i] Web Interface:    update available

  [i] Updating Pi-hole core and web admin files
  [✓] Check for existing repository in /etc/.pihole
  [i] Update repo in /etc/.pihole...
  Error: Could not update local repository. Contact support.

I also checked the git status of the repo (below is the output from git status)

pi@phi01:/etc/.pihole $ git status
On branch master
Your branch is behind 'origin/master' by 3462 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
nothing to commit, working tree clean

I then tried to use git pull and it seems to be successful, but I still get the same error when trying to update.

pi@phi01:/etc/.pihole $ sudo git pull
Updating fbee18e..ddbdb51

Rerunning the update command

pi@phi01:/etc/.pihole $ pihole -up
  [i] Checking for updates...
  [i] Pi-hole Core:     update available
  [i] FTL:              update available
  [i] Web Interface:    update available

  [i] Updating Pi-hole core and web admin files
  [✓] Check for existing repository in /etc/.pihole
  [i] Update repo in /etc/.pihole...
  Error: Could not update local repository. Contact support.

Debug Token:



[✓] Your debug token is: ndnzs4j39e



How do I get everything up-to-date so I can successfully update my pihole version?

Thank you!

try this please

pihole checkout master

also have you made modifications to the code or frozen your updates for any reason IE still on Jessie?

No, I have not made any changes to the code or frozen anything (I do not think I even know how to do either of those things).

Output from the command is below.

pi@phi01:~ $ pihole checkout master
  Please note that changing branches severely alters your Pi-hole subsystems
  Features that work on the master branch, may not on a development branch
  This feature is NOT supported unless a Pi-hole developer explicitly asks!
  Have you read and understood this? [y/N] y

  [i] Shortcut "master" detected - checking out master branches...
  [i] Pi-hole core
  [i] Switching to branch: 'master' from 'refs/heads/master'fatal: Unable to create '/etc/.pihole/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
  [✗] Unable to pull Core master branch

delete that file please and try again

Woohoo! That worked. Thank you!

Wait. But now my Web Admin Console is not working. It is just resolving the PHP code (seen below).

<?php /*
*    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.
*
*    This file is copyright under the latest version of the EUPL.
*    Please see LICENSE file for your rights under this license. */
    $indexpage = true;
    require "scripts/pi-hole/php/header.php";
    require_once("scripts/pi-hole/php/gravity.php");
?>
<!-- Small boxes (Stat box) -->
<div class="row">
    <div class="col-lg-3 col-xs-12">
        <!-- small box -->
        <div class="small-box bg-green" id="total_queries" title="only A + AAAA queries">
            <div class="inner">
                <p>Total queries (<span id="unique_clients">-</span> clients)</p>
                <h3 class="statistic"><span id="dns_queries_today">---</span></h3>
            </div>
            <div class="icon">
                <i class="ion ion-earth"></i>
            </div>
        </div>
    </div>
    <!-- ./col -->
    <div class="col-lg-3 col-xs-12">
        <!-- small box -->
        <div class="small-box bg-aqua">
            <div class="inner">
                <p>Queries Blocked</p>
                <h3 class="statistic"><span id="ads_blocked_today">---</span></h3>
            </div>
            <div class="icon">
                <i class="ion ion-android-hand"></i>
            </div>
        </div>
    </div>
    <!-- ./col -->
    <div class="col-lg-3 col-xs-12">
        <!-- small box -->
        <div class="small-box bg-yellow">
            <div class="inner">
                <p>Percent Blocked</p>
                <h3 class="statistic"><span id="ads_percentage_today">---</span></h3>
            </div>
            <div class="icon">
                <i class="ion ion-pie-graph"></i>
            </div>
        </div>
    </div>
    <!-- ./col -->
    <div class="col-lg-3 col-xs-12">
        <!-- small box -->
        <div class="small-box bg-red" title="<?php echo gravity_last_update(); ?>">
            <div class="inner">
                <p>Domains on Blocklist</p>
                <h3 class="statistic"><span id="domains_being_blocked">---</span></h3>
            </div>
            <div class="icon">
                <i class="ion ion-ios-list"></i>
            </div>
        </div>
    </div>
    <!-- ./col -->
</div>

<div class="row">
    <div class="col-md-12">
    <div class="box" id="queries-over-time">
        <div class="box-header with-border">
          <h3 class="box-title">Queries over last 24 hours</h3>
        </div>
        <div class="box-body">
          <div class="chart">
            <canvas id="queryOverTimeChart" width="800" height="140"></canvas>
          </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
    </div>
</div>
<?php
  // If the user is logged in, then we show the more detailed index page.
  // Even if we would include them here anyhow, there would be nothing to
  // show since the API will respect the privacy of the user if he defines
  // a password
  if($auth){ ?>

<div class="row">
    <div class="col-md-12">
    <div class="box" id="clients">
        <div class="box-header with-border">
          <h3 class="box-title">Clients (over time)</h3>
        </div>
        <div class="box-body">
          <div class="chart">
            <canvas id="clientsChart" width="800" height="140" class="extratooltipcanvas"></canvas>
          </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12 col-lg-6">
    <div class="box" id="query-types-pie">
        <div class="box-header with-border">
          <h3 class="box-title">Query Types</h3>
        </div>
        <div class="box-body">
          <div class="float-left" style="width:50%">
            <canvas id="queryTypePieChart" width="120" height="120"></canvas>
          </div>
          <div class="float-left" style="width:50%">
            <div id="query-types-legend" class="chart-legend"></div>
          </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
    </div>
    <div class="col-md-12 col-lg-6">
    <div class="box" id="forward-destinations-pie">
        <div class="box-header with-border">
          <h3 class="box-title">Queries answered by</h3>
        </div>
        <div class="box-body">
          <div class="float-left" style="width:50%">
            <canvas id="forwardDestinationPieChart" width="120" height="120"></canvas>
          </div>
          <div class="float-left" style="width:50%">
            <div id="forward-destinations-legend" class="chart-legend"></div>
          </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
    </div>
</div>
<?php
  // Determine if "Query Types (over time)" should be shown
  $queryTypesOverTime = false;
  if(isset($setupVars['DASHBOARD_SHOW_QUERY_TYPES_OVER_TIME']))
  {
    if($setupVars['DASHBOARD_SHOW_QUERY_TYPES_OVER_TIME'])
    {
        $queryTypesOverTime = true;
    }
  }

  // Determine if "Forward Destinations (over time)" should be shown
  $forwardDestsOverTime = false;
  if(isset($setupVars['DASHBOARD_SHOW_FORWARD_DESTS_OVER_TIME']))
  {
    if($setupVars['DASHBOARD_SHOW_FORWARD_DESTS_OVER_TIME'])
    {
        $forwardDestsOverTime = true;
    }
  }
?>
<?php if($forwardDestsOverTime || $queryTypesOverTime) { ?>
<div class="row">
<?php if($queryTypesOverTime) { ?>
    <div class="col-md-12 col-lg-6">
    <div class="box" id="query-types">
        <div class="box-header with-border">
          <h3 class="box-title">Query Types (over time)</h3>
        </div>
        <div class="box-body">
          <div class="chart">
            <canvas id="queryTypeChart" width="400" height="150"></canvas>
          </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
    </div>
<?php } if($forwardDestsOverTime) { ?>
    <div class="col-md-12 col-lg-6">
    <div class="box" id="forward-destinations">
        <div class="box-header with-border">
          <h3 class="box-title">Forward Destinations (over time)</h3>
        </div>
        <div class="box-body">
          <div class="chart">
            <canvas id="forwardDestinationChart" width="400" height="150"></canvas>
          </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
    </div>
<?php } ?>
</div>
<?php } ?>

<?php
if($boxedlayout)
{
  $tablelayout = "col-md-6";
}
else
{
  $tablelayout = "col-md-6 col-lg-6";
}
?>
<div class="row">
    <div class="<?php echo $tablelayout; ?>">
      <div class="box" id="domain-frequency">
        <div class="box-header with-border">
          <h3 class="box-title">Top Permitted Domains</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
            <div class="table-responsive">
                <table class="table table-bordered">
                  <tbody>
                    <tr>
                    <th>Domain</th>
                    <th>Hits</th>
                    <th>Frequency</th>
                    </tr>
                  </tbody>
                </table>
            </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->
    </div>
    <!-- /.col -->
    <div class="<?php echo $tablelayout; ?>">
      <div class="box" id="ad-frequency">
        <div class="box-header with-border">
          <h3 class="box-title">Top Blocked Domains</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
            <div class="table-responsive">
                <table class="table table-bordered">
                  <tbody>
                    <tr>
                    <th>Domain</th>
                    <th>Hits</th>
                    <th>Frequency</th>
                    </tr>
                  </tbody>
                </table>
            </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->
    </div>
</div>
<div class="row">
    <!-- /.col -->
    <div class="<?php echo $tablelayout; ?>">
      <div class="box" id="client-frequency">
        <div class="box-header with-border">
          <h3 class="box-title">Top Clients (total)</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
            <div class="table-responsive">
                <table class="table table-bordered">
                  <tbody>
                    <tr>
                    <th>Client</th>
                    <th>Requests</th>
                    <th>Frequency</th>
                    </tr>
                  </tbody>
                </table>
            </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->
    </div>
    <!-- /.col -->
    <!-- /.col -->
    <div class="<?php echo $tablelayout; ?>">
      <div class="box" id="client-frequency-blocked">
        <div class="box-header with-border">
          <h3 class="box-title">Top Clients (blocked only)</h3>
        </div>
        <!-- /.box-header -->
        <div class="box-body">
            <div class="table-responsive">
                <table class="table table-bordered">
                  <tbody>
                    <tr>
                    <th>Client</th>
                    <th>Requests</th>
                    <th>Frequency</th>
                    </tr>
                  </tbody>
                </table>
            </div>
        </div>
        <div class="overlay">
          <i class="fa fa-refresh fa-spin"></i>
        </div>
        <!-- /.box-body -->
      </div>
      <!-- /.box -->
    </div>
    <!-- /.col -->
</div>
<!-- /.row -->
<?php } ?>
<?php
    require "scripts/pi-hole/php/footer.php";
?>

<script src="scripts/pi-hole/js/index.js"></script>

This is after performing the update and a reboot.

I ran sudo apt-get -y install php7.0 libapache2-mod-php7.0; sudo service apache2 restart and it rebooted and it is working again. I found this solution from another help site post.

1 Like

glad you found the answer. For informatiomn purposes apache will be superceded by lighttpd when the installer runs as in a core update or a repair or reconfigure. just keep that in mind and you should be good

1 Like

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