Is there a fix for Mate 24.04 massively spamming the .xsession-errors log with Critical Errors?

I finally discovered where .xsession-errors.old is constructed; it's hard-coded into lightdm (see lightdm/src/session.c at f043bfd81e10a3499e865aafd99781a4df854784 · canonical/lightdm · GitHub, and this commit: Use logrotate to handle files in the default log directory · canonical/lightdm@602dcab · GitHub). This hard-codes the creation of the .old file if the file already exists - and also creates a new .xsession-errors file.

I'd need to confirm this - but I think it's still possible that modifying /etc/X11/Xsession to create the symbolic link or to use /dev/null would do the trick.

[edit]
No; the lightdm session is started differently to how I thought. Happy for someone else to take it from here! Haven't got much more time to look into it.
[/edit]

2 Likes

Yep, we're on exactly the same page. I went through the entire 137 line /etc/X11/Xsession startup script and there is NOTHING that would account for the log rotation and resulting move of the current log to .old and subsequent creation of a new log file, so I also immediately assumed that this script was probably being overridden by the service based lightdm startup. If you check the original X11 Xsession script you'll see that if it finds that you have pointed it at a symbolic link, just as I feared, it just uses a call to mktemp to create a log in the sys tmp folder - and if that fails just bomb out and completly aborts the X startup:

if (umask 077 && touch "$ERRFILE") 2> /dev/null && [ -w "$ERRFILE" ] &&
[ ! -L "$ERRFILE" ]; then
chmod 600 "$ERRFILE"
elif ERRFILE=$(mktemp 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

I haven't had a chance to look at the hard-coded lightdm source, but knowing how programmers like to copy off each others homework, and NOT reinvent the wheel, it wouldn't surprise me if it also would have some kind of special handling for the scenario where it finds the log file has been replaced by a symbolic link.

Not sure why the Xsession startup seems to want to avoid a symlinked log file, since symlinks to simlinks are allowed, and it could still be symlinked to some hard-coded path name within X, but that seems to be the intent of the [ ! -L "$ERRFILE" ] test, and resulting reassignment of the log file to a random /tmp system log with:

" elif ERRFILE=$(mktemp 2> /dev/null) "

So, in examining the lightdm startup there are at least TWO potential gotchas that could complicate things -- 1) like the Xsession script, it might have special handling for symbolic links -- and -- 2) even if it accepts the symbolic link, it might just mv it right out of the way by renameing it to .old, then create a brand new file, with a brand new file handle, and write to that instead.

So, as I said - IT'S COMPLICATED . . .

ALSO, I would point out that NONE of the log redirect to /dev/null fixes are practical for the Mate LIVE SESSION which has a finite RAM based file system that will fill up at the rate of up to about 400Mb a day (5000bytes/sec times 86400 sec/day). I can imagine a nightmare scenario where someone tries Mate for a few days using the Live-ISO image, then clicks on the "Install Mate" icon on their Live-Desktop, intending to Install Mate alongside MS Windows, only to have the installer RUN OUT OF SPACE AND CRASH, potentially leaving their PC unbootable.

Seriously folks, we need to just FIX THIS - not just try to figure out ever more clever ways to hack around it - AND IGNORE IT.

I'd sincerely suggest to give it a try. You see, years of my experience (in the IT world) persistently demonstrate me that the real world does not follow the way I think it does.

2 Likes

You can easily alter that Xsession script to create a symbolic link after it has created the .xsession-errors file (see the line just after the IF block that you snipped) - the problem is, lightdm does something in its startup that over-rides that once you log in.

I'm not saying it wouldn't be nice if the patch was downstreamed; I'm just focussing on what we can do here to mitigate the issue.

And I'm not convinced that everything is as expected on your system because no one else has reported 100s of Mbs a day in their log (more like 20Kb on each occasion that Caja is opened). Unfortunately I dont have insight to offer there - but it would have been good to turn the log into a no-op at the least.

1 Like

I tried several ways to stop the spamming:

  • I used the symlink way -> either no success or too complicated to be workable
  • I edited /etx/X11/Xsession -> no success
  • I patched the binary /sbin/lightdm -> no success

Instead, this simple oneliner does the job perfectly:

sudo chattr +i $HOME/.xsession-errors
3 Likes

Hi, @Crotchety :slight_smile:

