vmstan / gravity-sync

💫 The easy way to synchronize the DNS configuration of two Pi-hole 5.x instances.
https://vmstan.com/gravity-sync/
GNU General Public License v3.0
2.29k stars 128 forks source link

Initial gravity-sync push fails at Performing backup of remote Gravity Database #411

Closed gonzonia closed 2 months ago

gonzonia commented 11 months ago

I've seen a couple of other posts about this but no clear resolution.

I am updating my PiHoles. I have two Raspberry Pi3Bs running Bookworm. I used the Pi Imager to install PiOS Lite on each card. I then installed PiHole on each machine and using teleporter restored a backup from my previous PiHoles that was running on Buster. I updated gravity and all seems good.

I went through the installation of gravity-sync on each PiHole and then tried to run a gravity-sync push. After entering the password for the remote machine numerous times, it fails at "Performing backup of remote Gravity Database"

Any ideas on what to try?

Both are up to date with Pi-hole [v5.17.2] FTL [v5.23] Web Interface [v5.20.2]

ccruzen commented 11 months ago

I'm having this exact same issue. I'm running both my Pi-holes on Ubuntu server VMs. I've made sure neither of them has pihole in the hostname and have tried the dev branch of gravity-sync, neither of those have fixed the issue.

JeremyTTU commented 11 months ago

On my setup, I am using the user pi. I ran the "gravity-sync sudo" command to enable running sudo without a password. I was still getting the same error "sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper".

I checked to see how the password-less sudo was implemented and I saw there is a new file "/etc/sudoers.d/gs-nopasswd". Inside there, the user that was configured was root, so my user wasn't configured properly yet. I changed root to pi and then ran "gravity-sync push"... it was able to past the backup of the remote Gravity database.

Hope this helps!

gonzonia commented 11 months ago

Thanks. I'm not getting that error (or if I am I'm not sure where to see it). I verified the gs-nopasswd file does have the correct user in it though and ran the "gravity-sync sudo" command. I still have to enter the password multiple times for the remote pi and It still fails on "Performing backup of remote Gravity Database"

gonzonia commented 11 months ago

I also tried gravity-sync pull and while the local backup works, the remote backup still fails. I'm not sure if the errors are logged somewhere and where to find them.

ccruzen commented 11 months ago

Not sure what I did, but things are working now. Here are all of the things I did: Uninstalled gravity-sync apt update && apt upgrade Re-installed gravity-sync (the exact same way I did previously) on both machines gravity-sync config on both machines Changed the location of the gravity-sync log to /etc/gravity-sync/gravity-sync.log on both machines gravity-sync compare (on main machine) gravity-sync push (on main machine) Maybe they updated something or ?, but hope this may help you.

gonzonia commented 11 months ago

Thanks! I ran

gravity-sync config 
gravity-sync compare
gravity-sync push

and it worked! I'm guessing the config command fixed something that wasn't set correctly during install. This time I wasn't prompted for the remote pi password every step.

ccruzen commented 11 months ago

Good to hear. Would love to know what the issue was but happy that it's working.

NicoHag commented 10 months ago

I had this issue, and I had it for a while. I'm running it on Ubuntu Server 22.04.03 LTS. But then I tried adding it to the sudoers file, and it worked. This is exactly what I wrote: username ALL=(ALL:ALL) NOPASSWD: ALL

I hope it helps someone :)

LanWanGuy commented 8 months ago

On my setup, I am using the user pi. I ran the "gravity-sync sudo" command to enable running sudo without a password. I was still getting the same error "sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper".

I checked to see how the password-less sudo was implemented and I saw there is a new file "/etc/sudoers.d/gs-nopasswd". Inside there, the user that was configured was root, so my user wasn't configured properly yet. I changed root to pi and then ran "gravity-sync push"... it was able to past the backup of the remote Gravity database.

Hope this helps!

Thank you @JeremyTTU - Was having this same exact issue and modified the gs-nopasswd and everything works great now!

kaputcha commented 4 months ago

Thanks! I ran

gravity-sync config 
gravity-sync compare
gravity-sync push

and it worked! I'm guessing the config command fixed something that wasn't set correctly during install. This time I wasn't prompted for the remote pi password every step.

Thanks, mate. We must have tripped up at the same point, because these steps helped me when I was having exactly the same issues!

catchdave commented 2 months ago

I had a similar issue - and modifying the sudoers fixed this.

I traced my issue that I installed gravity-sync as one user (the non-root user I use to administer the server) and had a separate gravity-sync user setup for gravity sync. I think the instructions should be clear to install and execute gravity sync as the same user it should sync with (Gravity Sync added passwordless sudo for the user I was logged in as, not the user I specified would be doing the syncing).

vmstan commented 2 months ago

Effective July 26, 2024, this project has been retired. Thank you for your use and enthusiasm for a project that began as a few lines of bash in a Slack channel and envolved into something far more complex, and used by many thousands of Pi-hole enthusiasts over the last four years.