Local revision could not be obtained, => segmentation fault :-/

Expected Behaviour:

Trying to update pihole, has worked well until about a month ago

To install updates, run pihole -up.

I get this error message:

root@pihole:/home/pi# pihole -up
  [✓] Update local cache of available packages
  [i] Existing PHP installation detected : PHP version 7.4.33
  [✓] Checking for git
  [✓] Checking for iproute2
  [✓] Checking for dialog
  [✓] Checking for ca-certificates

  [i] Checking for updates...
/opt/pihole/update.sh: line 36:  3263 Segmentation fault      git fetch --quiet origin

  Error: Local revision could not be obtained, please contact Pi-hole Support
  Additional debugging output:
On branch master
/opt/pihole/update.sh: line 36:  3267 Segmentation fault      git status

Line 36 of that shell script contains a call to

36 GitCheckUpdateAvail() {

Not sure where to go with this.

Debug Token:

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

SYSTEM INFO

Raspberry Pi 3 Model B Rev 1.2
Raspbian GNU/Linux 11 (bullseye)
Linux pihole 6.1.21-v7+ #1642 SMP Mon Apr  3 17:20:52 BST 2023 armv7l GNU/Linux
git --version
git version 2.30.2


root@pihole:/home/pi# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        29G  6.7G   21G  25% /
devtmpfs        333M     0  333M   0% /dev
tmpfs           461M  3.9M  458M   1% /dev/shm
tmpfs           185M  1.1M  184M   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
/dev/mmcblk0p1  255M   51M  205M  20% /boot
tmpfs            93M   20K   93M   1% /run/user/1000

Thank you!

This is an OS level issue.
Apparently git is broken in your system.

To test it, change your current directory to /var/www/html/admin:

cd /var/www/html/admin

And run these 2 commands:

git status

git rev-parse --abbrev-ref HEAD

What are the outputs?

Thank you for your post - I'm not an expert with git, so here are the outputs as requested. Clearly something is amiss with the 2nd command output.

root@pihole:/var/www/html/admin# git status
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)
root@pihole:/var/www/html/admin# git rev-parse --abbrev-ref HEAD
HEAD
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
root@pihole:/var/www/html/admin#

Please, try these commands and post the output:

cd /etc/.pihole/
git rev-parse --abbrev-ref HEAD

Here it is

root@pihole:/etc/.pihole# pwd
/etc/.pihole
root@pihole:/etc/.pihole# git rev-parse --abbrev-ref HEAD
master
root@pihole:/etc/.pihole#

Strange... git command worked this time, but it failed in the web repo.
It also failed when the debug log was generated:

*** [ DIAGNOSING ]: Core version
git status failed

*** [ DIAGNOSING ]: Web version
[✓] Version: 
[i] Remotes: 
[i] Branch: HEAD
[i] Commit: 

Please, try pihole updatechecker.

If it runs without errors or warnings, try pihole -v.
If you see errors, please generate a new debug log and post the new Token.

I tried both commands, though the first one failed :-/

root@pihole:/etc/.pihole# pihole updatechecker
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: Needed a single revision
root@pihole:/etc/.pihole#
root@pihole:/etc/.pihole#
root@pihole:/etc/.pihole# pihole -v
  Pi-hole version is N/A (Latest: v5.18.3)
  web version is HEAD N/A (Latest: v5.21)
  FTL version is v5.25.2 (Latest: v5.25.2)
root@pihole:/etc/.pihole#

generating the output of pihole -d now .....

Your debug token is: https://tricorder.pi-hole.net/4uud3EQV/

Is this a new (recent) installation or an old installation?

Apparently your repositories are broken, causing git errors:

  • git status is failing in /etc/.pihole
  • git rev-parse --abbrev-ref HEAD is failing in /var/www/html/admin

Try the steps suggested here to fix the repositories and try pihole updatechecker again.

If still fails, you can try to repair your installation with pihole -r and select repair, but this won't work if your SD card is failing.

It's been around for some time, a few months ago my old Pi was failing and I moved this over to a more recent Raspberry Pi. I started to have these problems a few weeks ago, first I thought it was an issue perhaps with the githup repo that would resolve itself, but that hasn't happened.

I will try the steps you suggest - thank you so much for your help, really didn't know what to do.

Is there a reliable and easy way for me to check the soundness of the SD card? Just as a way to eliminate causes.

I haven't run into any issues with this pi otherwise, though it mostly serves pihole. OS upgrades etc have all worked without problems, and I run a tiny python command line server to serve up a log file for some other app - but that's it.

Ok, in case you are still reading :slight_smile:

I tried both sets of command and got segmentation errors. I ended up uninstalling git and reinstalling and the segmentation errors went away, so that's encouraging.

