Ubuntu Server Suspend/Wake-On-LAN

Hi,

It was something of a shock to me to find that Ubuntu server powers down after a period of inactivity which makes no sense to me at all for a server however, in the process of looking for solutions to that, I came across the idea of Wake-On-LAN (WOL).

So, I’ve been trying to find a way to EITHER keep my new server always on or configure it for WOL and found a page that took me through it… only it didn’t work. Following that page, I…

  • Checked my card was configurable for WoL (using ethtool).
  • Configured the card for WoL (again using ethtool).
  • Created a WoL service.
  • Restarted, enabled and tested the service (apt search wakeonlan).
  • Installed wakeonlan

I then allow the server to suspend and try connecting to it with MobaXTerm (which I assume should wake it) but it stays suspended.

Any idea how to either make WoL work (preferred) or simply stop the server suspending… a server that makes itself unavailable is pretty useless IMO.

James

p.s. Can you tell I’m a relative beginner with all these questions?

2 Likes

hm, that’s strange. That’s not the default behavior of Ubuntu server.

Share the outout of this command:

systemctl list-unit-files | grep suspend

If you see sleep.target or suspend.target enabled, disable them with:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

If your goal is for it to just stay awake all the time (which is what most people do for servers), masking those sleep targets is probably the simplest fix.

I got the exact same but…

… I ran that anyway and then, just to be sure, I ran systemctl list-unit-files | grep suspend again and this time the last line (suspend.target) was enabled… I thought that line was meant to disable them all.

Yes, that was what I was originally aiming for but then I saw the WoL idea and figured I’d try it :slight_smile:

EDIT: That said, it appears to have fixed the problem… just testing now to see if it’ll survive a reboot.

EDIT #2: And it does. Thanks :slight_smile:

James

1 Like