(Usual disclaimer: please note that I'm just another "Ubuntu MATE Community" Forum user - and moderator - here. I'm NOT an Ubuntu developer or an Ubuntu MATE developer or a MATE Desktop Environment developer or a Caja developer)

Besides the great answers that @stephematician , @ericmarceau , @OldStrummer, @ugnvs and @tkn have already given you in this topic, I believe I've found (by some experimentation) a simple "solution" for that massive filling of the ~/.xsession-errors file with the lines that - as you've (correctly) mentioned - are filling that file in your Ubuntu MATE 24.04.1 LTS ("Noble Numbat") computers.

The SOLUTION I've found is to disable the "Show Hidden Files" option in the "Caja" file explorer (that option is available in the "View" menu of the "Caja" file explorer). Please, try to do that, see if that also solves the problem for you and then reply again, here in this topic, and tell us if it also worked for you or not :slight_smile:

Now, regarding a more "final" solution: in the bug that you've correctly found "*Bug #2047457 “GLib-GIO-CRITICAL *: GFileInfo created without standard::symlink-target sort-order” : Bugs : glib-networking package : Ubuntu" - https://bugs.launchpad.net/ubuntu/+source/glib-networking/+bug/2047457 - there is the following comment that points to the upstream bug in "Caja":

By going to that "g_file_info_ unset attributes cause errors in the logs · Issue #1704 · mate-desktop/caja · GitHub" caja issue web page - https://github.com/mate-desktop/caja/issues/1704 - and as @stephematician has correctly mentioned in his earlier reply, "(...) you'll notice that the issue has been fixed upstream (i.e. in newer and development versions (...)". In fact, I will add now that I've found, in that same web page, the following comment that says that this issue is already fixed in the version 1.26.4 of Caja. Unfortunately, I've checked that both Ubuntu MATE 24.04 LTS ("Noble Numbat") and Ubuntu MATE 24.10 ("Oracular Oriole") still have the version 1.26.3 of Caja:

https://github.com/mate-desktop/caja/issues/1704#issuecomment-2461457603

lukefromdc commented on Nov 7, 2024 via email

Note that 1.26.4 has been out a while and includes the fix for this. Distros should have it by now

I hope this helps :slight_smile:

4 Likes

Got a big smile out of this, because at first I thought you were pulling my leg -- like the old joke about the guy who goes to the doctor and says, "Doc, it hurts when I do this..." -- to which the doctor cynically replies, "...then don't do that".

But now, after doing some testing, I see that you are not joking, and have honed in on an important aspect of this bug - as I was whining -- er uh 'commenting' earlier -- trying to investigate this issue MAKES IT WORSE. What did not occur to me was the corollary -- LEAVE IT ALONE AND IT WILL GET BETTER.

Based on your advise I tried checking for .xsession log spamming differently.

  • Rather than use caja to check the file's properties in caja (which itself causes major spamming)

-- Instead, check for spamming by simply opening a terminal and running:

watch ls -l ./.xsession-errors

Here are the results:

  1. With caja running but no windows open --> no spamming
  2. $HOME window open, View/Hidden Enabled, NO FILES OR FOLDERS SELECTED --> spamming
  3. $HOME window open, View/Hidden NOT SELECTED, NO files highlighted -> no spamming
  4. $HOME window open, View/Hidden NOT SELECTED, ANY Folder HIGHLIGHTED -> SPAMMING
  5. $HOME window open, View/Hidden NOT SELECTED, Executable Script HIGHLIGHTED -> SPAMMING
  6. $HOME window open, View/Hidden NOT SELECTED, Empty 'new file' HIGHLIGHTED -> SPAMMING

Clearly there is more to it than just the View/Hidden setting being enabled.

So it looks like, something as innocent as leaving your home folder in caja open with ANY FILE or ANY FOLDER highlighted, and YOU'RE OFF TO THE RACES.

Good to know that a fix is available. Since the fix is already written, it would seem that it's just a matter of backporting it to 24.04, and that definitely should be done, because caja's attribute processing IS CURRENTLY A MESS, with what will or will not set off the log spamming being a guessing game.

4 Likes

Does this cause X to create a tmp/xsession-$USER file; whether or not lightdm uses it I'm not sure :man_shrugging:

