If the desktop in question is xfce, check the following thread:
https://forum.xfce.org/viewtopic.php?id=6580
For me post 17 - delete the session file in
$HOME/.cache/sessions/xfce4-session-*
did the trick. The session file gets sometimes corrupted -
once I was not able to login to XFCE - deleting the session file
also solved that problem...
Note: Don't delete the session file. Just rename or move it. So in case the
problem persists after XFCE created a new pristine session file you can go back
to your old one.
UPDATE 2020:
More than 10 years after this problem was first reported, it persists in 18.04.
Sessions are now files with pattern xfwm4-*.state
, and stored in ~/.cache/sessions
. Renaming these session files does not fix the immediate problem, though they are quite nice to look at.
In absence of a fix, force a shutdown (perhaps once you have manually closed all programs):
sudo shutdown -h now
It is possible however, that renaming the sessions files prevents the problem from recurring again. It has not recurred for me, for now, immediately after a forced shutdown, perhaps because I renamed all ~/.cache/sessions/xfwm4*.state
files first.
An antique request for help in the XFCE forums suggests switching on the facility to save sessions, which can be done in settings > sessions & startup
.