Which shutdown command is uesd by the freeNas Webninterface

Status
Not open for further replies.

Chrisu

Cadet
Joined
Jan 21, 2014
Messages
6
Hi all,

I just upgraded my FreeNAS Box to version 9.2.0.
After upgrading I wanted to optimize the operating of the Box a little bit. Therefore I also wanted to add a shutdown-job. What I did was adding a cronjob with the command "shutdown -p now" - which works great.
But after the Box has been shutdown with this command, I can't wake it up with WakeOnLan anymore.
If I shut down the Box with the Shutdown-Buttom from the Webinterface of FreeNAS WOL still works.
So I'd like to change the shutdown command of my cronjob to the same command the Shutdown Button uses.
But which command is beeing used by this button?
I started grabbing arround in the /usr/local/www/freenasUI folder, but couldn't find the command which is beeing used.
Could somebody tell me which command sits behind this "magical Shutdown Button"?
Any maybe whats the difference to the shutdown-command?
Thank you

Regards,
Chrisu
 

warri

Guru
Joined
Jun 6, 2011
Messages
1,193
After a quick look through the source code, I think the the shutdown function of the GUI ends up running shutdown_run, which then uses the notifier to shut down the system with
Code:
/sbin/shutdown -p now


But in the Wake on Lan thread, somebody said that the system only wakes up from S4 when using wake on lan, mabye that is the case with your system as well?
 

Yatti420

Wizard
Joined
Aug 12, 2012
Messages
1,437
Running shutdown -p now will start a shutdown immediately.. It works from cron ssh etc.. Run as root and should be fine.. A user with sudo permission may work I've never tried it..

Has WOL ever done cold boots? You want hibernation/sleep for WOL?
 

N00b

Explorer
Joined
May 31, 2013
Messages
83
Running shutdown -p now will start a shutdown immediately.. It works from cron ssh etc.. Run as root and should be fine.. A user with sudo permission may work I've never tried it..
Has WOL ever done cold boots? You want hibernation/sleep for WOL?

sudo shutdown -p now works. I use it regularly. I am able to WOL my box afterwards as well.
 

Chrisu

Cadet
Joined
Jan 21, 2014
Messages
6
@warri: Thank you for digging out the used command.
My hope was it differs from my allready used command.
To clearify: The shutdown command itself isn't the problem, this works for me. Problem is the WOL call after the shutdown.

If I do the shutdown by the menu-entry Shutdown from the webinterface, I can WOL after the shutdown. If I type the command
Code:
shutdown -p now
in cronjob or manual from console, the shutdown also works, but I can't wake the Box with WOL after it.

So there must be a difference between the command run through the webinterface and run from console/cronjob.

Edit: I have to revert my above statement. Looks like WOL after shutdown by webinterface doesn't work anymore. I'd assume it doesn't work anymore after I used the shutdown-command in the cronjob.
Before the cronjob run the first time, WOL worked for me ...
I'm confuesd :(
 

N00b

Explorer
Joined
May 31, 2013
Messages
83
1) Check BIOS settings for WOL
2) Check the command that you are using to send the magic packet to the box. On iOS you could try an app called "Fing".

I have experienced this - Reset WOL in bios. Start box manually. Shutdown and then try WOL.
 

Chrisu

Cadet
Joined
Jan 21, 2014
Messages
6
I double checked BIOS settings - no changes have been made here.
The wake-up command also hasn't changed, as it is some kind of "hard-coded" command inside a app.

I did some more testing, and found out the following:
- If I shutdown with shutdown -p now (unless if from webinterface, cli or cronjob) WOL doesn't work, afert the Box shut down.
- After Shutdown I still can see the network-interface receiving some traffic (LED blinking)
- If I start the maschine, and push the power button while the initial memory check (so no FreeNAS has been loaded) and the box powers off - WOL works!

Does this give any hints how to solve the issue?
 

Michael Wulff Nielsen

Contributor
Joined
Oct 3, 2013
Messages
182
I'll just second chrisu's comment. My box behaves the same way and I would love to find a solution.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
I'll say this because Wake-On-LAN comes up from time to time. The "pros" around here don't play with WOL and we don't recommend people use it(because it seems to be better for hard drive life to let them run 24x7). Since no "pros" use it, there's little to no feedback on the topic. Surely if you search the forums you'll see every Wake-On-LAN topic always ends in silence and unresolved issues. Those "in the know" don't care and those that develop FreeNAS don't care about the WOL feature at all.

