[SOLVED] Disable .xsession-errors logging in LMDE 3

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
Dr. Octagon
Level 2
Level 2
Posts: 79
Joined: Mon Sep 16, 2013 4:43 pm
Location: Osnabrooklyn

[SOLVED] Disable .xsession-errors logging in LMDE 3

Post by Dr. Octagon » Sat Dec 01, 2018 9:19 am

Hello,

in the HOME directory there is a .xsession-error file. I don't need it - and therefore it is not usefull if you use a SSD and logging generates written data all the time (some programs -like GIMP- put sometimes a huge amount of data in it).
All log files in my system are stored only in RAM by fstab config - but this file prevents a startup if I put it in RAM.

In LMDE 1 and 2 I found ways to link it to dev/null or disable the logging... but in LMDE 3 I am not able to do so.

Can someone tell a hint for LMDE 3?

Cu
Dr. Octagon
Last edited by Dr. Octagon on Sun Dec 02, 2018 9:17 am, edited 2 times in total.
A good stumbler doesn't fall...

User avatar
smurphos
Level 12
Level 12
Posts: 4113
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Disable .xsession-errors logging in LMDE 3

Post by smurphos » Sat Dec 01, 2018 9:35 am

Untested but amending the line ERRFILE=$HOME/.xsession-errors in /etc/X11/Xsession should do it.

I.e change it to another location or make it ERRFILE=/dev/null

It does have useful troubleshooting info - I refer to it a lot. It's needed if you ever intend to raise a Cinnamon bug-report.
Last edited by smurphos on Sat Dec 01, 2018 10:53 am, edited 1 time in total.
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

Dr. Octagon
Level 2
Level 2
Posts: 79
Joined: Mon Sep 16, 2013 4:43 pm
Location: Osnabrooklyn

Re: Disable .xsession-errors logging in LMDE 3

Post by Dr. Octagon » Sat Dec 01, 2018 10:20 am

Ok,

but under Cinnamon there is only /etc/x11/xsession.d - does it mean I have to create /etc/x11/xsession without .d to put in?

Btw.
I didn't get any errors in the past which make xsession-errors logging usefull... and if some come up in the future I will know how to get the logging back. ;)


Cu
Dr. Octagon
A good stumbler doesn't fall...

User avatar
smurphos
Level 12
Level 12
Posts: 4113
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Disable .xsession-errors logging in LMDE 3

Post by smurphos » Sat Dec 01, 2018 10:53 am

Dr. Octagon wrote:
Sat Dec 01, 2018 10:20 am
but under Cinnamon there is only /etc/x11/xsession.d - does it mean I have to create /etc/x11/xsession without .d to put in?
Sorry my bad - the file is Xsession not xsession.

Code: Select all

 ls /etc/X11
app-defaults             rgb.txt  Xreset      Xsession          xsm
default-display-manager  xinit    Xreset.d    Xsession.d        XvMCConfig
fonts                    xkb      Xresources  Xsession.options  Xwrapper.config

Code: Select all

$ cat /etc/X11/Xsession
#!/bin/sh
#
# /etc/X11/Xsession
#
# global Xsession file -- used by display managers and xinit (startx)

# $Id: Xsession 967 2005-12-27 07:20:55Z dnusinow $

set -e

PROGNAME=Xsession

message () {
  # pretty-print messages of arbitrary length; use xmessage if it
  # is available and $DISPLAY is set
  MESSAGE="$PROGNAME: $*"
  echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2
  if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
    echo "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
  fi
}

message_nonl () {
  # pretty-print messages of arbitrary length (no trailing newline); use
  # xmessage if it is available and $DISPLAY is set
  MESSAGE="$PROGNAME: $*"
  echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} >&2;
  if [ -n "$DISPLAY" ] && which xmessage > /dev/null 2>&1; then
    echo -n "$MESSAGE" | fold -s -w ${COLUMNS:-80} | xmessage -center -file -
  fi
}

errormsg () {
  # exit script with error
  message "$*"
  exit 1
}

internal_errormsg () {
  # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message
  # One big call to message() for the sake of xmessage; if we had two then
  # the user would have dismissed the error we want reported before seeing the
  # request to report it.
  errormsg "$*" \
           "Please report the installed version of the \"x11-common\"" \
           "package and the complete text of this error message to" \
           "<debian-x@lists.debian.org>."
}

# initialize variables for use by all session scripts

OPTIONFILE=/etc/X11/Xsession.options

SYSRESOURCES=/etc/X11/Xresources
USRRESOURCES=$HOME/.Xresources

SYSSESSIONDIR=/etc/X11/Xsession.d
USERXSESSION=$HOME/.xsession
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession
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

exec >>"$ERRFILE" 2>&1

echo "$PROGNAME: X session started for $LOGNAME at $(date)"

# sanity check; is our session script directory present?
if [ ! -d "$SYSSESSIONDIR" ]; then
  errormsg "no \"$SYSSESSIONDIR\" directory found; aborting."
fi

# Attempt to create a file of non-zero length in /tmp; a full filesystem can
# cause mysterious X session failures.  We do not use touch, :, or test -w
# because they won't actually create a file with contents.  We also let standard
# error from tempfile and echo go to the error file to aid the user in
# determining what went wrong.
WRITE_TEST=$(tempfile)
if ! echo "*" >>"$WRITE_TEST"; then
  message "warning: unable to write to ${WRITE_TEST%/*}; X session may exit" \
          "with an error"
