Tasktypeedit setup or getting Wake on Lan to work

  • Hello FOG Team,

    We have 31 identical laptops which are handed out to different customers on a regular basis with different images based on the situation. We have a laptop storage and synchronization case which keeps the Laptops connected to the network and electricity.

    I would love to achieve the following scenario:

    1. An image is deployed to the laptops
    2. The customer uses the laptops
    3. The customer returns the laptops
    4. The laptops are Full wiped on return
    5. The laptops wait in Wake-on-lan mode for the next image deployment

    While steps 1 to 3 are totally fine, I have the following problem with step 4 and 5:

    • The laptops WoL function only works when the shutdown happens from an installed OS
    • The electricity supply cannot be detached from the laptop, otherwise the WoL functionality is disabled. This means that laptops need to be inserted into the case in a powered state.
    • WoL function is not working after a shutdown from a Wipe task, i.e., shutdown executed by FOS.

    I came up with several ideas how this could be achieved using TaskTypeEdit plugin, but I am not sure which would be the easiest from the implementation point of view. (Ideally the “Coming home” task can only be performed on specific host names, I guess this might be possible via postinitscripts?)

    1. Create a FullWipe that also schedules a “restart” task
    • Schedules a “restart” task executed via the FOG client.
    • Somehow enable the WoL function of the network card inside FOS, so that WoL works after a FullWipe.
    1. Create a new Task with Tasktypeedit that
    • Schedules a “restart” task executed via the FOG client.
    • Performs a FullWipe
    • Deploys a default image with all settings setup
    • Schedules a “shutdown” task executed via the FOG client.

    I tried to start with the Tasktypeedit, but unfortunately I am kind of lost in how to set one up.
    I tried to look at existing tasks to copy the syntax and play around with it, but all Tasktypeedit entries are empty except for Name and Description, even though they show content in the overview (At least Kernel Args):

    Do you think it is possible to go with either 1 or 2?
    I am also open for alternative suggestions that could achieve my goal 🙂

    FOG server version: 1.5.9

  • Moderator

    @mstabrin Yeah, sounds like we found a good working solution for you. Great to hear that it did the trick.

    Edit: I did rename the topic so we and others might find it more easily when looking for WOL.

  • @Sebastian-Roth I had the chance to test things a bit earlier and it works now.

    It was a bit irritating though:
    When logging into the Debug mode and run:
    ethtool enp7s0 <- Name of the network interface
    It shows that the current WoL mode is g, which means wake on magic package.

    But when shutting down the PC WoL is not working.

    However, when I again manually set the WoL function via ethtool:
    ethtool -s enp7s0 wol g
    It is working after a shutdown!!!

    Hence my solution was to edit the /images/dev/postinitscripts/fog.postinit to rerun the WoL assignment at the beginning of any task:

    ## This file serves as a starting point to call your custom pre-imaging/post init loading scripts.
    ## <SCRIPTNAME> should be changed to the script you're planning to use.
    ## Syntax of post init scripts are
    #. ${postinitpath}<SCRIPTNAME>
    echo ''
    for interface_name in /sys/class/net/*
            echo "Setting WoL for interface: $(basename ${interface_name})"
            ethtool -s $(basename ${interface_name}) wol g

    This seems to work great and no matter which task I deploy the Laptop is able to WoL afterwards without an issue 🙂

    Thank you for pushing me in the right direction 😄
    If you think that this is not the most optimal solution (e.g., it should work out of the box since ethtool shows the correct state of the network interface from the beginning), I am also willing to look deeper into the problem to fix this issue for future releases.


  • @Sebastian-Roth Sorry for that question, it turned out that I was just too impatient and did not wait long enough for the reboot to happen…

    Rebooting works great now 🙂
    On monday I will provide a short feedback if the wake-on-lan function is working properly 🙂

    Have a great weekend!


  • Moderator

    @mstabrin said in Tasktypeedit setup:

    FullWipe - Reboot

    Do you mean scheduling a FullWipe task and that should do a reboot of the host and boot into the FullWipe? While I have not use wiping in a long time I would think that a scheduled task (deploy, capture, wipe, …) should actually reboot a host if fog-client is installed and working properly.

  • @Sebastian-Roth I will definitely look into that on Monday, thank you very much 🙂
    It would be amazing if that worked!

    For the next steps( assuming this will work, but I am quite confident 😉 ) :
    Do you think it is possible to chain the tasks:

    • Power Management Reboot
    • FullWipe
      In one deployment task?
      Like having a checkbox Schedule with PowerManagement Reboot Next to Schuedule with shutdown or create a New Task FullWipe - Reboot?


  • Moderator

    @mstabrin You might want to look into using ethtool to enable Wake-on-LAN within FOS before you shutdown the system.


    For testing I suggest you schedule a debug deploy task and boot up that machine you just tasked. You should end up in a command shell after boot up (and hitting ENTER twice). Now see what ethtool is telling you and if you can enable WOL. Probably depends on the NIC and driver.

    Then some drivers seem to need parameters to enable WOL, like “3c59x enable_wol=1”…

    Beside this there seem to be other things that could prevent Wake-on-LAN from happening. Some articles talk about /proc/acpi/wakeup but we don’t seem to have this enabled in our kernel. So if ethtool doesn’t help we might give you instructions on how to build your own kernel and get /proc/acpi/wakeup to play with this.