FWIW - I tested installing Caja 1.26.4 from the release and it's relatively straightforward (you'll need libnotify-dev, libgail-3-dev, and libmate-desktop-dev amongst some others). As expected, it does not spam the log. Then you'll just need to figure out what you want to do with the caja package (it's harmless to leave it installed, but if it gets updated or re-installed it may over-write the source build; I didn't check for the exact consquences).

3 Likes

No, I checked that meticulously :slight_smile:
It seems that lightdm is oblivious to the immutability of the file and writes happily to it ( to no avail ofcourse).

As an extra, here is a oneliner to check for immutable files in your home folder recursively:

lsattr -aR "$HOME" 2>>/dev/null |grep '^....i'

This comes in handy the moment you start using the chattr command to make things immutable.

3 Likes

That makes sense! I think I've figured out what lightdm is doing in its startup, I'm confident /etc/X11/Xsession script is not used by lightdm, so, yeah, there is no reason to expect a /tmp file. Also, making changes to the script won't help the issue - so my other suggestion (of course) didn't work.

Looks good to me; chattr +i turns operations on the file into (effectively) a no-op.

I've opened an feature request with lightdm, as it might be helpful to have a more tractable user option to mute output to the log file.

2 Likes

I realize this is a an old topic, I’m also running caja 1.26.3 – and I realize people saying that the issue has been fixed upstream at 1.26.4 // but here’s what I’m seeing.

High CPU use from caja, lots of errors logged to .xsession-errors at the rate of 1 MB every minute. The high CPU (and growth of .xsession-errors) goes away when I turn off view hidden files.

2 Likes

It seems Caja has a sullied history of bugs:

When @ricmarques mentioned turning off View/Show Hidden Files, it reminded me of the above bug. You might try turning off some other options, too, such as Preferences/Preview.

2 Likes

Would it be too much to ask that you turn the hidden files back on and share with the Community a portion of the error messages that are being logged in the .xsession-errors file, something like 50-100 lines, to get a feel of what is giving Caja a "sore stomach"?

Thank you in advance.

2 Likes

Hi - no problem –

I’ll have to eat my words, now .xsession-errors gets spammed no matter having hidden files on/off and NOT EVEN STARTING CAJA… it starts getting spammed just after system startup.

I’ll include a bit of the preamble to the repeated error which is (caja 2904)

dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/busdbus-update-activation-environment: setting LC_NUMERIC=en_CA.UTF-8dbus-update-activation-environment: setting _=/usr/bin/dbus-update-activation-environmentmate-session[2581]: WARNING: Unable to find provider '' of required component 'dock'discover_other_daemon: 1Window manager warning: Log level 128: unsetenv() is not thread-safe and should not be used after threads are createdWindow manager warning: Log level 128: Name com.canonical.AppMenu.Registrar does not exist on the session bus
Window manager warning: Log level 128: Name com.canonical.AppMenu.Registrar on the session bus is owned by :1.30
GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Object does not exist at path “/com/canonical/AppMenu/Registrar”discover_other_daemon: 1** (process:2970): WARNING **: 10:40:47.244: Unable to test URL with URL Dispatcher: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name com.lomiri.URLDispatcher was not provided by any .service files
(process:2970): ayatana-indicator-datetime-WARNING **: 10:40:47.245: ayatana-indicator-datetime cannot show EDS appointments: Error calling StartServiceByName for org.gnome.evolution.dataserver.Sources5: Unit evolution-source-registry.service not found.discover_other_daemon: 1(process:3019): ayatana-indicator-sound-WARNING **: 10:40:47.281: volume-control-pulse.vala:756: unable to get pulse unix socket: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.PulseAudio1 was not provided by any .service filesdiscover_other_daemon: 1(caja:2904): Gtk-WARNING **: 10:40:47.322: Failed to register client: GDBus.Error:org.gnome.SessionManager.AlreadyRegistered: Unable to register client
(mate-settings-daemon:2718): Gtk-WARNING **: 10:40:47.447: Negative content width -5 (allocation 1, extents 3x3) while allocating gadget (node image, owner GtkImage)
(mate-settings-daemon:2718): Gtk-WARNING **: 10:40:47.447: Negative content height -5 (allocation 1, extents 3x3) while allocating gadget (node image, owner GtkImage)blueman-applet 10.40.47 WARNING  PluginManager:151 __load_plugin: Not loading DhcpClient because its conflict has higher priorityblueman-applet 10.40.47 WARNING  PluginManager:151 __load_plugin: Not loading PPPSupport because its conflict has higher priorityblueman-applet 10.40.47 WARNING  DiscvManager:119 update_menuitems: warning: Adapter is None
(caja:2904): GLib-GIO-CRITICAL **: 10:40:47.779: GFileInfo created without standard::sort-order
(caja:2904): GLib-GIO-CRITICAL **: 10:40:47.779: file ../../../gio/gfileinfo.c: line 2107 (g_file_info_get_sort_order): should not be reached
(caja:2904): GLib-GIO-CRITICAL **: 10:40:47.779: GFileInfo created without standard::symlink-target
(caja:2904): GLib-GIO-CRITICAL **: 10:40:47.779: file ../../../gio/gfileinfo.c: line 2061 (g_file_info_get_symlink_target): should not be reached
(caja:2904): GLib-GIO-CRITICAL **: 10:40:47.780: GFileInfo created without 
1 Like

