I recently tried to replace my Nvidia driver with the Nouveau driver for my Nvidia card, (see Switching from Nvidia proprietary driver to Nouveau driver for Nvidia card on Debian wheezy).

Unfortunately, this attempt crashed and burned, so I aborted it. However, after I booted back into my customary configuration, and the smoke cleared, I discovered something I knew already, that Debian only keeps one copy of the X server logs around, namely /var/log/Xorg.0.log. Therefore the log of my ill-fated attempt to switch to Nouveau had been lost.

So, my question is, how can I change Debian's configuration to keep old copies of the X log file?:

I thought this kind of logic was handled by logrotate, but /etc/logrotate.conf and /etc/logrotate.d/ don't have any specific logic about this, that I can see. Is it just a matter of adding something there? If so, I wonder why it isn't there already.

1 Answer 1


X's logging behavior is:

  1. If there is a /var/log/Xorg.DISPLAY.log, rename it to /var/log/Xorg.DISPLAY.log.old, overwriting any file that might be there.
  2. Open /var/log/Xorg.DISPLAY.log, and begin logging to it.

Unfortunately, this isn't configurable, except in the sense all open-source software is: you could change the source code and recompile. It's in the xserver-xorg source package, grep for LogInit to find the right spots.

That said, you could find a way to preserve old logs. For example, kdm has several scripts in /etc/kde4/kdm that it runs as root before showing the login screen; you could add a savelog command to save the .old file. gdm presumably has similar.

Or you could use dpkg-divert on /usr/bin/X and put a script there that calls savelog on the non-old file and then exec's the real X. You could also just change the path your display manager (kdm, gdm) uses to run X to that script, and not divert X.

  • 1
    great ansower! I am curious that the logrotate still cannot handle Xorg log till now? I saw bunch of feature request there date back to 2010.
    – Wang
    Commented Nov 10, 2015 at 11:04
  • The Xorg command has an option to specify the log file: -logfile <filename>, so why can't that be used?
    – currawong
    Commented Jan 18 at 4:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .