Autoshutdown crashes

  • I have installed OMV for the first time and are only configuring so far. The autoshutdown plug in crashes repeatedly.

    From the log file, it looks like a problem with the priority variable. I don't know what to do about it.


    autoshutdown_part.txt

  • Phasetone

    Added the Label OMV 5.x
  • Hi, yet this is a bit odd, can I have a copy of your /etc/autoshutdown.conf. Also can you modify the script that is running /usr/sbin/autoshutdown and change line 1 to "#!/bin/bash -x" (you will need to be root to do this) this will show what the script is doing just prior the problem.

  • Hi,

    Thanks for your reply.


    # This file is auto-generated by openmediavault (https://www.openmediavault.org)

    # WARNING: Do not edit this file, your changes will get lost.



    ENABLE="true"

    CYCLES=6

    SLEEP=180

    IPCHECK="true"

    RANGE="2..254,0x0..0xFFFF"

    SHUTDOWNCOMMAND="systemctl hibernate"

    CHECKCLOCKACTIVE="false"

    UPHOURS="06:00..20:00"

    WAKEALARM_SET="false"

    WAKEALARM="08:00"

    WAKEALARM_UPHOURS="false"

    CHECKSOCKETS="true"

    NSOCKETNUMBERS="21,22,80,3689,6991,9091,49152"

    ULDLCHECK="true"

    ULDLRATE=50

    LOADAVERAGECHECK="false"

    LOADAVERAGE=40

    HDDIOCHECK="true"

    HDDIO_RATE=401

    SMARTCHECK="false"

    CHECK_SAMBA="true"

    CHECK_CLI="true"

    CHECKPROCNAMES="true"

    LOADPROCNAMES="smbd,nfsd,mt-daapd,forked-daapd"

    TEMPPROCNAMES="in.tftpd"

    PLUGINCHECK="false"

    SYSLOG="true"

    VERBOSE="false"

    FAKE="false"

  • Like this?


    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: ++ FAKE=falseSep 26 15:18:50 PT-NAS autoshutdown[2353]: + read -r var

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + __check_value CHECK_SAMBA_CLIENTS '^(true|false)$' 'set to: '\''true'\'' or '\''false'\'''

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + local -r var=CHECK_SAMBA_CLIENTS

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + local -r 'regex=^(true|false)$'

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + local -r 'msg=set to: '\''true'\'' or '\''false'\'''

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + local -r default=true

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + [[ false =~ ^(true|false)$ ]]

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + read -r var

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + local -r 'regex_hours=(2[0-3]|[01]?[0-9])((:[0-5]?[0-9])?)'

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: ++ locale abday

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: ++ sed 's:;:|:g'

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + local -r 'short_days=sön|mån|tis|ons|tor|fre|lör'

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + '[' false == true ']'

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + _log 'WARNING: CHECKCLOCKACTIVE set false not validating: UPHOURS and OVERRIDEUPHOURS'

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: ++ id -nu 4294967295

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: ++ true

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + local -r user=

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: ++ basename /usr/sbin/autoshutdown

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + local -r tag=autoshutdown

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + [[ WARNING: CHECKCLOCKACTIVE set false not validating: UPHOURS and OVERRIDEUPHOURS =~ ^([A-Za-z]*): *(.*) ]]

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: + '[' false == true ']'

    Sep 26 15:18:50 PT-NAS autoshutdown[2353]: /usr/sbin/autoshutdown: rad 99: priority: obunden variabel

  • hmm, this work for me just find however, I really don't like the current _log function. cany you try replacing the current _log function with the following (again you have to edit the /usr/sbin/autoshitdown script by hand:


    Hopefully this will work for you without issues but let see. let me know how you get on.

  • After changing the script and starting autoshutdown, I got this error:



    Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; omv-salt deploy run --no-color autoshutdown 2>&1' with exit code '1': debian:
    ---------- ID: configure_autoshutdown Function: file.managed Name: /etc/autoshutdown.conf Result: True Comment: File /etc/autoshutdown.conf updated Started: 09:22:09.920857 Duration: 109.242 ms Changes: ---------- diff: --- +++ @@ -2,7 +2,7 @@ # WARNING: Do not edit this file, your changes will get lost.

    -ENABLE="false" +ENABLE="true" CYCLES=6 SLEEP=180 IPCHECK="true"
    ---------- ID: start_autoshutdown_service Function: service.running Name: autoshutdown Result: False Comment: Service autoshutdown has been enabled, and is dead Started: 09:22:10.052727 Duration: 564.065 ms Changes: ---------- autoshutdown: True

    Summary for debian
    ------------
    Succeeded: 1 (changed=2)
    Failed: 1
    ------------
    Total states run: 2
    Total run time: 673.307 ms

  • And the details:


    Error #0:
    OMV\ExecException: Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; omv-salt deploy run --no-color autoshutdown 2>&1' with exit code '1': debian:
    ---------- ID: configure_autoshutdown Function: file.managed Name: /etc/autoshutdown.conf Result: True Comment: File /etc/autoshutdown.conf updated Started: 09:22:09.920857 Duration: 109.242 ms Changes: ---------- diff: --- +++ @@ -2,7 +2,7 @@ # WARNING: Do not edit this file, your changes will get lost.

    -ENABLE="false" +ENABLE="true" CYCLES=6 SLEEP=180 IPCHECK="true"
    ---------- ID: start_autoshutdown_service Function: service.running Name: autoshutdown Result: False Comment: Service autoshutdown has been enabled, and is dead Started: 09:22:10.052727 Duration: 564.065 ms Changes: ---------- autoshutdown: True

    Summary for debian
    ------------
    Succeeded: 1 (changed=2)
    Failed: 1
    ------------
    Total states run: 2
    Total run time: 673.307 ms in /usr/share/php/openmediavault/system/process.inc:195
    Stack trace:
    #0 /usr/share/php/openmediavault/engine/module/serviceabstract.inc(62): OMV\System\Process->execute()
    #1 /usr/share/openmediavault/engined/rpc/config.inc(167): OMV\Engine\Module\ServiceAbstract->deploy()
    #2 [internal function]: Engined\Rpc\Config->applyChanges(Array, Array)
    #3 /usr/share/php/openmediavault/rpc/serviceabstract.inc(123): call_user_func_array(Array, Array)
    #4 /usr/share/php/openmediavault/rpc/serviceabstract.inc(149): OMV\Rpc\ServiceAbstract->callMethod('applyChanges', Array, Array)
    #5 /usr/share/php/openmediavault/rpc/serviceabstract.inc(588): OMV\Rpc\ServiceAbstract->OMV\Rpc\{closure}('/tmp/bgstatus1x...', '/tmp/bgoutputy5...')
    #6 /usr/share/php/openmediavault/rpc/serviceabstract.inc(159): OMV\Rpc\ServiceAbstract->execBgProc(Object(Closure))
    #7 /usr/share/openmediavault/engined/rpc/config.inc(189): OMV\Rpc\ServiceAbstract->callMethodBg('applyChanges', Array, Array)
    #8 [internal function]: Engined\Rpc\Config->applyChangesBg(Array, Array)
    #9 /usr/share/php/openmediavault/rpc/serviceabstract.inc(123): call_user_func_array(Array, Array)
    #10 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod('applyChangesBg', Array, Array)
    #11 /usr/sbin/omv-engined(537): OMV\Rpc\Rpc::call('Config', 'applyChangesBg', Array, Array, 1)
    #12 {main}

  • hi, this is not all that useful as it the salt output not the service output, but I am not entirely surprised this is not working as I am missing something on your system. The script should have worked as the original failure would kill the script on all systems and we not seeing this. However, this does not mean there is no issue.


    So I going to need a few more bit of info form you, it also possible the script edit you did has an issue.:


    1. Can I have the output form the failed service. this can be obtained from 'sudo journalctl -u autoshutdown.service' this should contain were the script is now failing.


    2. Can I have the output of: 'cat /etc/default/locale' I will mimic your localisation just to see if that the issue.


    3. Less useful but I just what to check: 'bash --version'


    1. Is the most important as i need to know why the script is now falling.

  • 1:

    sep 27 17:51:47 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:51:47 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:51:47 PT-NAS systemd[5832]: autoshutdown.service: Failed to exe

    sep 27 17:51:47 PT-NAS systemd[5832]: autoshutdown.service: Failed at ste

    sep 27 17:51:47 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:51:47 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    sep 27 17:51:51 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:51:51 PT-NAS systemd[1]: autoshutdown.service: Scheduled restar

    sep 27 17:51:51 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:51:51 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:51:51 PT-NAS systemd[5842]: autoshutdown.service: Failed to exe

    sep 27 17:51:51 PT-NAS systemd[5842]: autoshutdown.service: Failed at ste

    sep 27 17:51:51 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:51:51 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    sep 27 17:51:54 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:51:54 PT-NAS systemd[1]: autoshutdown.service: Scheduled restar

    sep 27 17:51:54 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:51:54 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:51:54 PT-NAS systemd[5848]: autoshutdown.service: Failed to exe

    sep 27 17:51:54 PT-NAS systemd[5848]: autoshutdown.service: Failed at ste

    sep 27 17:51:54 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:51:54 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    sep 27 17:51:57 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:51:57 PT-NAS systemd[1]: autoshutdown.service: Scheduled restar

    sep 27 17:51:57 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:51:57 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:51:57 PT-NAS systemd[5851]: autoshutdown.service: Failed to exe

    sep 27 17:51:57 PT-NAS systemd[5851]: autoshutdown.service: Failed at ste

    sep 27 17:51:57 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:51:57 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    sep 27 17:52:00 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:52:00 PT-NAS systemd[1]: autoshutdown.service: Scheduled restar

    sep 27 17:52:00 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:52:00 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:52:00 PT-NAS systemd[5859]: autoshutdown.service: Failed to exe

    sep 27 17:52:00 PT-NAS systemd[5859]: autoshutdown.service: Failed at ste

    sep 27 17:52:00 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:52:00 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    sep 27 17:52:04 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:52:04 PT-NAS systemd[1]: autoshutdown.service: Scheduled restar

    sep 27 17:52:04 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:52:04 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:52:04 PT-NAS systemd[5860]: autoshutdown.service: Failed to exe

    sep 27 17:52:04 PT-NAS systemd[5860]: autoshutdown.service: Failed at ste

    sep 27 17:52:04 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:52:04 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    sep 27 17:52:07 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:52:07 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:52:07 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:52:07 PT-NAS systemd[1]: autoshutdown.service: Scheduled restar

    sep 27 17:52:07 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:52:07 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:52:07 PT-NAS systemd[5868]: autoshutdown.service: Failed to exe

    sep 27 17:52:07 PT-NAS systemd[5868]: autoshutdown.service: Failed at ste

    sep 27 17:52:07 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:52:07 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    sep 27 17:52:10 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:52:10 PT-NAS systemd[1]: autoshutdown.service: Scheduled restar

    sep 27 17:52:10 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:52:10 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:52:10 PT-NAS systemd[5877]: autoshutdown.service: Failed to exe

    sep 27 17:52:10 PT-NAS systemd[5877]: autoshutdown.service: Failed at ste

    sep 27 17:52:10 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:52:10 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    sep 27 17:52:13 PT-NAS systemd[1]: autoshutdown.service: Service RestartS

    sep 27 17:52:13 PT-NAS systemd[1]: autoshutdown.service: Scheduled restar

    sep 27 17:52:13 PT-NAS systemd[1]: Stopped openmediavault-autoshutdown pl

    sep 27 17:52:13 PT-NAS systemd[1]: Started openmediavault-autoshutdown pl

    sep 27 17:52:13 PT-NAS systemd[5878]: autoshutdown.service: Failed to exe

    sep 27 17:52:13 PT-NAS systemd[5878]: autoshutdown.service: Failed at ste

    sep 27 17:52:13 PT-NAS systemd[1]: autoshutdown.service: Main process exi

    sep 27 17:52:13 PT-NAS systemd[1]: autoshutdown.service: Failed with resu

    lines 9016-9038/9038 (END)


    2:

    LANG="sv_SE.UTF-8"


    3:

    GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)


    Could it be the locale settings?

  • I still cannot re-create your issue even with localisation changes. However this has lead me to finding postfix issue with some of the regex expressions that can cause issues. So can you test the below?


    Here how to do it, this will require you to do this all in a shell.


    Code
    $ wget https://raw.githubusercontent.com/nrandon/openmediavault-autoshutdown/test/usr/sbin/autoshutdown
    $ chmod +x autoshutdown
    $ sudo cp autoshutdown /usr/sbin/autoshutdown


    To test first run the scripts directly directly:


    Code
    $ sudo /usr/sbin/autoshutdown


    Hopefully this will work. If is does not run add the "#!/bin/bash -x" and send the output close to were it stopped as you have done before and I try to see if i can see what up. If it work then use the OMV GUI and start the service as you have before and i submit a patch with a set of fixes.

  • OK. With your changes, the script does not crash any more. But it does not go to sleep either.

    It finds activity on the network port all the timer........

  • ok so that an improvement. to know what going on in the post stuff i need a little more info. (this is why the script has a debug/verbose mode) turn on debug in the script and it should give the raw port info it found to determine there was activity. if you post the section with debug on i can tell you what it thinks is going on or if you found another bug ;)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!