# ACPI Wakeup using RTC



## KingDaveRa (Jan 9, 2011)

Hi,

I have a NAS box using an Intel D945GCLF2 motherboard in it with a gigabyte of RAM. Currently it's running on OpenSuSE 11.3. It also has a SIL 3124 fake-RAID card in it using the non-RAID BIOS, so its all running on mdraid; there's three 650 GB SATA disks in there in Linux software RAID5.

However, the Linux software RAID is somewhat lacking. It's fine on big files, but as soon as I start pushing lots of little files to it (i.e. in my backups) it slows down a lot - the dreaded RAID5 write hole kicks in. I've had people tell me lots of nice things about ZFS. So I'm keen to rebuild the box with FreeBSD, and use ZFS. The ZFS bit looks like a breeze to get going - I had a quick play in a VMWare VM and it worked very nicely.

Presently, there's a script on it that sends a unix time stamp to /sys/class/rtc/rtc0/wakealarm on a schedule. A cron job runs to set the wakeup time, then shuts it down. At the appointed time, it comes back on automatically. I have various jobs it runs, and other PCs on my network run (backups and the like) which mean I don't want it on 24/7, but I do want it waking up at set times. 

However, I'm a bit worried about my script working on FreeBSD. I've been Googling around, and looking on the forums, and I can't find reference to the same functionality. In fact, I found the FreeBSD ACPI project, which says it's not done. 

Can anybody confirm this is the case, and if so, is there a possible workaround for this, so I can keep my wakeup schedule on the box? I'm assuming that without the OS exposing the ACPI interface, there's probably not much that can be done though.

Any help most gratefully received!


----------



## KingDaveRa (Feb 10, 2011)

I've recently installed FreeBSD 8.1. on my NAS, to see what works, and what doesn't. It's somewhat of an unmitigated failure I'm afraid. The ZFS works like a charm, however, the ACPI support is dire. The box will go into S3 sleep, but won't wake up, and on shut down it won't power off - I have to press the power button. To be fair, FreeBSD is aimed more at servers, which don't generally get turned off often!

Shame really, but hey ho!


----------



## thewilli (Feb 23, 2014)

Any news about this topic?

I want to wake up my NAS (which runs FreeBSD 9 x64) using an RTC timer. This is supported by the hardware but no manual wakeup option exists.


----------



## wblock@ (Feb 23, 2014)

If your NAS is not running FreeBSD but one of the packaged NAS systems based on it, contact the people responsible for the package first.

If it's plain FreeBSD, and the BIOS does not wake it at a set time correctly, use another system to send wake-on-LAN (WOL) packets to wake up the NAS at the desired time.  See wake(8).


----------



## thewilli (Feb 23, 2014)

wblock@ said:
			
		

> If it's plain FreeBSD, and the BIOS does not wake it at a set time correctly, use another system to send wake-on-LAN (WOL) packets to wake up the NAS at the desired time.  See wake(8).



It is plain FreeBSD.

There is no option to set a wakeup time in the BIOS menu, but (according to few positive reports in related forms) rtcwake does work for them.

Unfortunately there is not other device which could wake the NAS. Isn't there any way to reproduce the internal behavior of rtcwake on FreeBSD?


----------



## wblock@ (Feb 23, 2014)

Set the BIOS to power on after a power failure and put the computer on an AC timer.  Make sure it shuts down well before the timer turns it off...

There are other things that could be done, wiring a timer to the soft power button.  Or reconsider suspending the system.  Maybe just spin down the disks.

rtcwake involves ACPI sleep, which does not work well with FreeBSD on many systems.  Or rather, sleep works fine, it's the resume that fails.


----------



## thewilli (Feb 24, 2014)

wblock@ said:
			
		

> Set the BIOS to power on after a power failure and put the computer on an AC timer.  Make sure it shuts down well before the timer turns it off...



That's a good idea, but my problem is that the shutdown cannot be controlled then.

Maybe I should explain what I want to achieve:

My NAS is a HP MicroServer N40L which runs FreeBSD 9. The hardware lacks support of S3 and consumes a lot of energy. It would be great if it wakes up in the morning and checks if I am at the home office that day (my smartphone is connected to my WiFi network). If I'm not it should go to sleep (shut down respectively as sleep isn't supported).
In addition to that it should wake up twice a week at night to do some time-consuming stuff like backups to the AWS cloud and scanning for viruses which shouldn't be done when I'm working with it. 

I am a quite experienced C/C++ developer, but haven't any experience with neither Linux nor FreeBSD kernel development yet. Neither do I have any experiences with ACPI. Do you think porting that single functionality from Linux to FreeBSD for my hardware is something realistic anyway?

According to the FreeBSD ACPI project the last changes were made in 2006. Do you know if there will be any progress in the future or if this project is discontinued?


----------



## wblock@ (Feb 24, 2014)

I suggest contacting the freebsd-acpi mailing list.  It's not very active, but people there might be able to suggest alternatives.


----------



## thewilli (Feb 24, 2014)

I'll give that a try, thank you


----------