To be honest, the only way I expect WOL will ever make it into FreeNAS will be someone actually does care and has the "know-how" to implement it. Until then, I expect it to be a hardly-used and hardly-cared-about FreeNAS issue.
 

Michael Wulff Nielsen

Contributor
Joined
Oct 3, 2013
Messages
182
In my personal case I would like to shutdown the NAS for extended periods of time since I don't need it. The problem for me is that electricity is ridiculously expensive where I live (about $600+ to run a FreeNAS server per year).

So since I don't need it online the whole time the obvious solution is to shut it down and wake it up only when I need it. So for me a working WOL solution would be great. But it seems that my Intel network card (cxgbe driver) does not support that capability under FreeBSD, which is kind of sad since Intel nics are advertised as great nics for FreeNas/FreeBSD.

I have dug through the driver c code and there seems to be some support for wol, but I haven't figured out why it's disabled on my system. I'll pop over to the FreeBSD forums and ask around there.

But for the use case where you only use your nas twice a week to do backups it makes sense to shut it down in between, especially if you live in a country where power is not cheap.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
My first guess is FreeNAS doesn't properly implement WOL. I have yet to see someone provide a hardware config that does wake up from WOL. As I have said in a few other WOL related threads, IPMI completely circumvents this problems since you can poweron and poweroff from IPMI. So if you've bought some server grade board you likely have IPMI, which means the whole WOL argument is pointless. ;)

I can't remember the last time I pressed the power button on my server. But every time I've powered it on it's been via IPMI.
 

Michael Wulff Nielsen

Contributor
Joined
Oct 3, 2013
Messages
182
Ipmi is a good point, but since the SuperMicro boards are generally not available where I live I had to go with an Asus board P9D-M, and afaik it doesn't support Ipmi.

Update. Seems that my board does support ipmi, gonna check that out but I fear that the wife-acceptance-factor is low on having to use management software.
 

Dusan

Guru
Joined
Jan 29, 2013
Messages
1,165
But for the use case where you only use your nas twice a week to do backups it makes sense to shut it down in between, especially if you live in a country where power is not cheap.
Make sure that the important background tasks have a chance to run & finish -- namely SMART tests and ZFS scrubs. For example, the default ZFS scrubs are scheduled to start at Sunday midnight. If the box is never powered on at that time, the scrub will never start. And even when a scrub somehow starts it will take several/many hours to finish -- if your backup windows are short a single scrub run may take several months in your case. It's basically the same with long SMART tests.
So, if you want to shutdown your NAS you need to adjust the SMART/scrub schedule (or start the tasks manually) and monitor the progress so that the box stays powered until they finish.
 

Michael Wulff Nielsen

Contributor
Joined
Oct 3, 2013
Messages
182
@Dusan Certainly, there is a bit more work for me there to ensure that the periodical tasks are run. But thanks for reminding me.
 

Chrisu

Cadet
Joined
Jan 21, 2014
Messages
6
What really confused me is the fact WOL worked some time ago. And you also can't say it won't work in general - think of the interrupted POST-Intreruption after that WoL works ...
I'll do a test over this weekend, and install a default FreeNAS v 9.2 on my box and try if it works ehre.
As I allready mentioned I believe this problem appeared firstly after I used the shutdown command manually.
 

Michael Wulff Nielsen

Contributor
Joined
Oct 3, 2013
Messages
182
If I interrupt POST my board works as well, but the integrated nics and a pci-e intel 1000-pt nic had no success :(
 

Chrisu

Cadet
Joined
Jan 21, 2014
Messages
6
I made some test with a "virgin" FreeNAS 9.2 installation, but had no success with WOL.
So it muste be version 8.3 which allowed me to wake my box up by magic packet ...
By the way: I'm using a HP Microserver N40L with additional intel NIC.

Maybe we had some changes from version 8 to version 9 which causes the issue?
Having some hints regarding the changes who have been made will be endless, right?
 
Status
Not open for further replies.
Top