Windows wakes up soon after going to sleep

I think there are two main reasons why Windows would wake up “by itself” (without pressing a key on the keyboard or clicking the mouse).

  1. Scheduled tasks;
  2. Devices allowed to wake up the computer.

Scheduled tasks are fairly simple to look into and it was not the problem at the time of writing this post, so I’ll skip straight to the second point.

We can get a list of devices that are allowed to wake up the computer from sleep by typing at the command prompt:

powercfg -devicequery wake_armed

At the time, I had 3 allowed devices:

  • Intel(R) 82579V Gigabit Network Connection
  • HID-compliant mouse
  • Microsoft USB Natural Ergonomic Keyboard 4000 (Mouse and Keyboard Center) (001)

I don’t need WOL or anything like that so I disallowed the network card to wake up the computer using Device manager:


And voilà, my computer now stays asleep until I use the mouse or keyboard. I started having this problem after moving the computer to another network, so I suspect the new router or other network connected computers sent packets that waked it up.

fail2ban on freebsd with pf

% sudo pkg install py27-fail2ban

% sudo vim /usr/local/etc/fail2ban/jail.local

enabled = true
filter = sshd
action = pf
logpath = /var/log/auth.log

% sudo vim /usr/local/etc/fail2ban/action.d/pf.conf

actionstart =
actionstop =
actioncheck =
actionban = /sbin/pfctl -t <tablename> -T add /32
actionunban = /sbin/pfctl -t <tablename> -T delete /32

tablename = fail2ban

% sudo vim /etc/pf.conf

table <fail2ban> persist
block in on $ext_if from <fail2ban>

% sudo vim /etc/rc.conf


% sudo service pf reload
% sudo service fail2ban restart

% sudo pfctl -t fail2ban -T show

MySQL: Reset root and debian-sys-maint passwords

vim /home/me/mysql-init
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpassword');
SET PASSWORD FOR 'debian-sys-maint'@'localhost' = PASSWORD('newpassword');

kill `cat /var/run/mysqld/`

mysqld_safe –init-file=/home/me/mysql-init &

vim /etc/mysql/debian.cnf

service mysql restart

rm /home/me/mysql-init

ZFS on Debian 7 Wheezy

Wheezy 7 Install (with proxmox kernel)

# wget
# dpkg -i zfsonlinux_1~wheezy_all.deb
# aptitude update
# aptitude install pve-headers-2.6.32-22-pve
# aptitude install debian-zfs

Jessie 8 Install

# wget
# dpkg -i zfsonlinux_6_all.deb
# aptitude update
# aptitude zfs-dkms


# aptitude update
# aptitude install pve-headers-2.6.32-23-pve
# aptitude reinstall spl-dkms zfs-dkms

Note: pve headers shown in example, adapt to kernel type and version.