MRW
http://piratenpartei.ch

Piratenpartei Zürich
PC 85-112704-0

Der Politnetz Auftritt von Marc Wäckerlin Im Politnetz unterstützen

Get Rid of the Damned Bullshit .xsession-error That's Filling Up The Home Directory

The file .xsession-error gets extremely huge, several giga bytes with nonsense contents. It does not contain real errors or problems, but millions of bytes of absolutely useless nonsense debugging bullshit. See Example Snipppets of the Contents ath the end for some snippets.

It is very difficult to get rid of this useless shit, because if you delete the file, the contents is not freed before you log off. If you create the file as link to /dev/null, it will be recreated as normal file on next login. Even if you take away the write access (chomod ugo= ~/.xsession-errors) and even if you give it to user root (chown root.root ~/.xsession-errors), it does not help. After next reboot, the file will be restored with read-/write-access for the user.

The file /etc/X11/Xsession is responsible for this bad behavior. You need to edit that file as root (e.g. sudo xemacs /etc/X11/Xsession and to remove all that bullshit. I commented it out (it's on top) and replaced exec >>"$ERRFILE" 2>&1 by exec >> /dev/null 2>&1:

[...]
USERXSESSIONRC=$HOME/.xsessionrc
ALTUSERXSESSION=$HOME/.Xsession

# Get rid of this damned bullshit ERRFILE filling up the whole home directory

# 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

# # truncate ERRFILE if it is too big to avoid disk usage DoS
# if [ "`stat -c%s \"$ERRFILE\"`" -gt 500000 ]; then
#   T=`mktemp -p "$HOME"`
#   tail -c 500000 "$ERRFILE" > "$T" && mv -f "$T" "$ERRFILE" || rm -f "$T"
# fi

#exec >>"$ERRFILE" 2>&1
exec >> /dev/null 2>&1

[...]

Example Snipppets of the Contents

The file .xsession-errors contains gigabytes of useless nonsense, such as:

[...]
startkde: Starting up...
kdeinit4: preparing to launch /usr/lib/kde4/libexec/klauncher
kdeinit4: preparing to launch /usr/bin/kded4
[...]
RandRScreen::loadSettings - adding mode:  578 1920 x 1080
RandRScreen::loadSettings - adding mode:  579 1680 x 1050
RandRScreen::loadSettings - adding mode:  580 1680 x 1050
RandRScreen::loadSettings - adding mode:  581 1600 x 1024
RandRScreen::loadSettings - adding mode:  582 1440 x 900
RandRScreen::loadSettings - adding mode:  583 1400 x 1050
[...]
kded(17110) KDEDModule::setModuleName: registerObject() returned false for  "knetworkmanager"
kded(17110) KNetworkManagerService::serviceRegistered: service registered
plasma(17187) NetworkManagerApplet::NetworkManagerApplet: 567
kded(17110) KConfigToService::start:
kded(17110) KConfigToService::restoreConnection: "{fb5f29e1-6d0f-4133-a918-dc888d2ed9de}"
[...]
plasma(17187) KServiceFactory::findServiceByDesktopPath: "findServiceByDesktopPath: /privat/home/marc/.kde/share/apps/RecentDocuments/Y3_s8m2UwcA.flv[2].desktop not found"
plasma(17187) KServiceFactory::findServiceByDesktopPath: "findServiceByDesktopPath: /privat/home/marc/.kde/share/apps/RecentDocuments/Y3_s8m2UwcA.flv.desktop not found"
plasma(17187) KServiceFactory::findServiceByDesktopPath: "findServiceByDesktopPath: /privat/home/marc/.kde/share/apps/RecentDocuments/litte bitte grann tortur.flv.desktop not found"
[...]
kded(17110) KDEDModule::setModuleName: registerObject() successful for  "networkstatus"
QPainter::begin: Cannot paint on a null pixmap
Couldn't resolve property: linearGradient3229
QSvgHandler::parsePen could not resolve property "linearGradient4504"
[...]
kio_desktop(17214) KIO::ForwardingSlaveBase::prepareUDSEntry: New Mimetype =  "application/x-desktop"
kio_desktop(17214) KIO::ForwardingSlaveBase::prepareUDSEntry: New Mimetype =  "application/x-desktop"
kio_desktop(17214) KIO::ForwardingSlaveBase::prepareUDSEntry: New Mimetype =  "application/x-desktop"
kio_desktop(17214) KIO::ForwardingSlaveBase::prepareUDSEntry: New Mimetype =  "application/vnd.ms-powerpoin[...]
[...]
kxkb(17225) KxkbConfig::load: Model: "pc105"
kxkb(17225) KxkbConfig::load:  added layout "ch(de)"
kxkb(17225) KxkbConfig::load:  added layout "ru(phonetic)"
kxkb(17225) KxkbConfig::load:  added layout "ara"
kxkb(17225) KxkbConfig::load:  added layout "gr"
[...]

Diskussion

, %2012/%11/%03 %16:%Nov:

the allmighty error looog ;) I'll try deleting the file and making a directory with the same name. That should also make it impossible to produce a new file.. If it doesn't help, I'll try your solution.

, %2013/%08/%30 %08:%Aug:

Got Mail:


Hi, I liked the page you wrote there, but it seems I cannot comment on it. I just wanted to offer you an alternative solution than editing the /etc/X11/Xsession file.

: > .xsession-errors; sudo chattr +i .xsession-errors

If you want to edit system wide, it also may work to just edit the variable ERRFILE=/dev/null

Cheers, Sepero