.xsession-errors file is huge. How can I disable? [duplicate]

Solution 1:

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

ERRFILE=$HOME/.xsession-errors

# 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" \
             "\"$TMPDIR/xsession-$USER\"."
  fi
else
  errormsg "unable to create X session log/error file; aborting."
fi

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

Solution 2:

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

Solution 3:

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.

Solution 4:

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.

Power