fi
rm -f "$WRITE_TEST"

# use run-parts to source every file in the session directory; we source
# instead of executing so that the variables and functions defined above
# are available to the scripts, and so that they can pass variables to each
# other
SESSIONFILES=$(run-parts --list $SYSSESSIONDIR)
if [ -n "$SESSIONFILES" ]; then
  set +e
  for SESSIONFILE in $SESSIONFILES; do
    . $SESSIONFILE
  done
  set -e
fi

exit 0

# vim:set ai et sts=2 sw=2 tw=80:
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

Dr. Octagon
Level 2
Level 2
Posts: 79
Joined: Mon Sep 16, 2013 4:43 pm
Location: Osnabrooklyn

Re: Disable .xsession-errors logging in LMDE 3

Post by Dr. Octagon » Sat Dec 01, 2018 12:00 pm

Sorry,

no luck... it's like putting the file in the RAM:

Change file -> Reboot -> Login Screen -> Loging in -> Blank Screen -> Login Screen again... and again. :(

Cu
Dr. Octagon
A good stumbler doesn't fall...

User avatar
smurphos
Level 12
Level 12
Posts: 4113
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Disable .xsession-errors logging in LMDE 3

Post by smurphos » Sat Dec 01, 2018 1:01 pm

OK. Might be because current Cinnamon versions write directly to .xsession-errors rather than to the old glass.log, and expect it to be there. I'll have a look and see if there is a way to change Cinnamon's logging behaviour tomorrow...
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

User avatar
smurphos
Level 12
Level 12
Posts: 4113
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: Disable .xsession-errors logging in LMDE 3

Post by smurphos » Sun Dec 02, 2018 1:54 am

It's nothing to do with Cinnamon. I tried a few things and found that this works. Have tested as far as being able to log in and out repeatedly.

It deletes the .xsession-errors file as part up of the desktop startup and replaces it with a symbolic link to /dev/null.

Create a script in ~/.local/bin or ~/bin with the content below and make executable. If you don't have one of these folders create one.

Code: Select all

#!/bin/sh
if [ ! -h $HOME/.xsession-errors ]; then
 rm $HOME/.xsession-errors
 ln -s /dev/null $HOME/.xsession-errors
fi
In Startup Applications add a custom entry giving the full path to the script just created as the command. No delay required. xsession-errors should be a 0 byte Link to Unknown
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

Dr. Octagon
Level 2
Level 2
Posts: 79
Joined: Mon Sep 16, 2013 4:43 pm
Location: Osnabrooklyn

[Solved] Disable .xsession-errors logging in LMDE 3

Post by Dr. Octagon » Sun Dec 02, 2018 9:14 am

Thank you very much... it seems to work here , too.

Now I've got an arrow on my ~/.xsession-errors file icon and there are such 0 bytes in it all the time.

Hopefully the input will not saved elsewhere now... instead just send to nirvana. :wink:

Cu
Dr. Octagon
A good stumbler doesn't fall...

pioruns
Level 1
Level 1
Posts: 21
Joined: Tue Mar 17, 2015 4:25 pm

Re: [Solved] Disable .xsession-errors logging in LMDE 3

Post by pioruns » Sat Feb 23, 2019 8:47 pm

Dr. Octagon wrote:
Sun Dec 02, 2018 9:14 am
Thank you very much... it seems to work here , too.

Now I've got an arrow on my ~/.xsession-errors file icon and there are such 0 bytes in it all the time.

Hopefully the input will not saved elsewhere now... instead just send to nirvana. :wink:

Cu
Dr. Octagon
I admit to be just offtopic here, but my experience with SSD: Last three years I was thrashing my cheap 240 GB SSD with Windows 7. Every few months, I had to clean and de-clutter hard drive, not much of my own stuff really, but system files. Windows Update cache could swell up to 100 GB of space taken. I had to delete that every time I completely run out of space on my laptop, I could not fit a single movie on the Desktop so I had to clean it up.
Result?

SSD is in perfect condition, just like it was... I bought it used from a friend, used it for 3 years, now I reformatted it and Cindy is installed there. Still working perfect, no problems.

Dr. Octagon, your SSD might just outlive your laptop or desktop hardware. Don't be too obsessed with not letting it write one text file :D :lol:
System: LMDE AMD64
Hardware: HP ProBook 4545s
AMD A8-4500M APU, 8GB RAM
SanDisk SSD PLUS 240GB

Dr. Octagon
Level 2
Level 2
Posts: 79
Joined: Mon Sep 16, 2013 4:43 pm
Location: Osnabrooklyn

Re: [SOLVED] Disable .xsession-errors logging in LMDE 3

Post by Dr. Octagon » Sun Feb 24, 2019 8:33 am

My actual goal is to exclude unimportant writing processes... and (in this case) not only to protect my 9 year old ssd from a few kilobytes a day, but especially to keep logs to a minimum.
e.g. I have swapped out all unimportant logs (and most of them are when the system is running smoothly!) into a RAM file.

Maybe I am special in some way, but I want to have full control over my system and always know exactly what is stored somewhere and if it is necessary at all.

Just my two cents. 8)

Cu
Dr. Octagon
A good stumbler doesn't fall...

Post Reply

Return to “Software & Applications”