XFCE Window Manager Recovery

The XFCE window manager, at least in its Xubuntu incarnation, seems surprisingly fragile. Every now and again, it won’t start up: all the auto-starting application windows pile atop each other on a single workspace, with no title bar or window decorations, with no way to move them around or change focus. In some cases, the mouse will be active and the keyboard will be dead. This is Not Good.

Rebooting that sucker isn’t productive, as the failure seems to occur most often after a normal system update that, inexplicably, clobbers the window manager’s state information. After that, the window manager will wake up dead every time.

The usual recovery technique involves activating a terminal window and entering xfwm4 --replace to forcibly restart the XFCE window manager, clear the state, and ensure it’s the default. That is remarkably difficult with a nonfunctional keyboard and can’t be accomplished remotely without access to the jammed user’s X session.

What has worked is to SSH in from another PC and delete the XFCE caches for the affected user:

cd ~/.cache
rm -rf xfce4
rm -rf sessions

You can blow away the entire .cache subdirectory if you prefer.

That this should not be necessary goes without saying. Remember that XFCE is currently the least-awful Linux Desktop Environment; all the rest have even greater complexity and much larger problems.