Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This question already has an answer here:

I have visited over 30 different forum questions about this very same issue but none of them have been able to point me in the right direction.

I don't care what is causing the issue. I don't care what the error messages say.

I want to completely disable this from happening.

I don't want to disable all logging on my system just this .xsession-errors file.

I have tried the /dev/null thing it doesn't work. I made it read-only, just creates a new file .xsession-errors.jkhbjhjh. I even commented out the file generation in /etc/X11/xsession.

I'm running an ecommerce webserver that will be decommissioned in less than 90 days. I just need to keep the sites up long enough to get them all moved over to my new system. This log file is filling up my HDD 2 to 3 times a week rendering my webstores inoperable.

Just to be clear, I'd like to know how to disable .xsession-errors logging. I'm running Ubuntu 9.10 with gnome. I know it's no longer supported but again, this server is being decommissioned in less than 90 days it shouldn't matter.

share|improve this question

marked as duplicate by Kevin Bowen, Warren Hill, Eric Carvalho, Tom Brossman, Alaa Ali Sep 23 '13 at 18:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

6 Answers 6

It seems that the issue is still relevant despite it's age. I just got the same trouble on my notebook with SSD. i need to move it to TMPFS, i got /tmp mounted in. all advices about moving files, truncating it, chowning/chattring doesn't work for my xubuntu 13.04. it seems that the filepath is hardcoded into xfce binaries. i grepped all the filesystem. there are no occurencies of that file except /etc/X11/Xsession , and changing ERRFILE there leads to nothing.

By the way any actions with these files in /etc/rc.local doesn't make any sesnse because rc.local triggers besore Xsession starts.

So i created a file in my homedir called .xfce-customizations and added following lines in there:

ln -sf $(mktemp) /home/remort/.xsession-errors
ln -sf $(mktemp) /home/remort/.xsession-errors.old

After that i added this file to autostart with my xsession in 'Settings Manager' -> 'Session and Startup - Application Autostart'. After reboot and loggin into my xfce both of the files were symlinked to the tempfiles. So you still have your logs able to analyze during uptime, so it's quite clean solution.

share|improve this answer

I have met the same situation like you and tried those suggested solutions on the net and seems all failed.

Finally, I have commented out the line "ERRFILE=$HOME/.xsession-errors" inside the file /etc/X11/Xsession of my Ubuntu.

Then the .xsession-errors file does not appear again.

From my testing, this error log file is for the service vino-server which you can find in your process list (ps -ef|grep vino). It is a VNC server process. I wonder there are some programs in the net keep trying to login our server by a VNC client so to produce a lot of error message in this log file.


share|improve this answer

The workaround for this is rather dependent on the desktop manager that you are using. Changing the /etc/X11/Xsession file works fine in some cases, but if you are using gnome, for instance, you should add the following lines to ~/.gnomerc:

rm -r ${HOME}/.xsession-errors
ln -s /dev/null ${HOME}/.xsession-errors

Hopefully that subtlety will help someone.

share|improve this answer

There is a file called /etc/X11/Xsession. Which will create the symlink to a tmp file. IE. Starts on line number 61


# attempt to create an error file; abort if we cannot
if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
  [ ! -L "$ERRFILE" ]; then
  chmod 600 "$ERRFILE"
elif ERRFILE=$(tempfile 2> /dev/null); then
  if ! ln -sf "$ERRFILE" "${TMPDIR:=/tmp}/xsession-$USER"; then
    message "warning: unable to symlink \"$TMPDIR/xsession-$USER\" to" \
             "\"$ERRFILE\"; look for session log/errors in" \
  errormsg "unable to create X session log/error file; aborting."

You can cp this Xsession file to Xsession.bak. Then go a head and point your ERRFILE to /dev/null IE. Line 83

exec >> /dev/null 2>&1
share|improve this answer

just do

rm /wherever/you/have/.xsession-errors
ln -s /dev/null /wherever/you/have/.xsession-errors

and restart the computer (this, you do to close all programs that were using .xsession-errors)

All access to .xsession-errors will be redirected to /dev/null, a "file" meant to receive text and just throw it away

share|improve this answer
I see now that you said that /dev/null did not work. Did you reset the server (or close the programs writing to .xsession ?). Without doing either, the programs will just ignore you and keep writing to the file they knew –  josinalvo Aug 17 '12 at 14:40

If you've tried this solution but found it to be unsatisfactory, then I would simply write a cron entry that deletes the file every hour.

crontab -e

Add the following entry:

@hourly rm -rf /path/to/xsession/files/.xsession-errors*

Quick and dirty, but functional!

If you want it to be even faster, just change @hourly to */2 * * * *.
This will delete the files every two minutes.

share|improve this answer
do test that. but you may find it not working, for the same reason that I mentioned in my proposed solution: After you delete a file, if there was a program using it, it'll just keep writing to it. It wont be acessible to new programs, but it'll still be there until the program closes –  josinalvo Aug 17 '12 at 16:27
Disappointing that this is still the top answer for this question (not as disappointing as the fact that the bug persists) since it indeed doesn't work: the file keeps getting written and eats all your disk space until you restart. –  bnaul Mar 14 '13 at 20:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.