The various WARNING messages are reporting some incompatibility conditions, of which various system components are aware of, and have coded fallbacks or gracefull failure.

The others are more serious. I don't know enough to say whether those are

  • system capability failure criticality,         or
  • user-impacting (functionality or reporting accuracy) failure

If you wanted to get a condensed version of the full report, you could try using

sort < ~/.xsession-errors | uniq

and, optionally, add the following at the end of that command, to ignore the likely non-impacting warning messages:

| grep -v -i "warning"

:slight_smile:

1 Like

Hi Eric

Here’s the output of cat ~/.xsession-errors | sort --unique | grep -v '(caja)'

blueman-applet 21.24.50 WARNING DiscvManager:119 update_menuitems: warning: Adapter is None
blueman-applet 21.24.50 WARNING PluginManager:151 __load_plugin: Not loading DhcpClient because its conflict has higher priority
blueman-applet 21.24.50 WARNING PluginManager:151 __load_plugin: Not loading PPPSupport because its conflict has higher priority
dbus-update-activation-environment: setting COMPIZ_CONFIG_PROFILE=mate
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
dbus-update-activation-environment: setting DEBUGINFOD_URLS=https://debuginfod.ubuntu.com
dbus-update-activation-environment: setting DESKTOP_SESSION=mate
dbus-update-activation-environment: setting DISPLAY=:0
dbus-update-activation-environment: setting GDM_LANG=en_US
dbus-update-activation-environment: setting GDMSESSION=mate
dbus-update-activation-environment: setting GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
dbus-update-activation-environment: setting GTK_MODULES=appmenu-gtk-module:gail:atk-bridge:canberra-gtk-module
dbus-update-activation-environment: setting GTK_OVERLAY_SCROLLING=0
dbus-update-activation-environment: setting HOME=/home/jojo
dbus-update-activation-environment: setting IM_CONFIG_PHASE=1
dbus-update-activation-environment: setting LANG=en_US.UTF-8
dbus-update-activation-environment: setting LANGUAGE=en_US:en
dbus-update-activation-environment: setting LC_ADDRESS=en_CA.UTF-8
dbus-update-activation-environment: setting LC_IDENTIFICATION=en_CA.UTF-8
dbus-update-activation-environment: setting LC_MEASUREMENT=en_CA.UTF-8
dbus-update-activation-environment: setting LC_MONETARY=en_CA.UTF-8
dbus-update-activation-environment: setting LC_NAME=en_CA.UTF-8
dbus-update-activation-environment: setting LC_NUMERIC=en_CA.UTF-8
dbus-update-activation-environment: setting LC_PAPER=en_CA.UTF-8
dbus-update-activation-environment: setting LC_TELEPHONE=en_CA.UTF-8
dbus-update-activation-environment: setting LC_TIME=en_CA.UTF-8
dbus-update-activation-environment: setting LOGNAME=jojo
dbus-update-activation-environment: setting PAPERSIZE=letter
dbus-update-activation-environment: setting PATH=/home/jojo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
dbus-update-activation-environment: setting PWD=/home/jojo
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: setting QT_QPA_PLATFORMTHEME=gtk2
dbus-update-activation-environment: setting SHELL=/bin/bash
dbus-update-activation-environment: setting SHLVL=0
dbus-update-activation-environment: setting UBUNTU_MENUPROXY=1
dbus-update-activation-environment: setting USER=jojo
dbus-update-activation-environment: setting _=/usr/bin/dbus-update-activation-environment
dbus-update-activation-environment: setting XAUTHORITY=/home/jojo/.Xauthority
dbus-update-activation-environment: setting XDG_CONFIG_DIRS=/etc/xdg/xdg-mate:/etc/xdg
dbus-update-activation-environment: setting XDG_CURRENT_DESKTOP=MATE
dbus-update-activation-environment: setting XDG_DATA_DIRS=/usr/share/mate:/usr/local/share:/usr/share:/var/lib/snapd/desktop
dbus-update-activation-environment: setting XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/jojo
dbus-update-activation-environment: setting XDG_RUNTIME_DIR=/run/user/1000
dbus-update-activation-environment: setting XDG_SESSION_CLASS=user
dbus-update-activation-environment: setting XDG_SESSION_DESKTOP=mate
dbus-update-activation-environment: setting XDG_SESSION_TYPE=x11
discover_other_daemon: 1
discover_other_daemon: 1Window manager warning: Log level 128: unsetenv() is not thread-safe and should not be used after threads are created
GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Object does not exist at path “/com/canonical/AppMenu/Registrar”
mate-session[2227]: WARNING: Unable to find provider '' of required component 'dock'
(mate-settings-daemon:2598): Gtk-WARNING **: 21:24:50.827: Negative content height -5 (allocation 1, extents 3x3) while allocating gadget (node image, owner GtkImage)
(mate-settings-daemon:2598): Gtk-WARNING **: 21:24:50.827: Negative content width -5 (allocation 1, extents 3x3) while allocating gadget (node image, owner GtkImage)
** (process:2885): WARNING **: 21:24:50.572: Unable to test URL with URL Dispatcher: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name com.lomiri.URLDispatcher was not provided by any .service files
(process:2931): ayatana-indicator-sound-WARNING **: 21:24:50.611: volume-control-pulse.vala:756: unable to get pulse unix socket: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.PulseAudio1 was not provided by any .service files
Window manager warning: Log level 128: Name com.canonical.AppMenu.Registrar does not exist on the session bus
Window manager warning: Log level 128: Name com.canonical.AppMenu.Registrar on the session bus is owned by :1.34

