Suspending a PC

I’ve already written about my tries to use laptop policies on my desktop to be able to preserve my UPS’s battery runtime. Today’s focus instead is on Intel’s PowerTOP initiative, which is quite intriguing. I also remembered that Nokia decided to make more prominent the signal of charge completion on their new phones, so that users remember immediately to remove the adapter from the line.

Looking at this, I started wondering even more about my usual patterns when it comes to power consumption. I’ve started lately to shut down the multiple power cord I have where the amplifier and a few adapters are connected, when I go to sleep, but this has at least one problem (I can’t recharge the mouse this way), and still wastes the power consumed by the adapters when it’s day (and thus the amplifier has to be running), and I’m not using them. Attaching and detaching them every time is not really an option, as it’s quite difficult to get down to them, so for now this is a decent mediation between power saving and easiness of using the chargers.

To solve this I was already thinking, and now I’ve decided and just need to enact as soon as I get to make some shopping, to buy a new multi-plug, possibly with per-socket switches, so that I can avoid attaching/detaching the connectors, but still be able to disable what I don’t use, then I’ll attach it to the side of the table, so I can reach it easily without going under the table. This way I can just connect what I need and then remove it when I’m done.

Then there are the ATX power supplies, which still uses 5V for the wake up check; I shut off Prakesh every time with the switch, but that is because the ACPI on that box sucks and it doesn’t power off at all when I ask it to, but I don’t shut down Klothos because it’s difficult to do so.

But of course the main problem is Enterprise: being my workstation, I usually have it turned on most of the time; sometimes it’s building, sometimes it’s simply playing back a movie for me, but there are times when it’s totally idling, and in those cases, I should really shut it off. The problem is that often I have the four virtual desktops full of windows, browsing source code and Konsole sessions full of output I’m working with. Even with KDE’s session support, it’s not easy to return to such a point when restarting, the main problem being that the window gets misplaced, more windows are opened, and opening 10 different Konsole sessions ends up timing up the SSH/GPG agents, which then requires me to close and then reopen all of them, and I lose the output; Emacs also doesn’t seem to support save and restore of the session this way.

So I decided to look at ACPI sleep states: suspending to ram might allow me to just shut everything down, then restart the day after with the desktop exactly as it were. It’s like when I close the MacBook Pro when I’m on OSX, and that is nice.

So I look up what I need: kernel didn’t have ACPI sleep states enabled, so I enabled them, rebuilt the kernel and rebooted. Merged hibernate-script, and run hibernate-ram. The first try failed after 20 seconds, lirc_dev module disallows going to sleep. Bummer, especially since I don’t want to touch, or to contact the upstream of, lirc anytime soon (remember in the early 2.6 days when you had a kernel patch to get LIRC to work, rather than using drivers directly from LIRC? That patch was mine, unfortunately). No problem, remove lirc_dev for now and try again. It slept, and then it frozen after a few seconds from wake up. Maybe it’s lirc remaining half loaded, so I decided to remove it from the kernel directory and reboot. Nothing still freezes afterward.

Now I’m not sure exactly what it might be, and it’s too late to experiment, it might have been DynamicClocks I did just enable in X11 (after all I never use 3D, if there was a decent graphic card with only a good Xv driver, and nice Xinerama support, I’d be all for it), tomorrow I’ll check. Hopefully it will work, then I’ll just shut down Enterprise all the nights when I go to sleep, and wake it up in the morning (or in the afternoon) just when I need it.

I also started wondering about the kind of processes that are running in the background on my box even if I’m not using them: just in KDE there is KTeaTime, that I use when I need to remember to do something in X minutes, KBluetoothd (I use BT only to transfer data to the cellphone, and it’s rare), KOrganizer (okay this one I need more often), and a bunch of other stuff. Leaving them there ends up sucking CPU and power, thus causing more heat. In the background I have lighttpd, distccd and again a bunch of other stuff that I usually don’t use. I should actually start by stopping everything I don’t need and start it only when needed (if I’m not building on Prakesh or Farragut, I don’t need distccd; if I’m not printing I don’t need cups – and the Printer is now shared by the AirPort Express, so I don’t need it to share anymore).

I suppose that it would be nice to have something that actually starts a service only when it’s requested; inetd is probably the nearest thing you get for this, but I wouldn’t be surprised if it used low performance methods for waiting for connections (epoll should be better than poll on this regard, if I remember correctly; on FreeBSD instead there’s kqueue). I could also write a simple tool for starting/stopping services as I need them, without having to use a console to start mysql when I’m working on job stuff that requires it.

I’m also considering connecting the bluetooth dongle on the fly when I need to do a phone transfer; the problem here would be to have programs starting up when needed too (like kbluetoothd). It would certainly be nice.

So this long blog post might be just a start for a comments’ spree: what can software do to make sure we don’t run code that is not needed to be running? Smarter startups? Better bookmarks? Ideas?

5 thoughts on “Suspending a PC

  1. Ubuntu tries to solve some of this “start a service when it’s needed – stop it when it’s idle” problems with upstart, their new init approach, but I don’t know how successful they were/are doing this.If you’re looking for a decent graphics card with great suspend support – I’ve heard that Intel will release soon PCI/AGP cards.The often used Intel on-board cards work really great when suspending them and are powerful enough for running decent 3d applications like tuxracer, quake3, beryl etc.I hope this weren’t only rumours about releasing this cards for PCI/AGP slots.My notebook (HP/Compaq nx9420) has an ATI x1600 card – I gave up making suspend work, it just won’t.


  2. Yeah suspending the new ATI cards with frglx seems impossible, I’ve seen that on the Mac.If Intel is really going to release Add-On cards, I’ll gladly buy one of those for sure!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s