Adguardhome ipk autostart not working after reboot

What's the actual problem?

It doesn't start on boot, but works if started manually?
If that's the case, it has nothing to do with the files and their naming.

Yes its start with manual but after reboot its not autostart.

Here the both rc.d files for start / stop scripts

cat /etc/rc.d/K89adguardhome
#!/bin/sh /etc/rc.common

PROG=/usr/bin/AdGuardHome

USE_PROCD=1

# starts after network starts
START=21
# stops before networking stops
STOP=89

start_service() {
  config_load adguardhome
  config_get WORK_DIR config workdir

  [ -d "$WORK_DIR" ] || mkdir -m 0755 -p "$WORK_DIR"

  procd_open_instance
  procd_set_param command "$PROG" -c /etc/adguardhome.yaml -w "$WORK_DIR" --no-check-update
  procd_set_param stdout 1
  procd_set_param stderr 1
  procd_close_instance
}


cat /etc/rc.d/S21adguardhome
#!/bin/sh /etc/rc.common

PROG=/usr/bin/AdGuardHome

USE_PROCD=1

# starts after network starts
START=21
# stops before networking stops
STOP=89

start_service() {
  config_load adguardhome
  config_get WORK_DIR config workdir

  [ -d "$WORK_DIR" ] || mkdir -m 0755 -p "$WORK_DIR"

  procd_open_instance
  procd_set_param command "$PROG" -c /etc/adguardhome.yaml -w "$WORK_DIR" --no-check-update
  procd_set_param stdout 1
  procd_set_param stderr 1
  procd_close_instance
}

You need to look at the documentation...

Ok, i am checking now.

Then the problem isn't with the adguard scripts.
Use the workaround provided.

You could also try to rename the start softlink to S99, instead of S21, so it starts last.

Added manually as suggestion but not working.

And after manual start its working without any issue. Seems like binding issue but i didnt notice any other log or err.

Now only option i have to either reinstall once again or live with this manual start. :frowning:

Read the post with the suggestion again.

Finally seems its fixed. That 21 to 99 is working solution as of now. Thank you :slight_smile:

So here first I run

a) service adguardhome disable
b) vi /etc/init.d/adguardhome. Change Start from 21 to 99 and Stop 89 to 120.
c) service adguardhome enable
d) reboot

1 Like

Or in /etc/rc.d do mv S21adguardhome S99adguardhome

2 Likes

You marked your own post as the solution.

I think @frollic gave you the solution.

Sorry I am new, not aware. But that the solution which @frollic suggested is working as of now.

So just unmark your post as the solution, and mark @frollic's post above where he gave you the S99 as the solution.

That way, it makes it easier for others who might have the same problem to go right to it.

Thanks.

Yes, its done. Thanks to both of you.

Bit late to this thread but is this something we should look to have changed in the main package? I have noticed that autostart from boot hasn't worked for me either before but the init.d script does work fine, so I figured it was some race condition with my own setup.

Should we potentially submit the start value change upstream?

Official AGH binary service install on OpenWrt uses:

START=95
STOP=01

Link: https://github.com/AdguardTeam/AdGuardHome/blob/e783564084c8396fa0f216103e339d9c6991981a/internal/home/service.go#L530

I had used the official binary service install for a couple of years and with that init.d setting and AGH started a boot 100% of the time.

1 Like

Thanks for this and for @frollic looking at the existing start/stop values and identifying the issue. I think it needs to be changed upstream to avoid the race condition that's being hit on startup.

I'll look to submit a PR with the init.d script values updated to avoid this.

1 Like

Pull request has been sent for this change to the master branch. At some point it should be cherry-picked down to 21.02.

Thanks to OP for raising this, @frollic for highlighting the fix and @WildByDesign for flagging the AdGuard Home procd init script values being used.

3 Likes

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