Suspend issue with my Linux box

A few weeks ago, i completely moved to using systemd on my machine (it runs Arch). And since then i was facing a really weird issue when i closed my laptop lid. My laptop, with Gnome3, suspends itself when i close. And when i open my laptop lid, i was prompted with the familiar gnome-screensaver password dialog, as expected. But right after i could see the password dialog, the system went back to suspend state again. Looking through the system logs, i saw that the suspend was being called twice in succession. And i didn’t have the problem, if I ran pm-suspend from the command-line. It was clear that suspend was being done twice, but i wasn’t sure what was actually triggering it.

After a quick web search and not finding anything useful, i started digging into systemd’s man pages and found the logind.conf(5) man page.  Voila, there it was:

HandlePowerKey=HandleSuspendKey=HandleHibernateKey=HandleLidSwitch=

Controls whether logind shall handle the system power and sleep keys and the lid switch to trigger actions such as system power-off or suspend. Can be one ofignorepoweroffreboothaltkexec and hibernate. If ignore logind will never handle these keys. Otherwise the specified action will be taken in the respective event. Only input devices with the power-switch udev tag will be watched for key/lid switch events. HandlePowerKey= defaults to poweroffHandleSuspendKey= andHandleLidSwitch= default to suspendHandleHibernateKey= defaults to hibernate.

The Arch Wiki has a good explanation of the settings in the power management section of the systemd wiki page.

I realised that gnome does its own power management and with systemd running, it does its job of suspended as well. So i had this happening twice. My first instinct was to disable suspend settings in Gnome, but that didn’t seem possible, even with the gnome-tweak-tool installed. So I just put the following lines in my /etc/systemd/logind.conf:

HandlePowerKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore

This essentially will make sure that systemd doesn’t handle the system lid and suspend functions.

This is the first issue that i encountered after i moved to using systemd. (A non-issue actually). I am very happy with how systemd works. I should admit i was quite skeptical before i started using it, but now I’m very used to the whole idea. And whats more, i do notice the faster boot and shutdown times. I haven’t actually measured it, but I’m quite sure that if i did, i would notice a difference. But, thats for later!

NetworkManager with alternate desktops

I use Xmonad. Its simple, its light-weight, and it just works most of the time, i haven't seen it broken between updates. Essentially, the usual set of reasons why we all stick to some piece of software that works. And I've realised lately, that i've been using less of the Gnome Software Stack. For instance, I gave up on using Evolution for gnus,  gnome-terminal for urxvt and so on.

But there is one thing that i love to use from the Gnome stack though, and it is Network Manager. Network Manager has improved so much, and the current version works well and is quite reliable. The downside to using Network Manager though is that it is tightly integrated with the Gnome Stack(viz. ConsoleKit, PolicyKit et.al), understandably so.

So with SLIM as my login manager and Xmonad as the window manager, there are some problems that i enounter from time to time. The latest one being not able to connect to any new wireless networks (debian/testing). Looking at /var/log/messages, i found:

         ** (nm-applet:1715): WARNING **: Failed to add/activate connection: (32) Insufficient privileges.

I figured that it must be a consolekit/policykit problem. I remember from when i was making the move to Xmonad, that i had to launch using 'ck-launch-session', so i modified the login_cmd entry  /etc/slim.conf to:

         login_cmd           exec ck-launch-session /bin/bash -login /etc/X11/Xsession %session

And in  ~/.xsession file i run:

       /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1&

And after i logged out and logged back in, Network Manager is back in action again.

Alternatively, one could create a file /etc/polkit-1/localauthority/50-local.d/org.freedesktop.NetworkManager.pkla containing:
     [nm-applet]
     Identity=unix-group:netdev
     Action=org.freedesktop.NetworkManager.*
     ResultAny=yes
     ResultInactive=no
     ResultActive=yes

And make sure that the user you intend to provide access to is in the netdev group. The above file gives permission to everybody in the netdev group. Personally, I prefer the former, since I think it is the "right way"[TM] to achieve what i want to. But again, this is Linux, and there is no one way to do anything. So feel free to chose what you prefer doing.

GIP

The highlight of the FOSS community has always been availability of wonderful pieces of software that one gets used to so much that cannot do without them. Everybody has their favourite set of tools that has become a part of their regular computer usage.
Emacs, Pidgin, Firefox….. the list goes on.

Another software tool that i can’t usually do away with of-late is GIP. GIP is an IP address calculator for GNOME. It provides a simple interface for calculating IP address range, Masks, Subnets and the whole lot.

[ Screenshot of the GIP main tab – Click to enlarge image ]

For a given IP NetMask and Prefix – GIP, among other things, gives you the following information:
* Address range to which the IP belongs to
* Maximum number of subnets
* BroadCast Address
* Hex and Binary Representation of the IP/Mask

GIP also has a subnet calculator.

The project i work on requires me to create and manage large multiple networks. And this tool has saved my day on many occassions. And if you are not such a thing, am sure it will still be helpful.

GIP is available in most distros or can be installed from the distro package repository. On Ubuntu the package is called ‘gip’. More about GIP here.

FOSS, is good.

GNOME + KDE

It is now public, the next GNOME and KDE annual developer/user conferences to be held in 2009 would be co-located.

I just happened to read this post on the gnome-foundation-list. An excerpt from the post:

“The conferences will be separate events, but co-located and hosted by the same organizers, the Cabildo of Gran Canaria and its Secretary of Tourism, Technological Innovation and Foreign Trade.”

This is a nice move, specially considering there is a strong inclination towards applications and technologies co-existing and somewhere in the distant future even sharing applications. There are good things in KDE that i want to have in GNOME.
And the bottom line being – the world will be a peaceful place, with one less issue to argue about.