the screen brightness stopped responding … neither use the slider in the power managment menu nor with the keybindings on the keyboard — I can verify that I can see the keyboard events FN+F5/F6 using xev but no response. My grub file looks like this:


GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`( . /etc/os-release; echo ${NAME:-Ubuntu} ) 2>/dev/null || echo Ubuntu`
# was this --> grub_cmdline_linux_default="quiet splash i8042.reset 
# now it's this --> grub_cmdline_linux_default=""
GRUB_CMDLINE_LINUX=""

I took out the quiet splash so that i could see all the boot messages.

1 Like

The first warning says more or less: "can't find a dock but you had registered one"

I consecutively consulted Duck AI to have a 2nd opinion about that:

This warning typically indicates that the MATE desktop environment is looking for a dock component that is not available. You can often resolve it by editing the required components list in the dconf-editor and removing the 'dock' entry.

... which more or less and kind of confirms my conjecture although, contrary to Duck AI, I think it is all mate-panel related.

The second and third warning/error seem to be related to appmenu not found or registered (also a mate-panel thing).

You could try this maybe try this:

sudo apt install appmenu-gtk2 appmenu-gtk3

or reinstall if those were installed already.

I asked Duck AI about the window manager warning. This is its answer:

The message "Name com.canonical.AppMenu.Registrar does not exist on the session bus" typically indicates that the application is trying to access a service that is not available, often due to changes in the desktop environment or missing components. This can happen when using certain Linux distributions that have switched desktop environments, like from Unity to GNOME.

I guess the rest of the errors are more of the same kind. It certainly looks like it.

In short: It looks like you changed to a different panel layout (or desktop) somewhere in the past but your environment doesn't know about it yet.

Is that correct ?

You might try to use MATE-tweak to switch to one of the preset panel layouts and see if that fixes the spamming. If it still produces errors, please post them here. It might indicate that you are missing certain parts of your desktop install.

1 Like

Just so you are clear, the grep -v '(caja)' will show you everything which is NOT related to caja.

Is that what you really wanted? I thought you were looking to see what was impacting caja. :slight_smile:

1 Like

Yes I knew that it excludes the mention of CAJA

Thank you

So installed KDE in order to test whether the touchpad hardware is broken. And indeed it is. But now I have KDE installed…

1 Like