AutoShutDown Plugin (Version 5.1.11) crashes at start

  • On my system autoshutdown service chrashes at startup. This is the log output:

    Code
    Feb 18 20:42:08 u-nas autoshutdown[2989]: root: INFO: '_check_config(): Kernel 4.19.0-14-amd64 supports power management modes:'
    Feb 18 20:42:08 u-nas autoshutdown[2989]: root: INFO: '_check_config(): Kernel supports: HIBERNATE (suspend to DISK)'
    Feb 18 20:42:08 u-nas autoshutdown[2989]: root: INFO: '_check_config(): Kernel supports: SUSPEND (suspend to RAM)'
    Feb 18 20:42:08 u-nas autoshutdown[2989]: root: INFO: '_check_config(): Kernel supports: HYBRID-SLEEP (suspend to RAM and DISK)'
    Feb 18 20:42:08 u-nas autoshutdown[2989]: root: INFO: '_check_config(): SHUTDOWNCOMMAND is set to: systemctl hibernate'
    Feb 18 20:42:08 u-nas autoshutdown[2989]: root: INFO: '_check_networkconfig(): ------------------------------------------------------'
    Feb 18 20:42:08 u-nas autoshutdown[2989]: root: INFO: '_check_networkconfig(): Find available network interfaces and their IPv4 addresses'
    Feb 18 20:42:08 u-nas autoshutdown[2989]: root: INFO: '_check_networkconfig(): 'eno1' has IPv4 address: 192.168.41.22'
    Feb 18 20:42:08 u-nas autoshutdown[2989]: /usr/sbin/autoshutdown: line 1127: /sys/class/net/eno1.42@eno1/operstate: No such file or directory


    The file directory does not exits, the correct path would be:


    Code
    /sys/class/net/eno1.42/operstate


    The path followed sysmlinks is

    Code
    /sys/devices/virtual/net/eno1.42/operstate


    How can I fix the '@eno1'?

  • Hi sorry did not see this till now. I think this is easily fixed please do the following:


    Change the following in /usr/sbin/autoshutdown, line 1126.


    Code
    From: local state; state="$(< "/sys/class/net/${net_iface}/operstate")"
    To: local state; state="$(< "/sys/class/net/${net_iface%@*}/operstate")"

    Please let me now if this work for you and if it does I will place the fix in the 5.1.12 release.


    if it does not work I need a bit more info to fix it (hopefully this will not be required). let me know how you get on :)

  • It now starts (automatically, triggered somewehre?) with the following output:

    Code
    Feb 19 14:54:45 u-nas autoshutdown[2390]: root: INFO: '_check_networkconfig(): ------------------------------------------------------'
    Feb 19 14:54:45 u-nas autoshutdown[2390]: root: INFO: '_check_networkconfig(): Find available network interfaces and their IPv4 addresses'
    Feb 19 14:54:45 u-nas autoshutdown[2390]: root: INFO: '_check_networkconfig(): 'eno1' has IPv4 address: 192.168.41.22'
    Feb 19 14:54:45 u-nas autoshutdown[2390]: root: INFO: '_check_networkconfig(): 'eno1.42@eno1' status: up, IPv4 address: N/A, retrying in 5s ...'
    Feb 19 14:54:50 u-nas autoshutdown[2390]: root: INFO: '_check_networkconfig(): 'eno1.42@eno1' status: up, IPv4 address: N/A, retrying in 5s ...'
    Feb 19 14:54:55 u-nas autoshutdown[2390]: root: INFO: '_check_networkconfig(): 'eno1.42@eno1' status: up, IPv4 address: N/A, retrying in 5s ...'


    The eno1.42 is used for a VM and normally not assigned any IP ..

  • Hi systemd would have triggered the restart and the script was trying to check if the interface will get assigned (it has a 60 second timeout). What you are seeing in new behaviour as of v5.1.11. The new behaviour is to fix the restart from suspend and hibernate when using DHCP (and is similar to that of the 4.X version of the script). You can optimise this behaviour using the FORCE_NIC setting (see /etc/autoshutdown.default for more details).


    So I am assuming the script started up and ran autoshutdown (even if a bit slower to start)? Can you confirm it is now working, then i add the fix the a new release. Thanks you for checking this for me

  • It now works as expected. After wakeup the eno1.42@eno1 is checked a few times for an IP address and then it states 'Script started' ..

    I changed the line 1126 and the same pattern one line below.

  • If you had to change two line I have a different solution, which is more compatible with older scripts it turns out.


    Remove the previous fixes and change the following in /usr/sbin/autoshutdown, line 1151.


    Code
    From: '$1 ~ regex && !/SLAVE/ {print $1}')
    To: '$1 ~ regex && !/SLAVE/{sub(/@.*/,"",$1); print $1}')

    The script the will now dropped the '@<interface_name>' from the network interface identification throughout the script. For example: 'eth0.42@eth0' would know as 'eth0.42'. This is similar to what it used to do I think. Can you give it a try and double check it form me. If this is good I will get the release out with the fix.


    Thanks again for doing this for me

  • Funktioniert.

Participate now!

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