I tried the update again, that didn't work, then I did the updatechecker which also didn't succeed. I wonder if I should go ahead with the repair option, or if the lack of segmentation error indicates another way to proceed?

root@pihole:/etc/.pihole# pihole -up
  [✓] Update local cache of available packages
  [i] Existing PHP installation detected : PHP version 7.4.33
  [✓] Checking for git
  [✓] Checking for iproute2
  [✓] Checking for dialog
  [✓] Checking for ca-certificates

  [i] Checking for updates...
  [i] Pi-hole Core:     update available
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument '@{0}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: no such branch: 'master'

  Error: Remote revision could not be obtained, please contact Pi-hole Support
  Additional debugging output:
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)
root@pihole:/etc/.pihole# pihole updatechecker
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: Needed a single revision
root@pihole:/etc/.pihole#

[✓] Your debug token is: https://tricorder.pi-hole.net/kRhqQqcc/

I appreciate the guidance.

Thanks!

As a last resort, you can remove and reinstall the repositories.

These commands will completely remove the repositories and clone them again:

sudo rm -rf /var/www/html/admin
sudo git clone https://github.com/pi-hole/web.git /var/www/html/admin

cd /
sudo rm -rf /etc/.pihole
sudo git clone https://github.com/pi-hole/pi-hole /etc/.pihole

Should I try the repair option first or just go for this?

Also, will I lose configuration information, it will that be preserved?

Thanks!

I thought you already had tried and it failed.
Try this first.

It will be preserved.
The configuration files are stored in a different directory (/etc/pihole without the dot).

I tried the repair option first that didn't work, I'll post what happened at the very bottom in case you are curious or it's helpful to know if others have similar problems.

Then I tried the sequence of commands you provided to get the repos again, and it looks like it may have fixed it (for the moment at least, I guess I'll find out with the next update).

Many super thanks for your help, I really appreciated your helping.

Maybe I'll try to clone the SD card to have a backup in case the card is getting flakey, odd with the git command.

root@pihole:/etc/.pihole# sudo rm -rf /var/www/html/admin/
root@pihole:/etc/.pihole# sudo git clone https://github.com/pi-hole/web.git /var/www/html/admin
Cloning into '/var/www/html/admin'...
remote: Enumerating objects: 37117, done.
remote: Counting objects: 100% (1883/1883), done.
remote: Compressing objects: 100% (1146/1146), done.
remote: Total 37117 (delta 1035), reused 1516 (delta 737), pack-reused 35234
Receiving objects: 100% (37117/37117), 37.34 MiB | 7.77 MiB/s, done.
Resolving deltas: 100% (20240/20240), done.

root@pihole:/etc/.pihole# cd /
root@pihole:/# sudo rm -rf /etc/.pihole
root@pihole:/# sudo git clone https://github.com/pi-hole/pi-hole /etc/.pihole
Cloning into '/etc/.pihole'...
remote: Enumerating objects: 23730, done.
remote: Counting objects: 100% (620/620), done.
remote: Compressing objects: 100% (359/359), done.
remote: Total 23730 (delta 366), reused 479 (delta 256), pack-reused 23110
Receiving objects: 100% (23730/23730), 7.86 MiB | 5.66 MiB/s, done.
Resolving deltas: 100% (15175/15175), done.

root@pihole:/# pihole -up
  [✓] Update local cache of available packages
  [i] Existing PHP installation detected : PHP version 7.4.33
  [✓] Checking for git
  [✓] Checking for iproute2
  [✓] Checking for dialog
  [✓] Checking for ca-certificates

  [i] Checking for updates...
  [i] Pi-hole Core:     up to date
  [i] Web Interface:    up to date
  [i] FTL:              up to date

  [✓] Everything is up to date!


The unsuccessful repair attempt:

 [i] Latest FTL Binary already installed (v5.25.2). Confirming Checksum...
  [i] **Corruption detected...**
  [✓] Downloading and Installing FTL
  [✓] Installing scripts from /etc/.pihole

and then toward the end

  [✓] Pi-hole blocking is enabled
**fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.**
**Use '--' to separate paths from revisions, like this:**
**'git <command> [<revision>...] -- [<file>...]'**
**fatal: Needed a single revision**

  [i] The install log is located at: /etc/pihole/install.log
  [✓] Update complete!

  Current Pi-hole version is v5.18.2
  Current web version is HEAD N/A
  Current FTL version is v5.25.2
root@pihole:/etc/.pihole#

and pihole -up resulted in this

 [i] Pi-hole Core:     update available
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument '@{0}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: no such branch: 'master'

  Error: Remote revision could not be obtained, please contact Pi-hole Support
  Additional debugging output:
On branch master

No commits yet

nothing to commit (create/copy files and use "git add" to track)

Thanks again!

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