Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running 'gravity-sync auto' #444

Closed
imamouse111 opened this issue Apr 21, 2024 · 7 comments
Closed

Error when running 'gravity-sync auto' #444

imamouse111 opened this issue Apr 21, 2024 · 7 comments

Comments

@imamouse111
Copy link

Looking for advice on how to get 'gravity-sync auto' to work in Pihole Docker instance. I can get 'gravity-sync push' to work but 'auto' throws back 'System has not been booted with systemd as init system (PID 1). Can't operate.' And that's after I've already installed systemd.

Here's my basic setup:

Pihole Docker (Openmediavault (Portainer (Pihole + macvlan))) = Primary 192.168.86.222
Pihole Raspi (bare metal) = Secondary 192.168.86.154

Here is my Docker Compose YAML:

services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - 55:53/tcp
      - 55:53/udp
      - 67:67/udp
      - 83:80/tcp
    environment:
      - TZ:$TZ
      - WEBPASSWORD:$PW
      - DNSSEC=true
    volumes:
      - $DATA/pihole/config/etc-pihole:/etc/pihole
      - $DATA/pihole/config/etc-dnsmasq.d:/etc/dnsmasq.d
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
    networks:
      macvlan:
        ipv4_address: "192.168.86.222"

I'm able to install Gravity Sync on the raspi pretty easily using this guide, but installing in the Docker Pihole requires a whole process that involves doing a 'docker exec' into the container and installing the OpenSSH client and systemd, but it eventually worked. I got Gravity Sync to successfully install but I don't want to have to re-do this process everytime I restart the container (suggestions on how to avoid this are welcome).

Per the above guide, I was able to modify the gravity-sync.conf files on each instance as below. I'm not totally confident I've done everything correctly, so these honestly might be my main issue.

Raspi Pihole gravity-sync.conf:

# REQUIRED SETTINGS ##########################

REMOTE_HOST='192.168.86.154'
REMOTE_USER='pi'

# CUSTOM VARIABLES ###########################

# Pi-hole Folder/File Customization - Only need to be customized when using containers
 LOCAL_PIHOLE_DIRECTORY='/etc/pihole'                       # Local Pi-hole data directory
 REMOTE_PIHOLE_DIRECTORY='/etc/pihole'                      # Remote Pi-hole data directory
 LOCAL_DNSMASQ_DIRECTORY='/etc/dnsmasq.d'                # Local DNSMASQ/FTL data directory
 REMOTE_DNSMASQ_DIRECTORY='/etc/dnsmasq.d'               # Remote DNSMASQ/FTL data directory
 LOCAL_FILE_OWNER='999:999'                       # Local file owner for Pi-hole
 REMOTE_FILE_OWNER='999:999'                      # Remote file owner for Pi-hole

# Pi-hole Docker/Podman container name - Docker will pattern match anything set below
# LOCAL_DOCKER_CONTAINER=''                                 # Local Pi-hole container name
 REMOTE_DOCKER_CONTAINER='pihole'                               # Remote Pi-hole container name

# HIDDEN FIGURES #############################
# See https://github.com/vmstan/gravity-sync/wiki/Hidden-Figures

Docker Pihole gravity-sync.conf:

# REQUIRED SETTINGS ##########################

REMOTE_HOST='192.168.86.222'
REMOTE_USER='root'    #Using 'root' because no 'pi' user is detected when I 'id pi'

# CUSTOM VARIABLES ###########################

# Pi-hole Folder/File Customization - Only need to be customized when using containers
 LOCAL_PIHOLE_DIRECTORY='/etc/pihole'                       # Local Pi-hole data directory
 REMOTE_PIHOLE_DIRECTORY='/etc/pihole'                      # Remote Pi-hole data directory
 LOCAL_DNSMASQ_DIRECTORY='/etc/dnsmasq.d'                # Local DNSMASQ/FTL data directory
 REMOTE_DNSMASQ_DIRECTORY='/etc/dnsmasq.d'               # Remote DNSMASQ/FTL data directory
 LOCAL_FILE_OWNER='999:999'                       # Local file owner for Pi-hole
 REMOTE_FILE_OWNER='999:999'                      # Remote file owner for Pi-hole

# Pi-hole Docker/Podman container name - Docker will pattern match anything set below
 LOCAL_DOCKER_CONTAINER='pihole'                                 # Local Pi-hole container name
#REMOTE_DOCKER_CONTAINER=''                               # Remote Pi-hole container name

# HIDDEN FIGURES #############################
# See https://github.com/vmstan/gravity-sync/wiki/Hidden-Figures

If someone can share how they were able to get this to work or point out what I'm doing wrong, I would be eternally grateful. Thanks in advance =)

@imamouse111
Copy link
Author

imamouse111 commented Apr 21, 2024

If it helps...

This is the system response to trying to run 'push':

root@XXXXXXXXX:~# gravity-sync push
∞ Initializing Gravity Sync (4.0.7)
✓ Loading gravity-sync.conf
✓ Detecting local Pi-hole installation
✓ Detecting remote Pi-hole installation
✓ Gravity Sync remote peer is configured
✓ Evaluating arguments: PUSH
» Remote target [email protected]
✓ Validating pathways to Pi-hole
✓ Validating pathways to DNSMASQ
✓ Hashing the remote Gravity Database
✓ Comparing to the local Gravity Database
✓ Hashing the remote DNS Records
✓ Comparing to the local DNS Records
! DNS CNAMEs not detected on the local Pi-hole
! Static DHCP Addresses not detected on the local Pi-hole
! No replication is required at this time
∞ Gravity Sync PUSH exited after 6 seconds

And this is the response to 'auto':

root@XXXXXXXXX:~# gravity-sync auto
∞ Initializing Gravity Sync (4.0.7)
✓ Loading gravity-sync.conf
✓ Detecting local Pi-hole installation
✓ Detecting remote Pi-hole installation
✓ Gravity Sync remote peer is configured
✓ Evaluating arguments: AUTOMATE
✓ Customizing service file username
✓ Customizing service file executable path
✓ Randomizing service timers
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
✓ Moving systemd timer into place
✓ Moving systemd service into place
∞ Reloading systemd daemonSystem has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down
✗ Reloading systemd daemon

@imamouse111
Copy link
Author

For anyone else who come across this issue in the future, it seems the Pihole Docker container can not use systemd, which gravity-sync uses to run 'auto'. My solution was to run a cron job on the Docker container every 6hrs with the command 'gravity-sync push' to sync with my bare metal Pihole.

@vmstan
Copy link
Owner

vmstan commented Apr 25, 2024

You shouldn't be installing Gravity Sync inside of the Pi-hole container, but directly on the container host, which it then has logic to manage the container operations. Otherwise whenever you restart/update the image everything about it will be overwritten.

@imamouse111
Copy link
Author

You shouldn't be installing Gravity Sync inside of the Pi-hole container, but directly on the container host, which it then has logic to manage the container operations. Otherwise whenever you restart/update the image everything about it will be overwritten.

So you're saying, if I have a Pihole Docker container on a Linux host, Gravity Sync should be installed on the Linux host? Not the Pihole container?

@vmstan
Copy link
Owner

vmstan commented May 29, 2024

Yes

@imamouse111
Copy link
Author

Thank you, I'll try that.

@imamouse111
Copy link
Author

Yes

Just wanted to say thanks again, this absolutely worked. Appreciate your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants