none
Dnscrypt-proxy starts then terminates on boot - no internet - SCRIPT TO RESTART IT

    Question

  • Background to problem:

    Our PC is Win 7 Pro 64-bit with 16GB RAM.   We have Verizon FIOS 1Gbps at home, so the setup is all pretty good.

    Five months ago, we installed Simple DNSCrypt 64-bit on our Win 7 machine, which in turn installed the dnscrypt-proxy process and service on the machine.  This encrypts all DNS lookups so our ISP cannot see where we go on the web, and we set it to connect to Cloudflare's new 1.1.1.1 DNS resolver, which is fast, highly secure and doesn't keep logs.   It's a great combination of services - see the very helpful article How to keep your ISP’s nose out of your browser history with encrypted DNS | Ars Technica .

    Starting just two weeks ago ±, on reboots, our internet connection got spotty on this machine and then started to die.  Not all reboots, but maybe half.  I figured out today that the dnscrypt-proxy process and service are starting on reboots but then something is terminating them pretty quickly as booting continues.  When they terminate, the PC cannot connect to the internet.

    I tried a number of things, but the only solution I found AT FIRST was to change the dnscrypt-proxy service's start to "Automatic (Delayed Start)", which works but causes every reboot to take longer.

    Here's a link that will take you to an xls with the entire Autoruns list of startup items: < THIS LINK >   (Rows with strikeout text are DISABLED and do not start.)   Do you see anything in this startup list that would cause the dnscrypt-proxy process and service to terminate?

    ► THEN SOME PROGRESS WITH MY FIRST SCRIPT AS FOLLOWS: ◄

    I have done the following:

    1) I have written this .bat file and saved it to my desktop - and you will see that the last line is the important one:

    echo. >> "C:\Users\[MyUserName]\Desktop\start-dnscrypt-results.txt"

    echo ---------- >> "C:\Users\[MyUserName]\Desktop\start-dnscrypt-results.txt"

    echo. >> "C:\Users\[MyUserName]\Desktop\start-dnscrypt-results.txt"

    echo %DATE% %TIME% >> "C:\Users\[MyUserName]\Desktop\start-dnscrypt-results.txt"

    sc start dnscrypt-proxy >> "C:\Users\[MyUserName]\Desktop\start-dnscrypt-results.txt"

    2) I have gone into Task Scheduler and scheduled the above batch file to run on Startup, with a delay of 30 seconds, and with Highest Privileges. (I had to use Task Scheduler with Highest Privileges because I could NOT get my bat file to run as Administrator otherwise - if I run it any other way, I must manually run it "as Administrator" and click Yes on the UAC prompt.)

    3) I configured the Properties of the service dnscrypt-proxy to retry to start three times.

    4) I also needed to change that service to start as "Automatic" and not "Automatic (Delayed Start)".

    Well, it is working.

    When I reboot, I can see either that the service is starting and staying on, in which case the .bat file leaves an error message in the results file,

    or that the service starts and then stops and then starts again, with success codes in the results file.

    What do you think?

    By the way, the results file looks like this --

    [SC] StartService FAILED 1056:

    An instance of the service is already running.


    Sat 10/13/2018 18:32:52.80 [SC] StartService FAILED 1056:

    An instance of the service is already running.


    Sat 10/13/2018 18:35:04.10 [SC] StartService FAILED 1056:

    An instance of the service is already running.


    Sat 10/13/2018 19:11:52.22

    SERVICE_NAME: dnscrypt-proxy TYPE : 10 WIN32_OWN_PROCESS
    STATE : 2 START_PENDING (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x7d0 PID : 3532 FLAGS :


    Sat 10/13/2018 20:52:48.19 [SC] StartService FAILED 1056:

    An instance of the service is already running.


    Sun 10/14/2018 7:17:51.31

    SERVICE_NAME: dnscrypt-proxy TYPE : 10 WIN32_OWN_PROCESS
    STATE : 2 START_PENDING (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x0 PID : 2592 FLAGS :
    ---------- Sun 10/14/2018 9:27:55.70 [SC] StartService: OpenService FAILED 5:

    Access is denied.

    WHAT DO YOU THINK ABOUT THIS SCRIPT?

    HOW WOULD I CHANGE IT TO SIT THERE FOR 15 MINUTES, TO CHECK IF dnscrypt-proxy IS RUNNING, AND IF NOT TO RESTART IT?

    Thanks.

     


    glnzglnz
    ☺ In the office, Dell Optiplex 7040 with 8GB RAM, Win 7 Pro 64-bit and Office 2010
    ☻ At home, Dell Optiplex 7010 with 16GB RAM dual-booting Win 7 Pro 64-bit (now with Office 365 Home) and Win 10 Pro 64-bit
    ♥ Also still have Dell Optiplex 755 with 4GB RAM with Win XP Pro SP3 (which still gets updates with the POS hack) and Office 2003




    • Edited by glnzglnz Thursday, November 8, 2018 6:01 PM
    Thursday, November 8, 2018 5:57 PM

All replies

  • Not sure what your specific question is.

    If your goal is to start a service, then from your perspective, error 1056 isn't really an error -- it just means the service is already running.


    -- Bill Stewart [Bill_Stewart]

    Thursday, November 8, 2018 6:54 PM
    Moderator